Page 1 of 1

symmusic: build directory structure from audio tags

PostPosted: Sun Oct 23, 2011 7:11 pm
by jmeb
I'm a big fan of Subsonic using pure file lists for browsing my library. It grants a lot of flexibility. On occasion though I wish it was organized by by artist, genre, album, etc. As such, I built symmusic (https://github.com/jmeb/symmusic). Its a little python widget that (flexibly) builds a directory structure from audio tags in a specified directory. The audio files in the new directory structure are then symbolically linked to their originating file. This way you can have a different directory for each organization (by genre, by artist) without having multiple copies of the data itself. I've only tested this on linux (debian). Hypothetically it should work on OS X as well, but I very much doubt compatibility with windows.

This is basically a much-inferior implementation of pytagsfs http://www.pytagsfs.org. Its a really cool project and is much more than symmusic will ever by. That said it was a bit of a resource hog on my ~100gb music collection. Unlike pytagsfs, once the script of symmusic is run no additional resources (beyond a bit of disk space for the directory structure) are used.

As the code of symmusic shows I'm a complete novice to python and programming. If you have suggestions, ideas, requests, etc, please feel free to branch, fork, or what have you.

I'm sure this could be done via java/jaudiotagger and thereby integrated more closely with subsonic -- I just don't have the skills. Hoping someone may find this to be of use.

Re: symmusic: build directory structure from audio tags

PostPosted: Mon Oct 24, 2011 12:22 pm
by BKKKPewsey
Nice :) It a shame I cannot test it.
jmeb wrote: but I very much doubt compatibility with windows.

Just a warning I would not recommend even trying this on Windows Home server as symlinks are a very bad idea on that platform.
Evidently they can break your "tombstones" Whatever they may be :?
:mrgreen:

Re: symmusic: build directory structure from audio tags

PostPosted: Mon Oct 24, 2011 1:22 pm
by jmeb
A very good point. There is really only one line that does the symbolic link-making:
Code: Select all
os.symlink(source,os.path.join(base,name))
. If there is a windows equivalent to this command (make alias etc) it could easily be substituted out. I *think* everything else should be OS-agnostic.

Re: symmusic: build directory structure from audio tags

PostPosted: Tue Nov 01, 2011 4:19 pm
by jmeb
A heads up that symmusic (https://github.com/jmeb/symmusic ) can now reduce the pollution by compilations of your sorted directories by removing directories that only have a small number of songs. This way artists only on compilations don't show up in your directory tree. The number of songs required is your choice. This dramatically cleaned up my own directories.

EDIT: Added option to symbolically link any album art in original directories into new sorts. It assumes album art is stored as .jpg.

It also now:
* checks for posix compliance
* that your destination is not inside your source
* has an option to remove broken symbolic links and empty directories.