本文整理汇总了Python中guessit.containers.PropertiesContainer.get_properties方法的典型用法代码示例。如果您正苦于以下问题:Python PropertiesContainer.get_properties方法的具体用法?Python PropertiesContainer.get_properties怎么用?Python PropertiesContainer.get_properties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类guessit.containers.PropertiesContainer
的用法示例。
在下文中一共展示了PropertiesContainer.get_properties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GuessProperties
# 需要导入模块: from guessit.containers import PropertiesContainer [as 别名]
# 或者: from guessit.containers.PropertiesContainer import get_properties [as 别名]
#.........这里部分代码省略.........
# http://blog.mediacoderhq.com/h264-profiles-and-levels/
# http://fr.wikipedia.org/wiki/H.264
self.container.register_property('videoProfile', 'BP', validator=LeavesValidator(lambdas=[lambda node: 'videoCodec' in node.guess]))
self.container.register_property('videoProfile', 'XP', 'EP', canonical_form='XP', validator=LeavesValidator(lambdas=[lambda node: 'videoCodec' in node.guess]))
self.container.register_property('videoProfile', 'MP', validator=LeavesValidator(lambdas=[lambda node: 'videoCodec' in node.guess]))
self.container.register_property('videoProfile', 'HP', 'HiP', canonical_form='HP', validator=LeavesValidator(lambdas=[lambda node: 'videoCodec' in node.guess]))
self.container.register_property('videoProfile', '10.?bit', 'Hi10P', canonical_form='10bit', validator=LeavesValidator(lambdas=[lambda node: 'videoCodec' in node.guess]))
self.container.register_property('videoProfile', 'Hi422P', validator=LeavesValidator(lambdas=[lambda node: 'videoCodec' in node.guess]))
self.container.register_property('videoProfile', 'Hi444PP', validator=LeavesValidator(lambdas=[lambda node: 'videoCodec' in node.guess]))
register_quality('videoProfile', {'BP': -20,
'XP': -10,
'MP': 0,
'HP': 10,
'10bit': 15,
'Hi422P': 25,
'Hi444PP': 35
})
# has nothing to do here (or on filenames for that matter), but some
# releases use it and it helps to identify release groups, so we adapt
register_property('videoApi', {'DXVA': ['DXVA']})
register_property('audioCodec', {'MP3': ['MP3'],
'DolbyDigital': ['DD'],
'AAC': ['AAC'],
'AC3': ['AC3'],
'Flac': ['FLAC'],
'DTS': ['DTS'],
'TrueHD': ['True-HD']
})
register_quality('audioCodec', {'MP3': 10,
'DolbyDigital': 30,
'AAC': 35,
'AC3': 40,
'Flac': 45,
'DTS': 60,
'TrueHD': 70
})
self.container.register_property('audioProfile', 'HD', validator=LeavesValidator(lambdas=[lambda node: node.guess.get('audioCodec') == 'DTS']))
self.container.register_property('audioProfile', 'HD-MA', canonical_form='HDMA', validator=LeavesValidator(lambdas=[lambda node: node.guess.get('audioCodec') == 'DTS']))
self.container.register_property('audioProfile', 'HE', validator=LeavesValidator(lambdas=[lambda node: node.guess.get('audioCodec') == 'AAC']))
self.container.register_property('audioProfile', 'LC', validator=LeavesValidator(lambdas=[lambda node: node.guess.get('audioCodec') == 'AAC']))
self.container.register_property('audioProfile', 'HQ', validator=LeavesValidator(lambdas=[lambda node: node.guess.get('audioCodec') == 'AC3']))
register_quality('audioProfile', {'HD': 20,
'HDMA': 50,
'LC': 0,
'HQ': 0,
'HE': 20
})
register_property('audioChannels', {'7.1': ['7[\W_]1', '7ch'],
'5.1': ['5[\W_]1', '5ch'],
'2.0': ['2[\W_]0', '2ch', 'stereo'],
'1.0': ['1[\W_]0', '1ch', 'mono']
})
register_quality('audioChannels', {'7.1': 200,
'5.1': 100,
'2.0': 0,
'1.0': -100
})
self.container.register_property('episodeFormat', r'Minisodes?', canonical_form='Minisode')
register_property('other', {'AudioFix': ['Audio-Fix', 'Audio-Fixed'],
'SyncFix': ['Sync-Fix', 'Sync-Fixed'],
'DualAudio': ['Dual-Audio'],
'WideScreen': ['ws', 'wide-screen'],
})
self.container.register_property('other', 'Real', 'Fix', canonical_form="Proper", validator=WeakValidator())
self.container.register_property('other', 'Proper', 'Repack', 'Rerip', canonical_form="Proper")
self.container.register_canonical_properties('other', 'R5', 'Screener', '3D', 'HD', 'HQ', 'DDC')
self.container.register_canonical_properties('other', 'Limited', 'Complete', 'Classic', 'Unrated', 'LiNE', 'Bonus', 'Trailer', validator=WeakValidator())
for prop in self.container.get_properties('format'):
self.container.register_property('other', prop.pattern + '(-?Scr(?:eener)?)', canonical_form='Screener')
for exts in (subtitle_exts, info_exts, video_exts):
for container in exts:
self.container.register_property('container', container, confidence=0.3)
def guess_properties(self, string, node=None, options=None):
found = self.container.find_properties(string, node)
return self.container.as_guess(found, string)
def supported_properties(self):
return self.container.get_supported_properties()
def process(self, mtree, options=None):
GuessFinder(self.guess_properties, 1.0, self.log, options).process_nodes(mtree.unidentified_leaves())
def rate_quality(self, guess, *props):
return self.qualities.rate_quality(guess, *props)
示例2: GuessProperties
# 需要导入模块: from guessit.containers import PropertiesContainer [as 别名]
# 或者: from guessit.containers.PropertiesContainer import get_properties [as 别名]
#.........这里部分代码省略.........
# has nothing to do here (or on filenames for that matter), but some
# releases use it and it helps to identify release groups, so we adapt
register_property('videoApi', {'DXVA': ['DXVA']})
register_property('audioCodec', {'MP3': ['MP3', 'LAME', 'LAME(?:\d)+-(?:\d)+'],
'DolbyDigital': ['DD'],
'AAC': ['AAC'],
'AC3': ['AC3'],
'Flac': ['FLAC'],
'DTS': (['DTS'], {'validator': LeftValidator()}),
'TrueHD': ['True-HD']
})
register_quality('audioCodec', {'MP3': 10,
'DolbyDigital': 30,
'AAC': 35,
'AC3': 40,
'Flac': 45,
'DTS': 60,
'TrueHD': 70
})
self.container.register_property('audioProfile', 'HD', validator=LeavesValidator(lambdas=[lambda node: node.guess.get('audioCodec') == 'DTS']))
self.container.register_property('audioProfile', 'HD-MA', canonical_form='HDMA', validator=LeavesValidator(lambdas=[lambda node: node.guess.get('audioCodec') == 'DTS']))
self.container.register_property('audioProfile', 'HE', validator=LeavesValidator(lambdas=[lambda node: node.guess.get('audioCodec') == 'AAC']))
self.container.register_property('audioProfile', 'LC', validator=LeavesValidator(lambdas=[lambda node: node.guess.get('audioCodec') == 'AAC']))
self.container.register_property('audioProfile', 'HQ', validator=LeavesValidator(lambdas=[lambda node: node.guess.get('audioCodec') == 'AC3']))
register_quality('audioProfile', {'HD': 20,
'HDMA': 50,
'LC': 0,
'HQ': 0,
'HE': 20
})
register_property('audioChannels', {'7.1': ['7[\W_]1', '7ch', '8ch'],
'5.1': ['5[\W_]1', '5ch', '6ch'],
'2.0': ['2[\W_]0', '2ch', 'stereo'],
'1.0': ['1[\W_]0', '1ch', 'mono']
})
register_quality('audioChannels', {'7.1': 200,
'5.1': 100,
'2.0': 0,
'1.0': -100
})
self.container.register_property('episodeFormat', r'Minisodes?', canonical_form='Minisode')
self.container.register_property('crc32', '(?:[a-fA-F]|[0-9]){8}', enhance=False, canonical_from_pattern=False)
weak_episode_words = ['pt', 'part']
self.container.register_property(None, '(' + build_or_pattern(weak_episode_words) + sep + '?(?P<part>' + numeral + '))[^0-9]', enhance=False, canonical_from_pattern=False, confidence=0.4, formatter=parse_numeral)
register_property('other', {'AudioFix': ['Audio-Fix', 'Audio-Fixed'],
'SyncFix': ['Sync-Fix', 'Sync-Fixed'],
'DualAudio': ['Dual-Audio'],
'WideScreen': ['ws', 'wide-screen'],
'Netflix': ['Netflix', 'NF']
})
self.container.register_property('other', 'Real', 'Fix', canonical_form='Proper', validator=NeighborValidator())
self.container.register_property('other', 'Proper', 'Repack', 'Rerip', canonical_form='Proper')
self.container.register_property('other', 'Fansub', canonical_form='Fansub')
self.container.register_property('other', 'Fastsub', canonical_form='Fastsub')
self.container.register_property('other', '(?:Seasons?' + sep + '?)?Complete', canonical_form='Complete')
self.container.register_property('other', 'R5', 'RC', canonical_form='R5')
self.container.register_property('other', 'Pre-Air', 'Preair', canonical_form='Preair')
self.container.register_canonical_properties('other', 'Screener', 'Remux', '3D', 'HD', 'mHD', 'HDLight', 'HQ',
'DDC',
'HR', 'PAL', 'SECAM', 'NTSC')
self.container.register_canonical_properties('other', 'Limited', 'Complete', 'Classic', 'Unrated', 'LiNE', 'Bonus', 'Trailer', validator=WeakValidator())
for prop in self.container.get_properties('format'):
self.container.register_property('other', prop.pattern + '(-?Scr(?:eener)?)', canonical_form='Screener')
for exts in (subtitle_exts, info_exts, video_exts):
for container in exts:
self.container.register_property('container', container, confidence=0.3)
def guess_properties(self, string, node=None, options=None):
found = self.container.find_properties(string, node, options)
return self.container.as_guess(found, string)
def supported_properties(self):
return self.container.get_supported_properties()
def process(self, mtree, options=None):
GuessFinder(self.guess_properties, 1.0, self.log, options).process_nodes(mtree.unidentified_leaves())
proper_count = 0
for other_leaf in mtree.leaves_containing('other'):
if 'other' in other_leaf.info and 'Proper' in other_leaf.info['other']:
proper_count += 1
if proper_count:
found_property(mtree, 'properCount', proper_count)
def rate_quality(self, guess, *props):
return self.qualities.rate_quality(guess, *props)
示例3: GuessProperties
# 需要导入模块: from guessit.containers import PropertiesContainer [as 别名]
# 或者: from guessit.containers.PropertiesContainer import get_properties [as 别名]
#.........这里部分代码省略.........
self.container.register_property("crc32", "(?:[a-fA-F]|[0-9]){8}", enhance=False, canonical_from_pattern=False)
part_words = ["pt", "part"]
self.container.register_property(
None,
"(" + build_or_pattern(part_words) + sep + "?(?P<part>" + numeral + "))[^0-9]",
enhance=False,
canonical_from_pattern=False,
confidence=0.4,
formatter=parse_numeral,
)
register_property(
"other",
{
"AudioFix": ["Audio-Fix", "Audio-Fixed"],
"SyncFix": ["Sync-Fix", "Sync-Fixed"],
"DualAudio": ["Dual-Audio"],
"WideScreen": ["ws", "wide-screen"],
"Netflix": ["Netflix", "NF"],
},
)
self.container.register_property(
"other",
"Real",
"Fix",
canonical_form="Proper",
validator=ChainedValidator(FullMatchValidator(), NeighborValidator()),
)
self.container.register_property("other", "Proper", "Repack", "Rerip", canonical_form="Proper")
self.container.register_property(
"other",
"Fansub",
canonical_form="Fansub",
validator=ChainedValidator(FullMatchValidator(), NeighborValidator()),
)
self.container.register_property(
"other",
"Fastsub",
canonical_form="Fastsub",
validator=ChainedValidator(FullMatchValidator(), NeighborValidator()),
)
self.container.register_property("other", "(?:Seasons?" + sep + "?)?Complete", canonical_form="Complete")
self.container.register_property("other", "R5", "RC", canonical_form="R5")
self.container.register_property("other", "Pre-Air", "Preair", canonical_form="Preair")
self.container.register_property("other", "CC") # Close Caption
self.container.register_property("other", "LD", "MD") # Line/Mic Dubbed
self.container.register_canonical_properties(
"other", "Screener", "Remux", "3D", "HD", "mHD", "HDLight", "HQ", "DDC", "HR", "PAL", "SECAM", "NTSC"
)
self.container.register_canonical_properties(
"other", "Limited", "Complete", "Classic", "Unrated", "LiNE", "Bonus", "Trailer", validator=WeakValidator()
)
for prop in self.container.get_properties("format"):
self.container.register_property("other", prop.pattern + "(-?Scr(?:eener)?)", canonical_form="Screener")
for exts in (subtitle_exts, info_exts, video_exts):
for container in exts:
self.container.register_property("container", container, confidence=0.3)
def guess_properties(self, string, node=None, options=None):
found = self.container.find_properties(string, node, options)
guess = self.container.as_guess(found, string)
if guess and node:
if "part" in guess:
# If two guesses contains both part in same group, create an partList
for existing_guess in node.group_node().guesses:
if "part" in existing_guess:
if "partList" not in existing_guess:
existing_guess["partList"] = [existing_guess["part"]]
existing_guess["partList"].append(guess["part"])
existing_guess["partList"].sort()
if existing_guess["part"] > guess["part"]:
existing_guess.set_confidence("part", 0)
else:
guess.set_confidence("part", 0)
guess["partList"] = list(existing_guess["partList"])
return guess
def supported_properties(self):
supported_properties = list(self.container.get_supported_properties())
supported_properties.append("partList")
return supported_properties
def process(self, mtree, options=None):
GuessFinder(self.guess_properties, 1.0, self.log, options).process_nodes(mtree.unidentified_leaves())
proper_count = 0
for other_leaf in mtree.leaves_containing("other"):
if "other" in other_leaf.info and "Proper" in other_leaf.info["other"]:
proper_count += 1
if proper_count:
found_property(mtree, "properCount", proper_count)
def rate_quality(self, guess, *props):
return self.qualities.rate_quality(guess, *props)