Exemplo n.º 1
0
    def test_qualities(self):
        items = [('Test.File 1080p.web-dl', '1080p web-dl'),
                 ('Test.File.web-dl.1080p', '1080p web-dl'),
                 ('Test.File.720p.bluray', '720p bluray'),
                 ('Test.File.1080p.bluray', '1080p bluray'),

                 ('Test.File.720p.bluray.r5', '720p bluray rc'),
                 ('Test.File.1080p.bluray.rc', '1080p bluray rc'),

                 # 10bit
                 ('Test.File.480p.10bit', '480p 10bit'),
                 ('Test.File.720p.10bit', '720p 10bit'),
                 ('Test.File.720p.bluray.10bit', '720p bluray 10bit'),
                 ('Test.File.1080p.10bit', '1080p 10bit'),
                 ('Test.File.1080p.bluray.10bit', '1080p bluray 10bit'),

                 ('Test.File.720p.webdl', '720p web-dl'),
                 ('Test.File.1280x720_web dl', '720p web-dl'),
                 ('Test.File.720p.h264.web.dl', '720p web-dl'),
                 ('Test.File.web-dl', 'web-dl'),
                 ('Test.File.720P', '720p'),
                 ('Test.File.1920x1080', '1080p'),
                 ('Test.File.1080i', '1080i'),
                 ('Test File blurayrip', 'bdrip'),
                 ('Test.File.br-rip', 'bdrip'),

                 ('Test.File.dvd.rip', 'dvdrip'),

                 ('Test.File.360p.avi', '360p'),
                 ('Test.File.[360p].mkv', '360p'),
                 ('Test.File.368.avi', '368p')]

        for item in items:
            quality = quals.parse_quality(item[0]).name
            assert quality == item[1], '`%s` quality should be `%s` not `%s`' % (item[0], item[1], quality)
Exemplo n.º 2
0
 def get_quality(self, entry):
     if entry.get('quality', lazy=False):
         log.debug('Quality is already set to %s for %s, skipping quality detection.' %
                   (entry['quality'], entry['title']))
         return
     quality = qualities.UNKNOWN
     for field_name in ['title', 'description']:
         if field_name not in entry:
             continue
         quality = qualities.parse_quality(entry[field_name])
         if quality > qualities.UNKNOWN:
             # if we find a quality in this field, stop searching
             break
     entry['quality'] = quality
     if quality is not qualities.UNKNOWN:
         log.trace('Found quality %s (%s) for %s from field %s' % \
             (entry['quality'], quality, entry['title'], field_name))