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
+77 -26
View File
@@ -1035,35 +1035,86 @@ 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",
"import_date_used": import_date,
"source": source
})
return { try:
"imdb_id": imdb_id, # Get the movie processor instance to test full decision logic
"radarr_configured": True, movie_processor = batcher.movie_processor
"movie_found": True, if movie_processor:
"movie_title": movie_title, # Test the full decision logic (including TMDB fallback)
"movie_id": movie_id, final_date, final_source, released = movie_processor._decide_movie_dates(
"detected_import_date": import_date, imdb_id, dummy_path, should_query=True, existing=None
"import_source": source, )
"movie_files": file_info,
"debug_info": { _log("INFO", f"=== FULL PIPELINE RESULT ===")
"radarr_url": os.environ.get("RADARR_URL"), _log("INFO", f"Final date: {final_date}")
"movie_digital_release": movie_obj.get("digitalRelease"), _log("INFO", f"Final source: {final_source}")
"movie_in_cinemas": movie_obj.get("inCinemas"), _log("INFO", f"Released (theater): {released}")
"movie_physical_release": movie_obj.get("physicalRelease"),
"movie_folder_path": movie_obj.get("folderPath") return {
"imdb_id": imdb_id,
"radarr_configured": True,
"movie_found": True,
"movie_title": movie_title,
"movie_id": movie_id,
"full_pipeline_test": {
"final_date": final_date,
"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": {
"radarr_url": os.environ.get("RADARR_URL"),
"movie_digital_release": movie_obj.get("digitalRelease"),
"movie_in_cinemas": movie_obj.get("inCinemas"),
"movie_physical_release": movie_obj.get("physicalRelease"),
"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}")