Browse Source

[TV] Use "searcher.contains_other_quality" in season searcher, added "480p" quality preset, other small fixes

pull/3761/head
Dean Gardiner 11 years ago
parent
commit
8c51b8548c
  1. 20
      couchpotato/core/media/show/matcher/base.py
  2. 4
      couchpotato/core/media/show/quality/main.py
  3. 3
      couchpotato/core/media/show/searcher/episode.py
  4. 8
      couchpotato/core/media/show/searcher/season.py

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

@ -6,26 +6,6 @@ log = CPLog(__name__)
class Base(MatcherBase):
# TODO come back to this later, think this could be handled better, this is starting to get out of hand....
quality_map = {
'bluray_1080p': {'resolution': ['1080p'], 'source': ['bluray']},
'bluray_720p': {'resolution': ['720p'], 'source': ['bluray']},
'bdrip_1080p': {'resolution': ['1080p'], 'source': ['BDRip']},
'bdrip_720p': {'resolution': ['720p'], 'source': ['BDRip']},
'brrip_1080p': {'resolution': ['1080p'], 'source': ['BRRip']},
'brrip_720p': {'resolution': ['720p'], 'source': ['BRRip']},
'webdl_1080p': {'resolution': ['1080p'], 'source': ['webdl', ['web', 'dl']]},
'webdl_720p': {'resolution': ['720p'], 'source': ['webdl', ['web', 'dl']]},
'webdl_480p': {'resolution': ['480p'], 'source': ['webdl', ['web', 'dl']]},
'hdtv_720p': {'resolution': ['720p'], 'source': ['hdtv']},
'hdtv_sd': {'resolution': ['480p', None], 'source': ['hdtv']},
}
def __init__(self):
super(Base, self).__init__()

4
couchpotato/core/media/show/quality/main.py

@ -49,6 +49,7 @@ class ShowQuality(QualityBase):
# resolutions
{'identifier': '1080p', 'label': '1080p', 'size': (800, 5000), 'codec': ['mp4-avc'], 'container': ['mpeg-ts', 'mkv'], 'resolution': ['1080p']},
{'identifier': '720p', 'label': '720p', 'size': (800, 5000), 'codec': ['mp4-avc'], 'container': ['mpeg-ts', 'mkv'], 'resolution': ['720p']},
{'identifier': '480p', 'label': '480p', 'size': (800, 5000), 'codec': ['mp4-avc'], 'container': ['mpeg-ts', 'mkv'], 'resolution': ['480p']},
# sources
{'identifier': 'cam', 'label': 'Cam', 'size': (800, 5000), 'source': ['cam']},
@ -76,7 +77,6 @@ class ShowQuality(QualityBase):
cache_key = str([f.replace('.' + getExt(f), '') if len(getExt(f)) < 4 else f for f in files])
cached = self.getCache(cache_key)
if cached and len(extra) == 0:
log.debug('returning cache: %s', cached)
return cached
qualities = self.all()
@ -137,7 +137,7 @@ class ShowQuality(QualityBase):
tuple([y.lower() for y in x])
if isinstance(x, list)
else x.lower()
for x in info[key]
for x in info.get(key, [])
]
found = False

3
couchpotato/core/media/show/searcher/episode.py

@ -133,8 +133,7 @@ class EpisodeSearcher(SearcherBase, ShowTypeBase):
log.info2('Too early to search for %s, %s', (too_early_to_search, query))
def correctRelease(self, release = None, media = None, quality = None, **kwargs):
if media.get('type') != 'show.episode':
return
if media.get('type') != 'show.episode': return
retention = Env.setting('retention', section = 'nzb')

8
couchpotato/core/media/show/searcher/season.py

@ -166,6 +166,14 @@ class SeasonSearcher(SearcherBase, ShowTypeBase):
if not fireEvent('searcher.correct_words', release['name'], media, single = True):
return False
preferred_quality = quality if quality else fireEvent('quality.single', identifier = quality['identifier'], single = True)
# Contains lower quality string
contains_other = fireEvent('searcher.contains_other_quality', release, preferred_quality = preferred_quality, types = [self._type], single = True)
if contains_other != False:
log.info2('Wrong: %s, looking for %s, found %s', (release['name'], quality['label'], [x for x in contains_other] if contains_other else 'no quality'))
return False
# TODO Matching is quite costly, maybe we should be caching release matches somehow? (also look at caper optimizations)
match = fireEvent('matcher.match', release, media, quality, single = True)
if match:

Loading…
Cancel
Save