Browse Source

Removed old "matcher.correct_quality", changes/fixes to support extended quality format

pull/3761/head
Dean Gardiner 11 years ago
parent
commit
1c6026d0a2
  1. 18
      couchpotato/core/media/_base/matcher/main.py
  2. 20
      couchpotato/core/media/_base/quality/base.py
  3. 10
      couchpotato/core/media/_base/searcher/main.py
  4. 2
      couchpotato/core/media/movie/quality/main.py
  5. 4
      couchpotato/core/media/show/matcher/base.py
  6. 2
      couchpotato/core/plugins/score/scores.py

18
couchpotato/core/media/_base/matcher/main.py

@ -21,7 +21,6 @@ class Matcher(MatcherBase):
addEvent('matcher.construct_from_raw', self.constructFromRaw)
addEvent('matcher.correct_title', self.correctTitle)
addEvent('matcher.correct_quality', self.correctQuality)
def parse(self, name, parser='scene'):
return self.caper.parse(name, parser)
@ -70,20 +69,3 @@ class Matcher(MatcherBase):
return True
return False
def correctQuality(self, chain, quality, quality_map):
if quality['identifier'] not in quality_map:
log.info2('Wrong: unknown preferred quality %s', quality['identifier'])
return False
if 'video' not in chain.info:
log.info2('Wrong: no video tags found')
return False
video_tags = quality_map[quality['identifier']]
if not self.chainMatch(chain, 'video', video_tags):
log.info2('Wrong: %s tags not in chain', video_tags)
return False
return True

20
couchpotato/core/media/_base/quality/base.py

@ -12,10 +12,11 @@ log = CPLog(__name__)
class QualityBase(Plugin):
type = None
properties = {}
qualities = []
pre_releases = ['cam', 'ts', 'tc', 'r5', 'scr']
threed_tags = {
'sbs': [('half', 'sbs'), 'hsbs', ('full', 'sbs'), 'fsbs'],
@ -78,6 +79,23 @@ class QualityBase(Plugin):
return temp
def expand(self, quality):
for key, options in self.properties.items():
if key not in quality:
continue
quality[key] = [self.getProperty(key, identifier) for identifier in quality[key]]
return quality
def getProperty(self, key, identifier):
if key not in self.properties:
return
for item in self.properties[key]:
if item.get('identifier') == identifier:
return item
def resetCache(self):
self.cached_qualities = None

10
couchpotato/core/media/_base/searcher/main.py

@ -90,13 +90,7 @@ class Searcher(SearcherBase):
found = {}
# Try guessing via quality tags
guess = fireEvent(
'quality.guess',
files = [nzb.get('name')],
size = nzb.get('size', None),
types = types,
single = True
)
guess = fireEvent('quality.guess', files = [nzb.get('name')], size = nzb.get('size', None), types = types, single = True)
if guess:
found[guess['identifier']] = True
@ -118,7 +112,7 @@ class Searcher(SearcherBase):
found['dvdrip'] = True
# Allow other qualities
for allowed in preferred_quality.get('allow'):
for allowed in preferred_quality.get('allow', []):
if found.get(allowed):
del found[allowed]

2
couchpotato/core/media/movie/quality/main.py

@ -121,7 +121,7 @@ class MovieQuality(QualityBase):
'alternative': 9,
'tags': 9,
'ext': 3,
}
}
# Check alt and tags
for tag_type in ['identifier', 'alternative', 'tags', 'label']:

4
couchpotato/core/media/show/matcher/base.py

@ -35,10 +35,6 @@ class Base(MatcherBase):
log.info("Checking if '%s' is valid", release['name'])
log.info2('Release parsed as: %s', chain.info)
if not fireEvent('matcher.correct_quality', chain, quality, self.quality_map, single = True):
log.info('Wrong: %s, quality does not match', release['name'])
return False
if not fireEvent('%s.matcher.correct_identifier' % self.type, chain, media):
log.info('Wrong: %s, identifier does not match', release['name'])
return False

2
couchpotato/core/plugins/score/scores.py

@ -98,7 +98,7 @@ def namePositionScore(nzb_name, movie_name):
found_quality = quality['identifier']
# Alt in words
for alt in quality['alternative']:
for alt in quality.get('alternative', []):
if alt in nzb_words:
found_quality = alt
break

Loading…
Cancel
Save