Solving mp3 encoding problems

    It is no secret that many people still write tags in all kinds of cp1251 and KOI-8R - after which neither phones nor players (some) understand them and there are many problems with linux players.
    Most of all, it’s unpleasant that when you download new music, you can’t be sure which encoding tags are used and when you add to your player you find unreadable characters instead of the name of the track, artist and album. But it will also creep into in this form.

    You can use EasyTag and other tag editors.
    But most 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 the task a little easier.

    Here is the solution:

    We need the python-mutagen package,
    sudo aptitude install python-mutagen

    create a shell script and add the following to it:
    $ touch
    $ nano


    FILE=`zenity --file-selection --directory --title="Выберите путь к крякозябрам"`
    case $? in
    echo "Выбран \"$FILE\".";;
    echo "Файл не выбран.";;
    echo "Файл не выбран.";;
    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 be given permission to execute the script.
    chmod u+x

    That's all, you can run ( $ sh and specify the folder where you want to fix the encoding.

    You will see a dialog box with a directory selection 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 /usr/bin/mp3

    And now, at any time, we press the treasured alt + F2 and type in mp3
    The start button remake.

    PS This is the first experience in writing a shell script, for myself - to make life a little easier.
    If someone else comes in handy, I'll be glad.
    Surely this code is not perfect.
    I would be grateful for any advice. For example, how to make a window with a directory selection on QT :-)

    Also popular now: