fix: digital realease date
Local Docker Build (Dev) / build-dev (push) Successful in 4s

This commit is contained in:
2025-10-14 15:46:07 -04:00
parent 249b55964e
commit 6fae41aef5
3 changed files with 107 additions and 16 deletions
+35 -16
View File
@@ -326,6 +326,11 @@ async def update_movie_date(dependencies: dict, imdb_id: str, dateadded: Optiona
"""Update dateadded for a specific movie"""
db = dependencies["db"]
# Debug logging to track the issue
print(f"🔍 UPDATE_MOVIE_DATE: imdb_id={imdb_id}, dateadded={dateadded}, source={source}")
print(f" - dateadded type: {type(dateadded)}")
print(f" - dateadded repr: {repr(dateadded)}")
# Validate movie exists
movie = db.get_movie_dates(imdb_id)
if not movie:
@@ -451,10 +456,12 @@ async def get_movie_date_options(dependencies: dict, imdb_id: str):
# Debug logging to understand the data issue
print(f"🔍 DEBUG: Movie data for {imdb_id}:")
print(f" - released: {movie.get('released')}")
print(f" - dateadded: {movie.get('dateadded')}")
print(f" - source: {movie.get('source')}")
print(f" - path: {movie.get('path')}")
print(f" - released: {repr(movie.get('released'))}")
print(f" - dateadded: {repr(movie.get('dateadded'))}")
print(f" - source: {repr(movie.get('source'))}")
print(f" - path: {repr(movie.get('path'))}")
print(f" - has_video_file: {repr(movie.get('has_video_file'))}")
print(f" - last_updated: {repr(movie.get('last_updated'))}")
options = []
@@ -486,18 +493,26 @@ async def get_movie_date_options(dependencies: dict, imdb_id: str):
})
# Option 2: Released date as digital release (if different from current)
if movie.get('released'):
release_date = f"{movie['released']}T00:00:00"
# Only add if it's different from current dateadded
current_dateadded = movie.get('dateadded', '')
if not current_dateadded or not current_dateadded.startswith(movie['released']):
options.append({
"type": "digital_release",
"label": "Use Actual Release Date",
"date": release_date,
"source": "digital_release",
"description": f"Use the movie's actual release date: {movie['released']} (instead of download date)"
})
if movie.get('released') and movie['released'].strip():
try:
release_date = f"{movie['released']}T00:00:00"
# Validate the date format
from datetime import datetime
datetime.fromisoformat(release_date.replace('Z', '+00:00'))
# Only add if it's different from current dateadded
current_dateadded = movie.get('dateadded', '')
if not current_dateadded or not current_dateadded.startswith(movie['released']):
options.append({
"type": "digital_release",
"label": "Use Actual Release Date",
"date": release_date,
"source": "digital_release",
"description": f"Use the movie's actual release date: {movie['released']} (instead of download date)"
})
except Exception as e:
print(f"⚠️ Invalid released date format for {imdb_id}: {movie.get('released')} - {e}")
# Don't add this option if the date is invalid
# Option 3: Manual entry
options.append({
@@ -516,6 +531,10 @@ async def get_movie_date_options(dependencies: dict, imdb_id: str):
except Exception:
pass
print(f"🔍 DEBUG: Generated {len(options)} options for {imdb_id}:")
for i, option in enumerate(options):
print(f" Option {i}: {option}")
return {
"imdb_id": imdb_id,
"current_data": movie,