Question

I've been trying to write a program that edits the ID3 tags of all the songs of a given artist, given that the folder structure is "musicFolder\Artist\Year Album\## Song.mp3". It would edit the tags Title, Artist, Album Artist, Album, Year and Track (song number), while keeping the Genre value. I've tried so far in python but none of the ID3 plugins have worked out. I've described the problem I had when using mutagen here: Some mutagen tags don't work .

So, I need a plugin in any language (and tell me the version of both!) that can do the things above, and I would also appreciate an example of how to set the value of said tags, as well as (if necessary) the required measures to make sure that the genre tag is untouched. As I only know python and java, if the provided language is not one of those I would also appreciate it if anyone would like to help me by converting the pseudocode provided below (or something of the same effect) to actual code.

import id3plugin

artist = next_input()
path = "E:\Musik\" + artist

for folder in folder_list(path):                         # folders as strings
    path2 = path + "\" + folder
    year = int(folder.substring(0,4))                    # characters 0,1,2,3 of folder name
    album = folder.substring(5,end))                     # character 4 is space

    for file in file_list(path2):
        if file.substring(end-4,end) == ".mp3": continue # skip to the next item in the list

        path3 = path2 + "\" + file
        tracknumber = int(file.substring(0,2))
        songtitle = file.substring(3, end-4)

        # if all previous tags are cleared when editing, save genre here...

        id3plugin.set_title(path3, title)
        id3plugin.set_artist(path3, artist)
        id3plugin.set_albumartist(path3, artist)
        id3plugin.set_album(path3, album)
        id3plugin.set_year(path3, year)
        id3plugin.set_track(path3, tracknumber)

        # ... and set genre here
Was it helpful?

Solution

I have successfully used Jaudiotagger in my Java players.

Jaudiotagger is the Audio Tagging library used by Jaikoz for tagging data in Audio files. It currently fully supports Mp3, Mp4 (Mp4 audio, M4a and M4p audio) Ogg Vorbis, Flac and Wma, there is limited support for Wav and Real formats.

  • Supports MP3 ID3v1,ID3v11, ID3v2.2, v2.3 and v2.4 are transparently
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top