Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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