Browse Source

Add warning when many duplicate files were discarded

Linked #531, Closes #986
tags/2.2.0RC2
Safihre 8 years ago
parent
commit
3765e8c350
  1. 15
      po/main/SABnzbd.pot
  2. 9
      sabnzbd/nzbstuff.py

15
po/main/SABnzbd.pot

@ -12,7 +12,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ASCII\n"
"Content-Transfer-Encoding: 7bit\n"
"POT-Creation-Date: 2017-07-27 15:58+W. Europe Daylight Time\n"
"POT-Creation-Date: 2017-08-02 12:48+W. Europe Daylight Time\n"
"Generated-By: pygettext.py 1.5\n"
@ -947,6 +947,11 @@ msgid "[%s] Repaired in %s"
msgstr ""
#: sabnzbd/newsunpack.py # sabnzbd/newsunpack.py
#: sabnzbd/newsunpack.py
msgid "Verifying repair"
msgstr ""
#: sabnzbd/newsunpack.py # sabnzbd/newsunpack.py
#: sabnzbd/notifier.py [Notification]
msgid "Disk full"
msgstr ""
@ -962,10 +967,6 @@ msgstr ""
msgid "Checking"
msgstr ""
#: sabnzbd/newsunpack.py
msgid "Verifying repair"
msgstr ""
#: sabnzbd/newsunpack.py [Error message]
msgid "Python script \"%s\" does not have execute (+x) permission set"
msgstr ""
@ -1123,6 +1124,10 @@ msgstr ""
msgid "Pausing duplicate NZB \"%s\""
msgstr ""
#: sabnzbd/nzbstuff.py [Warning message]
msgid "%d files with duplicate filenames were discared for \"%s\". Enable \"allow_duplicate_files\" to allow duplicate filenames."
msgstr ""
#: sabnzbd/nzbstuff.py
msgid "Aborted, cannot be completed"
msgstr ""

9
sabnzbd/nzbstuff.py

@ -492,6 +492,11 @@ class NzbParser(xml.sax.handler.ContentHandler):
nzo_matches = filter(lambda x: (x.filename == nzf.filename), self.nzo.files)
if nzo_matches:
logging.info('File %s occured twice in NZB, discarding smaller file', nzf.filename)
# Keep some logging how many were duplicates
if 'duplicate_files' not in self.nzo.nzo_info:
self.nzo.nzo_info['duplicate_files'] = 0
self.nzo.nzo_info['duplicate_files'] += 1
# Which is smaller? Current or old one
if nzo_matches[0].bytes >= nzf.bytes:
# Skip this new one
@ -881,6 +886,10 @@ class NzbObject(TryList):
else:
self.files.sort(cmp=nzf_cmp_name)
# Warn if there were many duplicate files
if 'duplicate_files' in self.nzo_info and self.nzo_info['duplicate_files'] >= 10:
logging.warning(T('%d files with duplicate filenames were discared for "%s". Enable "allow_duplicate_files" to allow duplicate filenames.'), self.nzo_info['duplicate_files'], self.final_name)
# In the hunt for Unwanted Extensions:
# The file with the unwanted extension often is in the first or the last rar file
# So put the last rar immediately after the first rar file so that it gets detected early

Loading…
Cancel
Save