本文整理汇总了Python中subliminal.videos.Video类的典型用法代码示例。如果您正苦于以下问题:Python Video类的具体用法?Python Video怎么用?Python Video使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Video类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: getSubtitleLanguage
def getSubtitleLanguage(self, group):
detected_languages = {}
# Subliminal scanner
paths = None
try:
paths = group['files']['movie']
scan_result = []
for p in paths:
if not group['is_dvd']:
video = Video.from_path(sp(p))
video_result = [(video, video.scan())]
scan_result.extend(video_result)
for video, detected_subtitles in scan_result:
for s in detected_subtitles:
if s.language and s.path not in paths:
detected_languages[s.path] = [s.language]
except:
log.debug('Failed parsing subtitle languages for %s: %s', (paths, traceback.format_exc()))
# IDX
for extra in group['files']['subtitle_extra']:
try:
if os.path.isfile(extra):
output = open(extra, 'r')
txt = output.read()
output.close()
idx_langs = re.findall('\nid: (\w+)', txt)
sub_file = '%s.sub' % os.path.splitext(extra)[0]
if len(idx_langs) > 0 and os.path.isfile(sub_file):
detected_languages[sub_file] = idx_langs
except:
log.error('Failed parsing subtitle idx for %s: %s', (extra, traceback.format_exc()))
return detected_languages
开发者ID:Affix,项目名称:CouchPotatoServer,代码行数:38,代码来源:scanner.py
示例2: getSubtitleLanguage
def getSubtitleLanguage(self, group):
detected_languages = {}
# Subliminal scanner
try:
paths = group["files"]["movie"]
scan_result = []
for p in paths:
if not group["is_dvd"]:
video = Video.from_path(toUnicode(p))
video_result = [(video, video.scan())]
scan_result.extend(video_result)
for video, detected_subtitles in scan_result:
for s in detected_subtitles:
if s.language and s.path not in paths:
detected_languages[s.path] = [s.language]
except:
log.debug("Failed parsing subtitle languages for %s: %s", (paths, traceback.format_exc()))
# IDX
for extra in group["files"]["subtitle_extra"]:
try:
if os.path.isfile(extra):
output = open(extra, "r")
txt = output.read()
output.close()
idx_langs = re.findall("\nid: (\w+)", txt)
sub_file = "%s.sub" % os.path.splitext(extra)[0]
if len(idx_langs) > 0 and os.path.isfile(sub_file):
detected_languages[sub_file] = idx_langs
except:
log.error("Failed parsing subtitle idx for %s: %s", (extra, traceback.format_exc()))
return detected_languages
开发者ID:hwuethrich,项目名称:CouchPotatoServer,代码行数:37,代码来源:main.py
注:本文中的subliminal.videos.Video类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论