本文整理汇总了Python中mutagen.oggvorbis.OggVorbis.pop方法的典型用法代码示例。如果您正苦于以下问题:Python OggVorbis.pop方法的具体用法?Python OggVorbis.pop怎么用?Python OggVorbis.pop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mutagen.oggvorbis.OggVorbis
的用法示例。
在下文中一共展示了OggVorbis.pop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: rm_ogg_cover
# 需要导入模块: from mutagen.oggvorbis import OggVorbis [as 别名]
# 或者: from mutagen.oggvorbis.OggVorbis import pop [as 别名]
def rm_ogg_cover(self, episode):
filename = episode.local_filename(create=False)
if filename is None:
return
basename, extension = os.path.splitext(filename)
if episode.file_type() != 'audio':
return
if extension.lower() != '.ogg':
return
try:
ogg = OggVorbis(filename)
found = False
for key in ogg.keys():
if key.startswith('cover'):
found = True
ogg.pop(key)
if found:
logger.info('Removed cover art from OGG file: %s', filename)
ogg.save()
except Exception, e:
logger.warn('Failed to remove OGG cover: %s', e, exc_info=True)
示例2: rm_ogg_cover
# 需要导入模块: from mutagen.oggvorbis import OggVorbis [as 别名]
# 或者: from mutagen.oggvorbis.OggVorbis import pop [as 别名]
def rm_ogg_cover(episode):
filename = episode.local_filename(create=False, check_only=True)
if filename is None:
return
(basename, extension) = os.path.splitext(filename)
if episode.file_type() == "audio" and extension.lower().endswith("ogg"):
logger.info(u"trying to remove cover from %s" % filename)
found = False
try:
ogg = OggVorbis(filename)
for key in ogg.keys():
if key.startswith("cover"):
found = True
ogg.pop(key)
if found:
logger.info(u"removed cover from the ogg file successfully")
ogg.save()
else:
logger.info(u"there was no cover to remove in the ogg file")
except:
None