本文整理汇总了Python中mutagen.File.tags['date']方法的典型用法代码示例。如果您正苦于以下问题:Python File.tags['date']方法的具体用法?Python File.tags['date']怎么用?Python File.tags['date']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mutagen.File
的用法示例。
在下文中一共展示了File.tags['date']方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write_info2file
# 需要导入模块: from mutagen import File [as 别名]
# 或者: from mutagen.File import tags['date'] [as 别名]
def write_info2file(self, info):
# open file with mutagen
audio = File(info['filename'], easy=True)
if audio is None:
return
# write title+album information into audio files
if audio.tags is None:
audio.add_tags()
# write album+title
if info['album'] is not None:
audio.tags['album'] = info['album']
if info['title'] is not None:
audio.tags['title'] = info['title']
# write genre tag
if self.container.config.genre_tag is not None:
audio.tags['genre'] = self.container.config.genre_tag
else:
audio.tags['genre'] = ''
# write pubDate
if info['pubDate'] is not None:
audio.tags['date'] = info['pubDate']
audio.save()
示例2: write_basic_tags
# 需要导入模块: from mutagen import File [as 别名]
# 或者: from mutagen.File import tags['date'] [as 别名]
def write_basic_tags(self, modify_tags, set_artist_to_album, set_version):
audio = File(self.filename, easy=True)
if audio.tags is None:
audio.add_tags()
if modify_tags:
if self.album is not None:
audio.tags['album'] = self.album
if self.title is not None:
audio.tags['title'] = self.title
if self.genre is not None:
audio.tags['genre'] = self.genre
if self.pubDate is not None:
audio.tags['date'] = self.pubDate
if set_artist_to_album:
audio.tags['artist'] = self.album
if type(audio) is EasyMP3:
audio.save(v2_version=set_version)
else:
# Not actually audio
audio.save()
示例3: on_episode_downloaded
# 需要导入模块: from mutagen import File [as 别名]
# 或者: from mutagen.File import tags['date'] [as 别名]
def on_episode_downloaded(self, episode):
# exit if mutagen is not installed
if not mutagen_installed:
return
# read filename (incl. file path) from gPodder database
filename = episode.local_filename(create=False, check_only=True)
if filename is None:
return
# open file with mutagen
audio = File(filename, easy=True)
if audio is None:
return
# read title+album from gPodder database
album = episode.channel.title
title = episode.title
if (strip_album_from_title and title and album and title.startswith(album)):
title = title[len(album):].lstrip()
# convert pubDate to string
try:
pubDate = datetime.datetime.fromtimestamp(episode.pubDate).strftime('%Y-%m-%d %H:%M')
except:
pubDate = None
# write title+album information into audio files
if audio.tags is None:
audio.add_tags()
# write album+title
if album is not None:
audio.tags['album'] = album
if title is not None:
audio.tags['title'] = title
# write genre tag
if genre_tag is not None:
audio.tags['genre'] = genre_tag
else:
audio.tags['genre'] = ''
# write pubDate
if pubDate is not None:
audio.tags['date'] = pubDate
audio.save()
log(u'tagging.on_episode_downloaded(%s/%s)' % (episode.channel.title, episode.title))
示例4: write_basic_tags
# 需要导入模块: from mutagen import File [as 别名]
# 或者: from mutagen.File import tags['date'] [as 别名]
def write_basic_tags(self):
audio = File(self.filename, easy=True)
if audio.tags is None:
audio.add_tags()
if self.album is not None:
audio.tags['album'] = self.album
if self.title is not None:
audio.tags['title'] = self.title
if self.genre is not None:
audio.tags['genre'] = self.genre
if self.pubDate is not None:
audio.tags['date'] = self.pubDate
audio.save()
示例5: write_basic_tags
# 需要导入模块: from mutagen import File [as 别名]
# 或者: from mutagen.File import tags['date'] [as 别名]
def write_basic_tags(self):
audio = File(self.filename, easy=True)
if audio.tags is None:
audio.add_tags()
if self.album is not None:
audio.tags['album'] = self.album
if self.title is not None:
audio.tags['title'] = self.title
if self.genre is not None:
audio.tags['genre'] = self.genre
if self.pubDate is not None:
audio.tags['date'] = self.pubDate
if self.container.config.set_artist_to_album:
audio.tags['artist'] = self.album
audio.save()