sonarr-all #32

Merged
sbcrumb merged 2 commits from sonarr-all into dev 2025-10-09 18:13:06 -04:00
2 changed files with 21 additions and 2 deletions
Showing only changes of commit e897656396 - Show all commits
+1 -1
View File
@@ -1 +1 @@
2.0.10 2.0.11
+20 -1
View File
@@ -72,13 +72,32 @@ async def sonarr_webhook(request: Request, background_tasks: BackgroundTasks, de
print(f"ERROR: Could not find series directory: {series_title} ({imdb_id})") print(f"ERROR: Could not find series directory: {series_title} ({imdb_id})")
return {"status": "error", "reason": "Series directory not found"} return {"status": "error", "reason": "Series directory not found"}
# Extract episode data for targeted processing
episodes_data = webhook.episodes or []
# For rename events, if no episodes in webhook.episodes, try to extract from episodeFile
if webhook.eventType == "Rename" and not episodes_data and webhook.episodeFile:
episode_file = webhook.episodeFile
# Extract season and episode from episodeFile if available
season_num = episode_file.get("seasonNumber")
episode_num = episode_file.get("episodeNumber")
if season_num and episode_num:
# Create episode data structure that matches what process_webhook_episodes expects
episodes_data = [{
"seasonNumber": season_num,
"episodeNumber": episode_num,
"id": episode_file.get("id"),
"title": episode_file.get("title")
}]
print(f"INFO: Extracted episode info from episodeFile for rename: S{season_num:02d}E{episode_num:02d}")
# Add to batch queue with TV-prefixed key to avoid movie conflicts # Add to batch queue with TV-prefixed key to avoid movie conflicts
tv_batch_key = f"tv:{imdb_id}" tv_batch_key = f"tv:{imdb_id}"
webhook_dict = { webhook_dict = {
'path': str(series_path), 'path': str(series_path),
'series_info': series_info, 'series_info': series_info,
'event_type': webhook.eventType, 'event_type': webhook.eventType,
'episodes': webhook.episodes or [], # Include episode data for targeted processing 'episodes': episodes_data, # Include enhanced episode data for targeted processing
'processing_mode': config.tv_webhook_processing_mode 'processing_mode': config.tv_webhook_processing_mode
} }
batcher.add_webhook(tv_batch_key, webhook_dict, 'tv') batcher.add_webhook(tv_batch_key, webhook_dict, 'tv')