mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-17 16:50:53 +00:00
fix(vod): preserve advanced-refresh metadata and fix youtube_trailer key
- Use 'youtube_trailer' key (matching api_views.py and advanced refresh) instead of orphaned 'trailer' key that was never consumed. - On basic sync, only write director/actors/release_date to custom_properties when the field is currently empty. This prevents basic sync from overwriting richer data previously stored by refresh_movie_advanced_data, while still populating those fields for movies that have never had an advanced refresh run. Tested: logic verified against all three scenarios (preserve existing rich data, populate empty fields, youtube_trailer key propagation). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f08a30e303
commit
ac84916974
1 changed files with 11 additions and 2 deletions
|
|
@ -453,7 +453,7 @@ def process_movie_batch(account, batch, categories, relations, scan_start_time=N
|
|||
|
||||
custom_props = {}
|
||||
if trailer:
|
||||
custom_props['trailer'] = trailer
|
||||
custom_props['youtube_trailer'] = trailer
|
||||
if director:
|
||||
custom_props['director'] = director
|
||||
if actors:
|
||||
|
|
@ -573,9 +573,18 @@ def process_movie_batch(account, batch, categories, relations, scan_start_time=N
|
|||
# Merge incoming props into the existing dict so that
|
||||
# detailed_info and other keys written by advanced refresh
|
||||
# are not lost when a basic sync runs afterwards.
|
||||
# For metadata fields (director/actors/release_date), only
|
||||
# write if the field is empty — advanced refresh may have
|
||||
# stored richer data that basic sync must not overwrite.
|
||||
existing_cp = movie.custom_properties or {}
|
||||
incoming_cp = value or {}
|
||||
merged = {**existing_cp, **incoming_cp}
|
||||
merged = dict(existing_cp)
|
||||
for k, v in incoming_cp.items():
|
||||
if k in ('director', 'actors', 'release_date'):
|
||||
if not existing_cp.get(k):
|
||||
merged[k] = v
|
||||
else:
|
||||
merged[k] = v
|
||||
if merged != existing_cp:
|
||||
movie.custom_properties = merged
|
||||
updated = True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue