本文整理汇总了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'
示例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)
示例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'
示例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'
示例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
示例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
示例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'
示例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)