How do you embed album art into an MP3 using Python?

前端 未结 5 539
Happy的楠姐
Happy的楠姐 2020-12-02 08:33

I\'ve been using mutagen for reading and writing MP3 tags, but I want to be able to embed album art directly into the file.

5条回答
  •  忘掉有多难
    2020-12-02 09:09

    I've used the eyeD3 module to do this exact thing.

    def update_id3(mp3_file_name, artwork_file_name, artist, item_title):    
        #edit the ID3 tag to add the title, artist, artwork, date, and genre
        tag = eyeD3.Tag()
        tag.link(mp3_file_name)
        tag.setVersion([2,3,0])
        tag.addImage(0x08, artwork_file_name)
        tag.setArtist(artist)
        tag.setDate(localtime().tm_year)
        tag.setTitle(item_title)
        tag.setGenre("Trance")
        tag.update()
    

提交回复
热议问题