Friday, 9 January 2009


The Problem: I have a 2Gb Creative Stone Plus MP3 player which I listen to a lot. I have close to 20Gb of music on my laptop. Every three or so days I exhaust the songs on my player and I want to replace them with different ones. This takes a while and requires sifting through folders of songs, remembering which ones I've listened to recently.

The Solution: I have written a python program to automatically replace all of the albums on my player with new ones from my library. It first generates two text files listing all the album folders on both the player and in my library. Each entry on the player is cross-checked with the library. If it exists in the library it is automatically delete from the player. If it can't be found in the library, it is left on the player, in case these are new files yet to be copied across. Once old albums have been received, a random number generator is used to pick new albums from the main library. If the selected album was previously on the player, another album is selected. New albums are continually copied across until a copy operation fails - signalling that the player is full.

Shortcomings: The program is highly customised to my machine. This will change - I want to make this into a proper command line program with some more features. Eg. supporting histories longer than 1, and allow user to 'teach' the program which albums it prefers. This is long term. Once the program code is respectable, I'll publish it here. This has been something I've been meaning to do for a long time - I have loads more ideas for features and improvements.


Smiler said...

Sounds like a nice idea. I especially like the promise of it learning your tastes.

Most people would probably use RhythmBox or Amarok though. Amarok could definitely do this, and I'd be surprised it RhythmBox can't.

Chris said...

Yeah, there's support for media players in rhythmbox although the ones i've experienced don't do the album shuffling. Also I wanted to practice my python skills and have something which lets me do exactly what i want, without being restricted. Maybe if I added some more intelligence and spend some time on this I could package it as a plugin for rhythmbox. which would probably be the ultimate solution. Not to mention a brilliant learning experience.