Browse Source

Remove redundant file_has_articles check

Unknown encodings are caught in the decoder already
pull/1920/head
Safihre 4 years ago
parent
commit
49f4ced8e0
  1. 13
      sabnzbd/assembler.py
  2. 4
      sabnzbd/nzbqueue.py
  3. 7
      sabnzbd/nzbstuff.py

13
sabnzbd/assembler.py

@ -248,19 +248,6 @@ class Assembler(Thread):
nzf.md5sum = nzf.md5.digest()
def file_has_articles(nzf: NzbFile):
"""Do a quick check to see if any articles are present for this file.
Destructive: only to be used to differentiate between unknown encoding and no articles.
"""
has = False
for article in nzf.decodetable:
sleep(0.01)
data = sabnzbd.ArticleCache.load_article(article)
if data:
has = True
return has
RE_SUBS = re.compile(r"\W+sub|subs|subpack|subtitle|subtitles(?![a-z])", re.I)
SAFE_EXTS = (".mkv", ".mp4", ".avi", ".wmv", ".mpg", ".webm")

4
sabnzbd/nzbqueue.py

@ -55,7 +55,6 @@ from sabnzbd.constants import (
import sabnzbd.cfg as cfg
from sabnzbd.downloader import Server
from sabnzbd.assembler import file_has_articles
import sabnzbd.notifier as notifier
@ -755,9 +754,6 @@ class NzbQueue:
elif nzf.filename.lower().endswith(".par2"):
# Broken par2 file, try to get another one
nzo.promote_par2(nzf)
else:
if file_has_articles(nzf):
logging.warning(T("%s -> Unknown encoding"), nzf.filename)
# Save bookkeeping in case of crash
if file_done and (nzo.next_save is None or time.time() > nzo.next_save):

7
sabnzbd/nzbstuff.py

@ -1215,12 +1215,7 @@ class NzbObject(TryList):
@synchronized(NZO_LOCK)
def remove_saved_article(self, article: Article):
try:
self.saved_articles.remove(article)
except ValueError:
# It's not there if the job is fully missing
# and this function is called from file_has_articles
pass
self.saved_articles.remove(article)
def check_existing_files(self, wdir: str):
"""Check if downloaded files already exits, for these set NZF to complete"""

Loading…
Cancel
Save