diff --git a/couchpotato/core/plugins/quality/main.py b/couchpotato/core/plugins/quality/main.py index 5736ddd7..70a7b8bc 100644 --- a/couchpotato/core/plugins/quality/main.py +++ b/couchpotato/core/plugins/quality/main.py @@ -1,7 +1,7 @@ from couchpotato import get_session from couchpotato.api import addApiView from couchpotato.core.event import addEvent -from couchpotato.core.helpers.encoding import toUnicode +from couchpotato.core.helpers.encoding import toUnicode, toSafeString from couchpotato.core.helpers.request import jsonified, getParams from couchpotato.core.helpers.variable import mergeDicts, md5, getExt from couchpotato.core.logger import CPLog @@ -16,7 +16,7 @@ log = CPLog(__name__) class QualityPlugin(Plugin): qualities = [ - {'identifier': 'bd50', 'hd': True, 'size': (15000, 60000), 'label': 'BR-Disk', 'width': 1920, 'alternative': ['bd25'], 'allow': ['1080p'], 'ext':[], 'tags': ['bdmv', 'certificate', ('complete', 'bluray')]}, + {'identifier': 'bd50', 'hd': True, 'size': (15000, 60000), 'label': 'BR-Disk', 'alternative': ['bd25'], 'allow': ['1080p'], 'ext':[], 'tags': ['bdmv', 'certificate', ('complete', 'bluray')]}, {'identifier': '1080p', 'hd': True, 'size': (5000, 20000), 'label': '1080P', 'width': 1920, 'alternative': [], 'allow': [], 'ext':['mkv', 'm2ts']}, {'identifier': '720p', 'hd': True, 'size': (3500, 10000), 'label': '720P', 'width': 1280, 'alternative': [], 'allow': [], 'ext':['mkv', 'm2ts']}, {'identifier': 'brrip', 'hd': True, 'size': (700, 7000), 'label': 'BR-Rip', 'alternative': ['bdrip'], 'allow': ['720p'], 'ext':['avi']}, @@ -138,29 +138,31 @@ class QualityPlugin(Plugin): # Create hash for cache hash = md5(str([f.replace('.' + getExt(f), '') for f in files])) cached = self.getCache(hash) - if cached: return cached + if cached and extra is {}: return cached for cur_file in files: size = (os.path.getsize(cur_file) / 1024 / 1024) if os.path.isfile(cur_file) else 0 words = re.split('\W+', cur_file.lower()) + safe_cur_file = toSafeString(cur_file) for quality in self.all(): # Check tags if quality['identifier'] in words: - log.debug('Found via identifier "%s" in %s' % (quality['identifier'], cur_file)) + log.debug('Found via identifier "%s" in %s' % (quality['identifier'], safe_cur_file)) return self.setCache(hash, quality) if list(set(quality.get('alternative', [])) & set(words)): - log.debug('Found %s via alt %s in %s' % (quality['identifier'], quality.get('alternative'), cur_file)) + log.debug('Found %s via alt %s in %s' % (quality['identifier'], quality.get('alternative'), safe_cur_file)) return self.setCache(hash, quality) for tag in quality.get('tags', []): if isinstance(tag, tuple) and '.'.join(tag) in '.'.join(words): + log.debug('Found %s via tag %s in %s' % (quality['identifier'], quality.get('tags'), safe_cur_file)) return self.setCache(hash, quality) if list(set(quality.get('tags', [])) & set(words)): - log.debug('Found %s via tag %s in %s' % (quality['identifier'], quality.get('tags'), cur_file)) + log.debug('Found %s via tag %s in %s' % (quality['identifier'], quality.get('tags'), safe_cur_file)) return self.setCache(hash, quality) # Check on unreliable stuff