当前位置: 首页>>代码示例>>Python>>正文


Python titles.SeriesParser类代码示例

本文整理汇总了Python中flexget.utils.titles.SeriesParser的典型用法代码示例。如果您正苦于以下问题:Python SeriesParser类的具体用法?Python SeriesParser怎么用?Python SeriesParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SeriesParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_idiotic_numbering_with_zero

 def test_idiotic_numbering_with_zero(self):
     """SeriesParser: idiotic 0101, 0102, 0103, .. numbering"""
     s = SeriesParser(name='test', identified_by='ep')
     s.parse('Test.0706.720p-FlexGet')
     assert s.season == 7, 'season missing'
     assert s.episode == 6, 'episode missing'
     assert s.identifier == 'S07E06', 'identifier broken'
开发者ID:Doppia,项目名称:Flexget,代码行数:7,代码来源:test_seriesparser.py

示例2: test_quality_as_ep

 def test_quality_as_ep(self):
     """SeriesParser: test that qualities are not picked as ep"""
     from flexget.utils import qualities
     for quality in qualities.all_components():
         s = SeriesParser(name='FooBar')
         s.data = 'FooBar %s XviD-FlexGet' % quality.name
         assert_raises(ParseWarning, s.parse)
开发者ID:Doppia,项目名称:Flexget,代码行数:7,代码来源:test_seriesparser.py

示例3: test_sound_as_ep

 def test_sound_as_ep(self):
     """SeriesParser: test that sound infos are not picked as ep"""
     for sound in SeriesParser.sounds:
         s = SeriesParser()
         s.name = 'FooBar'
         s.data = 'FooBar %s XViD-FlexGet' % sound
         assert_raises(ParseWarning, s.parse)
开发者ID:Doppia,项目名称:Flexget,代码行数:7,代码来源:test_seriesparser.py

示例4: test_quality_as_ep

 def test_quality_as_ep(self):
     """SeriesParser: test that qualities are not picked as ep"""
     from flexget.utils import qualities
     for quality in qualities.registry.keys():
         s = SeriesParser(name='FooBar', identified_by='ep')
         s.data = 'FooBar %s XviD-FlexGet' % quality
         assert_raises(ParseWarning, s.parse)
开发者ID:gray,项目名称:Flexget,代码行数:7,代码来源:test_seriesparser.py

示例5: test_idiotic_invalid

 def test_idiotic_invalid(self):
     """SeriesParser: idiotic confused by invalid"""
     s = SeriesParser(name="test", identified_by="ep")
     s.data = "Test.Revealed.WS.PDTV.XviD-aAF.5190458.TPB.torrent"
     assert_raises(ParseWarning, s.parse)
     assert not s.season == 5, "confused, got season"
     assert not s.season == 4, "confused, got season"
     assert not s.episode == 19, "confused, got episode"
     assert not s.episode == 58, "confused, got episode"
开发者ID:williamluke,项目名称:Flexget,代码行数:9,代码来源:test_seriesparser.py

示例6: process_IN_CREATE

    def process_IN_CREATE(self, event):
        print "Creating:", event.pathname

        for sync_dir, series in self.config.sync_dirs.iteritems():
            for series_name in series:
                series = SeriesParser(series_name)
                filename = os.path.basename(event.pathname)
                series.parse(filename)

                if series.valid:
                    print "Match: ", series
开发者ID:jsok,项目名称:series-watcher,代码行数:11,代码来源:watcher.py

示例7: test_alternate_names

 def test_alternate_names(self):
     s = SeriesParser('The Show', alternate_names=['Show', 'Completely Different'])
     s.parse('The Show S01E01')
     assert s.valid
     s.parse('Show S01E01')
     assert s.valid
     s.parse('Completely.Different.S01E01')
     assert s.valid
     s.parse('Not The Show S01E01')
     assert not s.valid
开发者ID:Doppia,项目名称:Flexget,代码行数:10,代码来源:test_seriesparser.py

示例8: test_name_word_boundries

 def test_name_word_boundries(self):
     s = SeriesParser(name='test')
     s.parse('Test.S01E02.720p-FlexGet')
     assert s.valid, 'normal failed'
     # In non-exact mode these should match
     s.parse('Test.crap.S01E02.720p-FlexGet')
     assert s.valid, 'normal failed'
     s.parse('Test_crap.S01E02.720p-FlexGet')
     assert s.valid, 'underscore failed'
     # However if the title ends mid-word, it should not match
     s.parse('Testing.S01E02.720p-FlexGet')
     assert not s.valid, 'word border failed'
开发者ID:Doppia,项目名称:Flexget,代码行数:12,代码来源:test_seriesparser.py

示例9: test_parentheticals

 def test_parentheticals(self):
     s = SeriesParser('The Show (US)')
     # Make sure US is ok outside of parentheses
     s.parse('The.Show.US.S01E01')
     assert s.valid
     # Make sure US is ok inside parentheses
     s.parse('The Show (US) S01E01')
     assert s.valid
     # Make sure it works without US
     s.parse('The.Show.S01E01')
     assert s.valid
     # Make sure it doesn't work with a different country
     s.parse('The Show (UK) S01E01')
     assert not s.valid
开发者ID:Doppia,项目名称:Flexget,代码行数:14,代码来源:test_seriesparser.py

示例10: test_group_dashes

 def test_group_dashes(self):
     """SeriesParser: group name around extra dashes"""
     s = SeriesParser()
     s.name = 'Test'
     s.data = 'Test.S01E01-FooBar-Group'
     s.allow_groups = ['xxxx', 'group']
     s.parse()
     assert s.group == 'group', 'did not get group with extra dashes'
