Fix private repo authentication and enhance debug endpoint

- Add authentication to git clone commands in CI workflows for private repo support
- Enhanced debug endpoint to test FULL movie processing pipeline (not just database)
- Debug now shows both database result AND final TMDB fallback decision
- Will reveal if TMDB API calls are working correctly for rename-first scenarios
This commit is contained in:
2025-09-10 09:04:26 -04:00
parent bf7fb27fdb
commit fc983ed472
3 changed files with 79 additions and 28 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ jobs:
# Clone the repository since Gitea runner doesn't auto-checkout # Clone the repository since Gitea runner doesn't auto-checkout
echo "Cloning repository (dev branch)..." echo "Cloning repository (dev branch)..."
git clone -b dev http://192.168.253.221:3000/jskala/NFOguard.git /tmp/repo git clone -b dev http://${{ secrets.username }}:${{ secrets.token }}@192.168.253.221:3000/jskala/NFOguard.git /tmp/repo
cp -r /tmp/repo/* . cp -r /tmp/repo/* .
cp -r /tmp/repo/.* . 2>/dev/null || true cp -r /tmp/repo/.* . 2>/dev/null || true
rm -rf /tmp/repo rm -rf /tmp/repo
+1 -1
View File
@@ -21,7 +21,7 @@ jobs:
# Clone the repository since Gitea runner doesn't auto-checkout # Clone the repository since Gitea runner doesn't auto-checkout
echo "Cloning repository..." echo "Cloning repository..."
git clone http://192.168.253.221:3000/jskala/NFOguard.git /tmp/repo git clone http://${{ secrets.username }}:${{ secrets.token }}@192.168.253.221:3000/jskala/NFOguard.git /tmp/repo
cp -r /tmp/repo/* . cp -r /tmp/repo/* .
cp -r /tmp/repo/.* . 2>/dev/null || true cp -r /tmp/repo/.* . 2>/dev/null || true
rm -rf /tmp/repo rm -rf /tmp/repo
+64 -13
View File
@@ -1035,17 +1035,26 @@ async def debug_movie_import_date(imdb_id: str):
_log("INFO", f"Found movie: {movie_title} (Radarr ID: {movie_id})") _log("INFO", f"Found movie: {movie_title} (Radarr ID: {movie_id})")
# Get import date with detailed logging - DATABASE ONLY # Test the FULL movie processing pipeline (not just database lookup)
import_date, source = radarr_client.get_movie_import_date(movie_id, fallback_to_file_date=True) _log("INFO", f"=== TESTING FULL MOVIE PROCESSING PIPELINE ===")
# Movie files info - DATABASE ONLY mode (minimal info) # Create a dummy path for testing the decision logic
file_info = [] from pathlib import Path
if import_date: dummy_path = Path("/tmp/test")
file_info.append({
"note": "DATABASE ONLY MODE - File details from database queries", try:
"import_date_used": import_date, # Get the movie processor instance to test full decision logic
"source": source movie_processor = batcher.movie_processor
}) if movie_processor:
# Test the full decision logic (including TMDB fallback)
final_date, final_source, released = movie_processor._decide_movie_dates(
imdb_id, dummy_path, should_query=True, existing=None
)
_log("INFO", f"=== FULL PIPELINE RESULT ===")
_log("INFO", f"Final date: {final_date}")
_log("INFO", f"Final source: {final_source}")
_log("INFO", f"Released (theater): {released}")
return { return {
"imdb_id": imdb_id, "imdb_id": imdb_id,
@@ -1053,9 +1062,16 @@ async def debug_movie_import_date(imdb_id: str):
"movie_found": True, "movie_found": True,
"movie_title": movie_title, "movie_title": movie_title,
"movie_id": movie_id, "movie_id": movie_id,
"detected_import_date": import_date, "full_pipeline_test": {
"import_source": source, "final_date": final_date,
"movie_files": file_info, "final_source": final_source,
"theater_release": released,
"decision_logic": "✅ TESTED FULL PIPELINE INCLUDING TMDB FALLBACK"
},
"database_only_test": {
"radarr_db_result": radarr_client.get_movie_import_date(movie_id, fallback_to_file_date=True),
"note": "This is just the database part - fallback happens in full pipeline"
},
"debug_info": { "debug_info": {
"radarr_url": os.environ.get("RADARR_URL"), "radarr_url": os.environ.get("RADARR_URL"),
"movie_digital_release": movie_obj.get("digitalRelease"), "movie_digital_release": movie_obj.get("digitalRelease"),
@@ -1064,6 +1080,41 @@ async def debug_movie_import_date(imdb_id: str):
"movie_folder_path": movie_obj.get("folderPath") "movie_folder_path": movie_obj.get("folderPath")
} }
} }
else:
_log("ERROR", "Movie processor not available - testing database only")
# Fallback to database-only testing
import_date, source = radarr_client.get_movie_import_date(movie_id, fallback_to_file_date=True)
return {
"error": "Movie processor not available - only database test performed",
"imdb_id": imdb_id,
"radarr_configured": True,
"movie_found": True,
"movie_title": movie_title,
"movie_id": movie_id,
"detected_import_date": import_date,
"import_source": source,
"debug_info": {
"note": "FULL PIPELINE TEST FAILED - movie processor not initialized"
}
}
except Exception as pipeline_error:
_log("ERROR", f"Full pipeline test failed: {pipeline_error}")
# Fallback to database-only testing
import_date, source = radarr_client.get_movie_import_date(movie_id, fallback_to_file_date=True)
return {
"pipeline_error": str(pipeline_error),
"imdb_id": imdb_id,
"radarr_configured": True,
"movie_found": True,
"movie_title": movie_title,
"movie_id": movie_id,
"detected_import_date": import_date,
"import_source": source,
"debug_info": {
"note": "FULL PIPELINE TEST FAILED - showing database-only result"
}
}
except Exception as e: except Exception as e:
_log("ERROR", f"Debug endpoint error for {imdb_id}: {e}") _log("ERROR", f"Debug endpoint error for {imdb_id}: {e}")