digital release logic
This commit is contained in:
+24
-33
@@ -965,14 +965,11 @@ async def debug_movie_history(imdb_id: str):
|
||||
|
||||
_log("INFO", f"=== DETAILED HISTORY ANALYSIS: {imdb_id} ===")
|
||||
|
||||
if not (os.environ.get("RADARR_URL") and os.environ.get("RADARR_API_KEY")):
|
||||
return {"error": "Radarr not configured"}
|
||||
# Use database-only mode for consistency
|
||||
if not movie_processor.radarr.db_client:
|
||||
return {"error": "Radarr database not configured"}
|
||||
|
||||
from clients.radarr_client import RadarrClient
|
||||
radarr_client = RadarrClient(
|
||||
os.environ.get("RADARR_URL"),
|
||||
os.environ.get("RADARR_API_KEY")
|
||||
)
|
||||
radarr_client = movie_processor.radarr
|
||||
|
||||
# Look up movie
|
||||
movie_obj = radarr_client.movie_by_imdb(imdb_id)
|
||||
@@ -982,32 +979,18 @@ async def debug_movie_history(imdb_id: str):
|
||||
movie_id = movie_obj.get("id")
|
||||
movie_title = movie_obj.get("title")
|
||||
|
||||
# Get ALL history pages
|
||||
all_history = []
|
||||
page = 1
|
||||
# Get history from database instead of API
|
||||
if not radarr_client.db_client:
|
||||
return {"error": "Database-only mode required"}
|
||||
|
||||
while page <= 10: # Safety limit
|
||||
data = radarr_client._get("/api/v3/history", {
|
||||
"movieId": movie_id,
|
||||
"page": page,
|
||||
"pageSize": 50,
|
||||
"sortKey": "date",
|
||||
"sortDirection": "ascending"
|
||||
})
|
||||
|
||||
if not data:
|
||||
break
|
||||
|
||||
records = data if isinstance(data, list) else data.get("records", [])
|
||||
if not records:
|
||||
break
|
||||
|
||||
all_history.extend(records)
|
||||
|
||||
if len(records) < 50:
|
||||
break
|
||||
|
||||
page += 1
|
||||
# TODO: Implement database-only history retrieval
|
||||
return {
|
||||
"error": "History endpoint temporarily disabled - use /debug/movie/{imdb_id}/priority for date analysis",
|
||||
"imdb_id": imdb_id,
|
||||
"movie_id": movie_id,
|
||||
"movie_title": movie_title,
|
||||
"note": "This endpoint needs database-only implementation to avoid showing wrong movie events"
|
||||
}
|
||||
|
||||
# Analyze each event
|
||||
analyzed_events = []
|
||||
@@ -1196,13 +1179,21 @@ async def debug_movie_priority_logic(imdb_id: str):
|
||||
"source": import_source
|
||||
}
|
||||
|
||||
# Get digital release dates
|
||||
# Get digital release dates with detailed logging
|
||||
digital_date, digital_source = movie_processor._get_digital_release_date(imdb_id)
|
||||
if digital_date:
|
||||
result["date_sources"]["digital_release"] = {
|
||||
"date": digital_date,
|
||||
"source": digital_source
|
||||
}
|
||||
else:
|
||||
# Add debug info about why digital date wasn't found
|
||||
candidates = movie_processor.external_clients.get_digital_release_candidates(imdb_id)
|
||||
result["date_sources"]["digital_release_debug"] = {
|
||||
"candidates_found": len(candidates),
|
||||
"candidates": candidates[:3] if candidates else [], # Show first 3
|
||||
"reason": digital_source if digital_source else "no_digital_dates_found"
|
||||
}
|
||||
|
||||
# Show priority logic
|
||||
if config.movie_priority == "import_then_digital":
|
||||
|
||||
Reference in New Issue
Block a user