开发者ID:Doppia,项目名称:Flexget,代码行数:8,代码来源:test_seriesparser.py

示例11: test_from_groups

 def test_from_groups(self):
     """SeriesParser: test from groups"""
     s = SeriesParser()
     s.name = 'Test'
     s.data = 'Test.S01E01-Group'
     s.allow_groups = ['xxxx', 'group']
     s.parse()
     assert s.group == 'group', 'did not get group'
开发者ID:Doppia,项目名称:Flexget,代码行数:8,代码来源:test_seriesparser.py

示例12: test_id_regexps

 def test_id_regexps(self):
     s = SeriesParser('The Show', id_regexps=['(dog)?e(cat)?'])
     s.parse('The Show dogecat')
     assert s.valid
     assert s.id == 'dog-cat'
     s.parse('The Show doge')
     assert s.valid
     assert s.id == 'dog'
     s.parse('The Show ecat')
     assert s.valid
     assert s.id == 'cat'
     assert_raises(ParseWarning, s.parse, 'The Show e')
开发者ID:Doppia,项目名称:Flexget,代码行数:12,代码来源:test_seriesparser.py

示例13: test_ep_as_quality

    def test_ep_as_quality(self):
        """SeriesParser: test that eps are not picked as qualities"""
        from flexget.utils import qualities

        s = SeriesParser(name='FooBar')

        for quality1 in qualities.all_components():
            # Attempt to create an episode number out of quality
            mock_ep1 = filter(unicode.isdigit, quality1.name)
            if not mock_ep1:
                continue

            for quality2 in qualities.all_components():
                mock_ep2 = filter(unicode.isdigit, quality2.name)
                if not mock_ep2:
                    continue

                # 720i, 1080i, etc. are failing because
                # e.g the 720 in 720i can always be taken to mean 720p,
                # which is a higher priority quality.
                # Moreover, 1080 as an ep number is always failing because
                # sequence regexps support at most 3 digits at the moment.
                # Luckily, all of these cases are discarded by the following,
                # which also discards the failing cases when episode number
                # (e.g. 720) is greater or equal than quality number (e.g. 480p).
                # There's nothing that can be done with those failing cases with the
                # current
                # "grab leftmost occurrence of highest quality-like thing" algorithm.
                if int(mock_ep1) >= int(mock_ep2):
                    continue

                s.data = 'FooBar - %s %s-FlexGet' % (mock_ep1, quality2.name)
                s.parse()
                assert s.episode == int(mock_ep1), "confused episode %s with quality %s" % \
                                                  (mock_ep1, quality2.name)

                # Also test with reversed relative order of episode and quality
                s.data = '[%s] FooBar - %s [FlexGet]' % (quality2.name, mock_ep1)
                s.parse()
                assert s.episode == int(mock_ep1), "confused episode %s with quality %s" % \
                                                  (mock_ep1, quality2.name)
开发者ID:Doppia,项目名称:Flexget,代码行数:41,代码来源:test_seriesparser.py

示例14: test_ignore_seasonpacks

    def test_ignore_seasonpacks(self):
        """SeriesParser: ignoring season packs"""
        """
        s = SeriesParser(name='The Foo')
        s.data = 'The.Foo.S04.1080p.FlexGet.5.1'
        assert_raises(ParseWarning, s.parse)
        """

        s = SeriesParser(name='Something')
        s.data = 'Something S02 Pack 720p WEB-DL-FlexGet'
        assert_raises(ParseWarning, s.parse)

        s = SeriesParser(name='The Foo')
        s.data = 'The Foo S05 720p BluRay DTS x264-FlexGet'
        assert_raises(ParseWarning, s.parse)

        s = SeriesParser(name='The Foo', identified_by='ep')
        s.data = 'The Foo S05 720p BluRay DTS x264-FlexGet'
        assert_raises(ParseWarning, s.parse)
开发者ID:docpaul,项目名称:Flexget,代码行数:19,代码来源:test_seriesparser.py

示例15: guess_series

    def guess_series(self, title):
        """Returns a valid series parser if this :title: appears to be a series"""

        parser = SeriesParser(identified_by='ep', allow_seasonless=False)
        # We need to replace certain characters with spaces to make sure episode parsing works right
        # We don't remove anything, as the match positions should line up with the original title
        clean_title = re.sub('[_.,\[\]\(\):]', ' ', title)
        match = parser.parse_episode(clean_title)
        if match:
            if parser.parse_unwanted(clean_title):
                return
            elif match['match'].start() > 1:
                # We start using the original title here, so we can properly ignore unwanted prefixes.
                # Look for unwanted prefixes to find out where the series title starts
                start = 0
                prefix = re.match('|'.join(parser.ignore_prefixes), title)
                if prefix:
                    start = prefix.end()
                # If an episode id is found, assume everything before it is series name
                name = title[start:match['match'].start()]
                # Remove possible episode title from series name (anything after a ' - ')
                name = name.split(' - ')[0]
                # Replace some special characters with spaces
                name = re.sub('[\._\(\) ]+', ' ', name).strip(' -')
                # Normalize capitalization to title case
                name = capwords(name)
                # If we didn't get a series name, return
                if not name:
                    return
                parser.name = name
                parser.data = title
                try:
                    parser.parse(data=title)
                except ParseWarning, pw:
                    log.debug('ParseWarning: %s' % pw.value)
                if parser.valid:
                    return parser
开发者ID:achuprin,项目名称:Flexget,代码行数:37,代码来源:series.py


注:本文中的flexget.utils.titles.SeriesParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。