rename #33
@@ -78,11 +78,16 @@ async def sonarr_webhook(request: Request, background_tasks: BackgroundTasks, de
|
|||||||
|
|
||||||
# For all webhook events, if no episodes in webhook.episodes, try to extract from episodeFile
|
# For all webhook events, if no episodes in webhook.episodes, try to extract from episodeFile
|
||||||
# This ensures targeted processing for single episode operations (Download, Rename, Upgrade)
|
# This ensures targeted processing for single episode operations (Download, Rename, Upgrade)
|
||||||
|
print(f"DEBUG: webhook.episodeFile present: {webhook.episodeFile is not None}")
|
||||||
|
if webhook.episodeFile:
|
||||||
|
print(f"DEBUG: episodeFile content: {webhook.episodeFile}")
|
||||||
|
|
||||||
if not episodes_data and webhook.episodeFile:
|
if not episodes_data and webhook.episodeFile:
|
||||||
episode_file = webhook.episodeFile
|
episode_file = webhook.episodeFile
|
||||||
# Extract season and episode from episodeFile if available
|
# Extract season and episode from episodeFile if available
|
||||||
season_num = episode_file.get("seasonNumber")
|
season_num = episode_file.get("seasonNumber")
|
||||||
episode_num = episode_file.get("episodeNumber")
|
episode_num = episode_file.get("episodeNumber")
|
||||||
|
print(f"DEBUG: episodeFile seasonNumber: {season_num}, episodeNumber: {episode_num}")
|
||||||
if season_num and episode_num:
|
if season_num and episode_num:
|
||||||
# Create episode data structure that matches what process_webhook_episodes expects
|
# Create episode data structure that matches what process_webhook_episodes expects
|
||||||
episodes_data = [{
|
episodes_data = [{
|
||||||
@@ -92,6 +97,8 @@ async def sonarr_webhook(request: Request, background_tasks: BackgroundTasks, de
|
|||||||
"title": episode_file.get("title")
|
"title": episode_file.get("title")
|
||||||
}]
|
}]
|
||||||
print(f"INFO: Extracted episode info from episodeFile for {webhook.eventType}: S{season_num:02d}E{episode_num:02d}")
|
print(f"INFO: Extracted episode info from episodeFile for {webhook.eventType}: S{season_num:02d}E{episode_num:02d}")
|
||||||
|
else:
|
||||||
|
print(f"DEBUG: Missing season/episode numbers in episodeFile for {webhook.eventType}")
|
||||||
|
|
||||||
# Force targeted mode for single-episode webhooks to prevent full series processing
|
# Force targeted mode for single-episode webhooks to prevent full series processing
|
||||||
processing_mode = config.tv_webhook_processing_mode
|
processing_mode = config.tv_webhook_processing_mode
|
||||||
|
|||||||
Reference in New Issue
Block a user