本文整理汇总了Python中mutagen.File.update_to_v23方法的典型用法代码示例。如果您正苦于以下问题:Python File.update_to_v23方法的具体用法?Python File.update_to_v23怎么用?Python File.update_to_v23使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mutagen.File
的用法示例。
在下文中一共展示了File.update_to_v23方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: postProcessSong
# 需要导入模块: from mutagen import File [as 别名]
# 或者: from mutagen.File import update_to_v23 [as 别名]
def postProcessSong(self, song):
if self.shouldGenerateTags:
try:
name = self.getSongPath(song)
localList = song.name.split("- ") #The song should be split as "artist - title". If not, it won't be recognized
artist = localList[0] if len(localList) > 1 else self.defaultArtist #The artist is usually first if its there. Otherwise no artist
if self.allSongsDefaultArtist: artist = self.defaultArtist
title = localList[1] if len(localList) > 1 else localList[0] #If there is no artist, the whole name is the title
artist = artist.lstrip().rstrip()
title = title.lstrip().rstrip()
#Appreciate this. It took upwards of 5 hours to get the damn software to do this.
try:
songID = EasyID3(name)
except ID3NoHeaderError:
songID = MutagenFile(name, easy = True)
songID.add_tags()
songID['artist'] = artist
songID['title'] = title
songID.save()
songID = ID3(name, v2_version=3) #EasyID3 doesn't support saving as 2.3 to get Windows to recognize it
songID.update_to_v23()
songID.save(v2_version=3)
except FileNotFoundError:
debug("File not found for: ", name)