diff --git a/CHANGES.md b/CHANGES.md index 1efd7750..4bc7a90f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -26,6 +26,9 @@ * Add force episode recent search to API * Change process episodes with utf8 dir and nzb names, handle failed episodes without a dir, add log output streaming * Change move dateutil-zoneinfo.tar.gz file to data files /cache +* Change handle all Hachoir library parser errors and replace its Unicode enforcement +* Allow episode status "Skipped" to be changed to "Downloaded" +* Allow found "Skipped" episode files to be set "Unknown" quality ### 0.11.5 (2016-02-01 19:40:00 UTC) diff --git a/HACKS.txt b/HACKS.txt index 66ed4087..c92cf8d9 100644 --- a/HACKS.txt +++ b/HACKS.txt @@ -3,6 +3,7 @@ Libs with customisations... /lib/cachecontrol/caches/file_cache.py /lib/dateutil/zoneinfo/__init__.py /lib/hachoir_core/config.py +/lib/hachoir_core/stream/input_helpers.py /lib/pynma/pynma.py /lib/requests/packages/urllib3/connectionpool.py /lib/requests/packages/urllib3/util/ssl_.py diff --git a/lib/hachoir_core/stream/input_helper.py b/lib/hachoir_core/stream/input_helper.py index e7938310..96c7cc74 100644 --- a/lib/hachoir_core/stream/input_helper.py +++ b/lib/hachoir_core/stream/input_helper.py @@ -10,7 +10,7 @@ def FileInputStream(filename, real_filename=None, **args): not able to convert filename to real unicode string (ie. you have to use unicode(name, 'replace') or unicode(name, 'ignore')). """ - assert isinstance(filename, unicode) + # assert isinstance(filename, unicode) if not real_filename: real_filename = filename try: diff --git a/sickbeard/common.py b/sickbeard/common.py index c3b93237..7282ade3 100644 --- a/sickbeard/common.py +++ b/sickbeard/common.py @@ -21,6 +21,7 @@ import operator import platform import re import uuid +import traceback import sickbeard import logger @@ -234,6 +235,7 @@ class Quality: def fileQuality(filename): from sickbeard import encodingKludge as ek + from sickbeard.exceptions import ex if ek.ek(os.path.isfile, filename): from hachoir_parser import createParser @@ -241,10 +243,14 @@ class Quality: from hachoir_core.stream import InputStreamError parser = height = None + msg = u'Hachoir can\'t parse file "%s" content quality because it found error: %s' try: - parser = createParser(filename) + parser = ek.ek(createParser, filename) except InputStreamError as e: - logger.log('Hachoir can\'t parse file content quality because it found error: %s' % e.text, logger.WARNING) + logger.log(msg % (filename, e.text), logger.WARNING) + except Exception as e: + logger.log(msg % (filename, ex(e)), logger.ERROR) + logger.log(traceback.format_exc(), logger.DEBUG) if parser: extract = extractMetadata(parser) diff --git a/sickbeard/tv.py b/sickbeard/tv.py index c60db8e7..ee75fc71 100644 --- a/sickbeard/tv.py +++ b/sickbeard/tv.py @@ -698,7 +698,8 @@ class TVShow(object): new_quality = Quality.fileQuality(file) logger.log(u'Since this file was renamed, file %s was checked and quality "%s" found' % (file, Quality.qualityStrings[new_quality]), logger.DEBUG) - if Quality.UNKNOWN != new_quality: + status, quality = sickbeard.common.Quality.splitCompositeStatus(cur_ep.status) + if Quality.UNKNOWN != new_quality or SKIPPED == status: cur_ep.status = Quality.compositeStatus(DOWNLOADED, new_quality) # check for status/quality changes as long as it's a new file diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 5e3f35b5..217c705f 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -1719,7 +1719,7 @@ class Home(MainHandler): if int( status) in Quality.DOWNLOADED and epObj.status not in Quality.SNATCHED + Quality.SNATCHED_PROPER + Quality.DOWNLOADED + [ - IGNORED] and not ek.ek(os.path.isfile, epObj.location): + IGNORED, SKIPPED] and not ek.ek(os.path.isfile, epObj.location): logger.log( u'Refusing to change status of ' + curEp + " to DOWNLOADED because it's not SNATCHED/DOWNLOADED", logger.ERROR)