Skip to content
Pablo Casas Estévez edited this page Jan 20, 2021 · 15 revisions

Welcome to the quodlibet-filesorter wiki!

This script will reorder your music library according to songs metadata.
It will get a expression stored in a custom tag called filegroupping and it will construct the place where the file should get placed.
It also will move folders or another files that remains alongside the song file, so covers.jpg or videos or info.txt files will be also moved.

Behaviour

The script only process songs where the filegroupping tag is defined.
You can add this tag to your collection using Quodlibet software. Remember the tag is a custom tag called filegroupping and you need to create it using Quodlibet.

This is an example:
Tagging in a song with Quodlibet

Assigning a new path:

Assign the new path by constructing a string with:

~ means current mount point of the song at the library
/ use a slash to construct your path.
.<ext> use dot plus <ext> at the end if you want to construct a new file-name for the song and not only the path.
<Tag> use a tag name enclosed in <....> for tag reference.
[<Tag> some text] use some expression enclosed in [...] to make the expression optional. The enclosed expressión will turned into an empty string if there is no <Tag> present in the file, or being present, it is empty.

Some Examples

~/Albums/<artist>/[<album>/][<cd> - ][<track> - ][<artist> - ]<title>.<ext>
~/Albums/<artist>/[<labelid> - ][<album>/][CD<discnumber> -][<tracknumber> - ]<title>.<ext>
~/<genre>/<album>/
~/Various/<genre>/[<artist> - ]<title>.<ext>
~/Compilations/[<labelid> - ][<album>/][CD -][<tracknumber> - ][<artist> - ]<title>.<ext>

More on tag reference at this wiki page: https://github.com/pablo33/quodlibet-filesorter/wiki/Tag-reference-list

How to run this script

Just save the code on your filesystem (this two files):
quodlibet_filesorter.py
readtag.py

Run the script from the terminal:
python3 quodlibet_filesorter.py

The script creates a sq-lite3 database and a log file. You can have a look at them.
If you want to play and do some test before proceed, you can turn the dummy mode. Run the scrip with --dummy option:

python3 quodlibet_filesorter.py --dummy

Making a launcher in ubuntu

You can make a launcher, just follow the instructions of the readme.txt at icons folder.

Playlist support

The script will change the affected entries on the playlists.