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


Python SeriesParser.name方法代码示例

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


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

示例1: test_exact_name

# 需要导入模块: from flexget.utils.titles import SeriesParser [as 别名]
# 或者: from flexget.utils.titles.SeriesParser import name [as 别名]
    def test_exact_name(self):
        """SeriesParser: test exact/strict name parsing"""

        s = SeriesParser()
        s.name = 'test'
        s.data = 'Test.Foobar.S01E02.720p-FlexGet'
        s.parse()
        assert s.valid, 'normal failed'

        s = SeriesParser()
        s.strict_name = True
        s.name = 'test'
        s.data = 'Test.A.S01E02.720p-FlexGet'
        s.parse()
        assert not s.valid, 'strict A failed'

        s = SeriesParser()
        s.strict_name = True
        s.name = 'Test AB'
        s.data = 'Test.AB.S01E02.720p-FlexGet'
        s.parse()
        assert s.valid, 'strict AB failed'

        s = SeriesParser()
        s.strict_name = True
        s.name = 'Red Tomato'
        s.data = 'Red Tomato (US) S01E02 720p-FlexGet'
        s.parse()
        assert not s.valid, 'Red Tomato (US) should not match Red Tomato in exact mode'
开发者ID:Doppia,项目名称:Flexget,代码行数:31,代码来源:test_seriesparser.py

示例2: test_sound_as_ep

# 需要导入模块: from flexget.utils.titles import SeriesParser [as 别名]
# 或者: from flexget.utils.titles.SeriesParser import name [as 别名]
 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,代码行数:9,代码来源:test_seriesparser.py

示例3: test_group_dashes

# 需要导入模块: from flexget.utils.titles import SeriesParser [as 别名]
# 或者: from flexget.utils.titles.SeriesParser import name [as 别名]
 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,代码行数:10,代码来源:test_seriesparser.py

示例4: test_from_groups

# 需要导入模块: from flexget.utils.titles import SeriesParser [as 别名]
# 或者: from flexget.utils.titles.SeriesParser import name [as 别名]
 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,代码行数:10,代码来源:test_seriesparser.py

示例5: guess_series

# 需要导入模块: from flexget.utils.titles import SeriesParser [as 别名]
# 或者: from flexget.utils.titles.SeriesParser import name [as 别名]
    def guess_series(self, title, allow_seasonless=False, quality=None):
        """Returns a valid series parser if this `title` appears to be a series"""

        parser = SeriesParser(identified_by='auto', allow_seasonless=allow_seasonless)
        # 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)
        if parser.parse_unwanted(clean_title):
            return
        match = parser.parse_date(clean_title)
        if match:
            parser.identified_by = 'date'
        else:
            match = parser.parse_episode(clean_title)
            if match and parser.parse_unwanted(clean_title):
                return
            parser.identified_by = 'ep'
        if not match:
            return
        if 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, quality=quality)
            except ParseWarning as pw:
                log.debug('ParseWarning: %s' % pw.value)
            if parser.valid:
                return parser
开发者ID:Anaerin,项目名称:Flexget,代码行数:47,代码来源:series.py

示例6: test_invalid_data

# 需要导入模块: from flexget.utils.titles import SeriesParser [as 别名]
# 或者: from flexget.utils.titles.SeriesParser import name [as 别名]
 def test_invalid_data(self):
     """SeriesParser: invalid data"""
     s = SeriesParser()
     s.name = 'Something Interesting'
     s.data = 1
开发者ID:Doppia,项目名称:Flexget,代码行数:7,代码来源:test_seriesparser.py

示例7: test_invalid_name

# 需要导入模块: from flexget.utils.titles import SeriesParser [as 别名]
# 或者: from flexget.utils.titles.SeriesParser import name [as 别名]
 def test_invalid_name(self):
     """SeriesParser: invalid name"""
     s = SeriesParser()
     s.name = 1
     s.data = 'Something'
开发者ID:Doppia,项目名称:Flexget,代码行数:7,代码来源:test_seriesparser.py

示例8: test_name_with_number

# 需要导入模块: from flexget.utils.titles import SeriesParser [as 别名]
# 或者: from flexget.utils.titles.SeriesParser import name [as 别名]
 def test_name_with_number(self):
     """SeriesParser: test number in a name"""
     s = SeriesParser()
     s.name = 'Storage 13'
     s.data = 'Storage 13 no ep number'
     assert_raises(ParseWarning, s.parse)
开发者ID:Doppia,项目名称:Flexget,代码行数:8,代码来源:test_seriesparser.py


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