It's not a secret that many, still, prescribe tags in every cp1251 and KOI-8R - after which neither phones, nor players (some) understand them and there are many problems with players under linux.
Most of all, it’s unpleasant that when downloading new music, you can’t be sure what encoding the tags come in and by adding to your player you find unreadable characters instead of the track name, artist and album. But it also scrolls on last.fm in this form.
EasyTag and other
tag editors can be used
.But more often, I just need to correct the encoding, and the tags are spelled correctly.
Before that, I always used a simple shell script, but decided to make things a little easier.
Here is the solution:
We need the
python-mutagen package.sudo aptitude install python-mutagen
create shell script
$ touch mp3.sh
$ nano mp3.sh
')
and add the following to it:
#!/bin/sh
FILE=`zenity --file-selection --directory --title=" "`
case $? in
0)
echo " \"$FILE\".";;
1)
echo " .";;
-1)
echo " .";;
esac
cd "$FILE" || exit;
(find -iname '*.mp3' -print0 | xargs -0 mid3iconv -e KOI8-R --remove-v1; find -iname '*.mp3' -print0 | xargs -0 mid3iconv -e CP1251 --remove-v1)|zenity --progress --pulsate --auto-close --text " " --title " "
zenity --info --text=" UTF"
You must give permission to run the script
chmod u+x mp3.sh
That's all, you can run (
$ sh mp3.sh
) and specify the folder where you want to correct the encoding.
You will be presented with a dialog box with a choice of the directory in which you need to put things in order - it remains to select and click "ok"

For convenience, I suggest making a couple more movements:
sudo mv mp3.sh /usr/bin/mp3
And now at any moment, we press the coveted alt + F2 and type
mp3
You can also redo the start button.
PS This is the first experience in writing shell skrpta, for myself - a little easier life.
If someone else comes in handy - I will be glad.
Surely this code is not perfect.
I would appreciate any advice. For example, how to make a window with a choice of a directory on QT :-)