This commit is contained in:
+19
-2
@@ -107,9 +107,26 @@ async def sonarr_webhook(request: Request, background_tasks: BackgroundTasks, de
|
||||
|
||||
if not episodes_data and webhook.episodeFile:
|
||||
episode_file = webhook.episodeFile
|
||||
# Extract season and episode from episodeFile if available
|
||||
# Extract season and episode from episodeFile path/filename
|
||||
season_num = episode_file.get("seasonNumber")
|
||||
episode_num = episode_file.get("episodeNumber")
|
||||
episode_num = episode_file.get("episodeNumber")
|
||||
|
||||
# If not directly available, parse from relativePath or path
|
||||
if not (season_num and episode_num):
|
||||
from utils.nfo_patterns import extract_episode_info_from_filename
|
||||
|
||||
# Try relativePath first, then path
|
||||
file_path = episode_file.get("relativePath") or episode_file.get("path", "")
|
||||
print(f"DEBUG: Parsing episode info from path: {file_path}")
|
||||
|
||||
episode_info = extract_episode_info_from_filename(file_path)
|
||||
if episode_info:
|
||||
season_num = episode_info["season"]
|
||||
episode_num = episode_info["episode"]
|
||||
print(f"DEBUG: Extracted from filename - Season: {season_num}, Episode: {episode_num}")
|
||||
else:
|
||||
print(f"DEBUG: Could not extract season/episode from filename: {file_path}")
|
||||
|
||||
print(f"DEBUG: episodeFile seasonNumber: {season_num}, episodeNumber: {episode_num}")
|
||||
if season_num and episode_num:
|
||||
# Create episode data structure that matches what process_webhook_episodes expects
|
||||
|
||||
Reference in New Issue
Block a user