MP3 tags Cyrillic chars
I don't have any Cyrillic characters in my music collection but I can do Greek with no problem using the latest version of eyed3
installed by sudo pip install --upgrade eyed3
:
$ eyeD3 Μπεστ\ οφ/Τζίμης\ Πανούσης\ -\ Κάγκελα\ Παντού.mp3
Τζίμης Πανούσης - Κάγκελα Παντού.mp3 [ 3.43 MB ]
-------------------------------------------------------------------------------
Time: 03:45 MPEG1, Layer III [ 128 kb/s @ 44100 Hz - Joint stereo ]
-------------------------------------------------------------------------------
ID3 v2.4:
title: Tzimis Panousis-Kagkela Pantou.mp3
artist: Tzimis Panousis
album: Unknown
In the example above, I have a directory (album name) called Μπεστ οφ
which contains a song called Κάγκελα Παντού
by Τζίμης Πανούσης
. As you can see in the id3tool
output above, the tags are not in Greek. Let's fix that:
$ eyeD3 -A "Μπεστ οφ" \
-t "Κάγκελα Παντού" \
-a "Τζίμης Πανούσης" \
"./Μπεστ οφ/Τζίμης Πανούσης - Κάγκελα Παντού.mp3"
That correctly set the tags using the Greek alphabet:
$ eyeD3 Μπεστ\ οφ/Τζίμης\ Πανούσης\ -\ Κάγκελα\ Παντού.mp3
Τζίμης Πανούσης - Κάγκελα Παντού.mp3 [ 3.43 MB ]
-------------------------------------------------------------------------------
Time: 03:45 MPEG1, Layer III [ 128 kb/s @ 44100 Hz - Joint stereo ]
-------------------------------------------------------------------------------
ID3 v2.4:
title: Κάγκελα Παντού
artist: Τζίμης Πανούσης
album: Μπεστ οφ
OK, but since the information is encoded in the name of the file, this can be automated. In the example above, the file name has this format:
Album/Artist - Title.mp3
So, we can parse and add the tags for all files with a little shell magic:
find . -type f -name "*mp3" | while read file; do
album="$(basename "$(dirname "$file")")";
filename="$(basename "$file")";
artist=${filename%%-*};
title=${filename##*-};
title=${title%%.mp3};
eyeD3 -A "$album" -t "$title" -a "$artist" "$file";
done
After running this command, all files will have had their id3 tags modified:
I could succesfully update an MP3 file using:
eyeD3 -a "Ю" abc.mp3
This was done with eyeD3 0.7.4-beta as installed using pip
from PyPI:
pip install eyeD3
Using that eyeD3 you could use a script to extract the artist and title from the MP3's file path and set them as ID3v2 2.4 tags with eyeD3.
Alternatively, you can use the mid3iconv
utility from the python-mutagen package:
$ mid3iconv
Usage: mid3iconv [OPTION] [FILE]...
Mutagen-based replacement the id3iconv utility, which converts ID3 tags from
legacy encodings to Unicode and stores them using the ID3v2 format.
Options:
...
-e ENCODING, --encoding=ENCODING
...
--force-v1 Use an ID3v1 tag even if an ID3v2 tag is present
--remove-v1 Remove v1 tag after processing the files
So, basically, running
mid3iconv -eCP1251 --remove-v1
will yield exactly the result you're looking for.