Skip to content

Commit c9c3c9f

Browse files
authored
Merge pull request #49 from Rapsssito/patch-1
fix: add missing check DELETE_IF_ONLY_ON_EMULERR for valid record
2 parents ade3245 + 09b3a6b commit c9c3c9f

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

eMulerrStalledChecker/eMulerr_Stalled_Checker.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -491,13 +491,22 @@ def is_movie_monitored(host, api_key, movie_id):
491491
if data.get("downloadClientName") == Config.DOWNLOAD_CLIENT:
492492
valid_record = record
493493
break
494-
494+
# If records exist but none meet the criteria, the download is considered
495+
# present only on eMulerr (not tracked by Sonarr/Radarr).
496+
# We still need to `continue` in both cases to avoid using a None
497+
# valid_record further down, which would crash.
495498
if valid_record is None:
496-
logger.info(
497-
f"Records present for '{download.name}' (hash: {download.hash}), but no one meets the criteria. "
498-
"Download considered present only on eMulerr."
499-
)
500-
emulerr_downloads_to_remove.append(download)
499+
if Config.DELETE_IF_ONLY_ON_EMULERR:
500+
logger.info(
501+
f"Records present for '{download.name}' (hash: {download.hash}), but no one meets the criteria. "
502+
"Download considered present only on eMulerr. Marking for removal."
503+
)
504+
emulerr_downloads_to_remove.append(download)
505+
else:
506+
logger.info(
507+
f"Records present for '{download.name}' (hash: {download.hash}), but no one meets the criteria. "
508+
"DELETE_IF_ONLY_ON_EMULERR is disabled, skipping removal."
509+
)
501510
continue
502511

503512
# If a valid record is present, creates the specific object and retains the record for later checking

0 commit comments

Comments
 (0)