本文整理汇总了Python中song.Song.file_path方法的典型用法代码示例。如果您正苦于以下问题:Python Song.file_path方法的具体用法?Python Song.file_path怎么用?Python Song.file_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类song.Song
的用法示例。
在下文中一共展示了Song.file_path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: decode_song
# 需要导入模块: from song import Song [as 别名]
# 或者: from song.Song import file_path [as 别名]
def decode_song(self, one_song):
title = one_song["title"]
artist = one_song["artist"]
album = one_song["album"]
rating = one_song["rating"]
length = one_song["length"]
bitrate = one_song["bitrate"]
file_path = one_song["file_path"]
created_song = Song(title, artist, album, rating, length, bitrate)
created_song.file_path = file_path
return created_song
示例2: import_songs_from_folder
# 需要导入模块: from song import Song [as 别名]
# 或者: from song.Song import file_path [as 别名]
def import_songs_from_folder(self, track_name, track_path):
#track_name = self.path + track_name
try:
audio = ID3(track_name)
audio2 = MP3(track_name)
artist = (audio['TPE1'].text[0])
title = (audio['TIT2'].text[0])
album = (audio['TALB'].text[0])
length = (audio2.info.length)
bitrate = (audio2.info.bitrate)
the_song = Song(title, artist, album, Song.MIN_RATING, length, bitrate)
the_song.file_path = track_path
return the_song
except (error, ID3NoHeaderError):
audio = MP3(track_name, ID3=EasyID3)
self.generate_tags_from_file_name(track_name)
#audio = EasyID3(track_name)
audio["title"] = self.new_title
audio["artist"] = self.new_artist
audio["album"] = self.new_album
#title, artist, album, rating, length, bitrate
the_song = Song(audio["title"], audio["artist"], audio["album"], Song.MIN_RATING, int(audio.info.length), audio.info.bitrate)
the_song.file_path = track_path
return the_song