Trigger duplicate analysis if pre-queue script sets a new name

This commit is contained in:
Safihre committed 2023-12-07 21:42:43 +01:00
1 parent 7bff7651f3
commit 39d2f90a84
1 file changed
+9 -3
+9 -3
View File
@@ -866,6 +866,7 @@ class NzbObject(TryList):
# also have a valid value of 0, which shouldn't be ignored
if name:
self.set_final_name_and_scan_password(name)
self.duplicate_check(repeat=True)
try:
pp = int(pq_pp)
except:
@@ -1934,11 +1935,16 @@ class NzbObject(TryList):
self.duplicate_key = "/".join(duplicate_key_items).lower()
def duplicate_check(self):
def duplicate_check(self, repeat: bool = False):
"""Set the correct duplicate status"""
if not cfg.no_dupes() and not cfg.no_smart_dupes():
return
# Reset status in case of a repeat analysis
if repeat:
self.duplicate = None
self.duplicate_key = None
duplicate_in_history = smart_duplicate_in_history = False
duplicate_in_queue = smart_duplicate_in_queue = False
@@ -1953,8 +1959,8 @@ class NzbObject(TryList):
duplicate_in_queue = sabnzbd.NzbQueue.have_name_or_md5sum(self.final_name, self.md5sum)
logging.debug("Duplicate in queue: %s", duplicate_in_queue)
# The nzb can already be in the backup while the job is still in the queue!
if not duplicate_in_history and not duplicate_in_queue and cfg.backup_for_duplicates():
# The nzb can already be in the backup while the job is still in the queue, so skip on repeat
if not repeat and not duplicate_in_history and not duplicate_in_queue and cfg.backup_for_duplicates():
duplicate_in_history = backup_exists(self.filename)
logging.debug("Duplicate in backup: %s", duplicate_in_history)