sonarr: fix airdates not being used.
Local Docker Build (Dev) / build-dev (push) Successful in 4s

This commit is contained in:
2025-10-16 08:51:54 -04:00
parent d17f924192
commit c5177ba920
3 changed files with 51 additions and 4 deletions
+12 -1
View File
@@ -229,14 +229,25 @@ class TVProcessor:
_log("WARNING", f"S{season:02d}E{episode:02d}: No aired date found from external APIs for {imdb_id}")
# Use air date as fallback for dateadded if no import date found
if not dateadded and aired and source != "sonarr:history.import":
if not dateadded and aired:
# Always use air date as fallback when no import date is available
dateadded = aired
if source == "sonarr:no_import_date":
source = "sonarr:aired_fallback"
elif source == "sonarr:history.import":
# This shouldn't happen but handle it gracefully
source = "sonarr:aired_fallback"
else:
source = f"{source}_fallback" if source != "unknown" else "aired_fallback"
_log("DEBUG", f"S{season:02d}E{episode:02d}: Using aired date as fallback: {dateadded} (source: {source})")
# Ensure air date is saved to database even if used as dateadded fallback
if aired and not dateadded:
# This is a fallback for cases where we have air date but absolutely no dateadded
dateadded = aired
source = "aired_only_fallback"
_log("INFO", f"S{season:02d}E{episode:02d}: No import date found, using air date as both aired and dateadded: {dateadded}")
episode_dates[(season, episode)] = (aired, dateadded, source)
return episode_dates