I am trying to create a python code that edits a mp3's info and adds the title, artist, and album. This will make it so that when it's opened in iTunes, I don't have to manually add the info to the song. After I open the mp3 file in iTunes, the duration of the mp3 that iTunes shows has doubled (to 7:07), while the duration of the mp3 file in File Explorer and VLC stays the same (3:39). I am 90% sure that the length doubles after mutagen(the module that edits the file) does its work. But it could also be iTunes problem, I am not sure. Please provide feedback, thank you!
https://discussions.apple.com/thread/250712483 - This thread says that after editing the artwork of a song, track times are extended.
Code right now:
def info_of_mp3(dictionary_of_info, filenamefull):
from mutagen.id3 import ID3, TIT2, TPE2, TALB, TPE1, TYER, TDAT, TRCK, TCON, TORY, TPUB, USLT
dictionary_of_info = { # example info input
"TIT2":"Idli Chutney", #TITLE
"TPE1":"Sean Roldan", #ARTIST
"TALB":"None" #ALBUM
}
filenamefull = "Sean Roldan - Idli Chutney.mp3" #example filename input
SAVE_PATH = "C:/directions/to/my/folder"
audio = ID3(SAVE_PATH+"/"+filenamefull)
audio.add(TIT2(encoding=3, text = dictionary_of_info["TIT2"])) #TITLE
audio.add(TPE1(encoding=3, text = dictionary_of_info["TPE1"])) #ARTIST
audio.add(TALB(encoding=3, text = dictionary_of_info["TALB"])) #ALBUM
audio.save(v2_version=3)
File Explorer length: File Explorer
iTunes length: iTunes
You just have to convert to AAC version on iTunes. This also makes a copy of the song, so you can delete the original.