Portify
Why
So. I gave in and got myself an iPhone and now all my FLAC and Ogg Vorbis files are a) unplayable on the iPod and b) too big to carry around on a portable device.
Enter portify. Point it at the root of your music library and it will create a mirror of the library in your chosen portable format, directory structure and all. Tags are maintained, as is your file naming convention.
Installation
Ubuntu quick install
If you are running Ubuntu the following commands will get you up and running:
sudo aptitude install python-mutagen vorbis-tools lame flac sudo easy_install portify
Then place a copy of example.conf as ~/.portify/portify.conf
.
The following code snippet will run the script:
#!/usr/bin/env python import os from portify import Config, Runner if __name__ == '__main__': configfile = os.path.expanduser("~/.portify/portify.conf") c = Config(configfile) r = Runner(c) r()
A more detailed example can be found in interactivescript.py
More general installation
To run the software you require:
- python2.5 or greater, but not python3 as yet
- python-mutagen
In addition the following Ubuntu packages will be required:
- vorbis-tools (for decoding and encoding Ogg Vorbis files)
- lame (or your preferred mp3 package, for decoding and encoding mp3 files)
- flac (if you have FLAC files)
Configuring mp3 encoding
If you are encoding to mp3 you must ensure that a base subset tags are written to the mp3, even though the converter is going to write them again. This is because mutagen barfs if there is nothing there at all. To this end you'll need to ensure that, at the point of encoding, you have title, artist, album, year, tracknumber and genre as empty strings. See the [mp3] section of example.conf
Development and testing
For the tests you'll need:
- python-nose
- and optionally, python-coverage
To run the tests without coverage simply run the nosetests
command in the root
of your installation, or use the setuptools nose support by running:
python setup.py nosetests
To get a coverage report for just the portify package use the following (again in the root of your installation):
nosetests --with-coverage --cover-package portify
Some of the tests are (by the nature of the application) a bit slow. If you're
really impatient (you'll save about 30 seconds) you can run all but the
conversion tests (the slower ones) by adding the -a '!slow'
switch. e.g.:
nosetests -a '!slow'