Music Syncing Issues
I can sum up most of my computer-related decisions over the last 3 years or so as all being related to dealing with my hardware as best as possible. This first led me to ditch Windows XP and try out Linux (Ubuntu first). Then I tried fluxbox because GNOME was too heavy. Then I decided that Ubuntu didn’t deal all too well with switching out your desktop environment for a window manager, so I naively tried out this distribution I’ve come to know and love called Gentoo. Now that I’m with Gentoo/fluxbox combo, I’ve managed, over time, to slim down my machine to just what I want, and have a pretty lean box, IMHO. Not the leanest, but I did want a functional and pretty box as well.
Anyway, this all correlates to a recent issue I’ve had with my music accounting system, and how I got around it with some frenzied bash scripting. Because I’ve got a 4GB iPod Nano, I eventually came into the position of having too much music to fit on the device. So I looked at my music and thought about compression. Unfortunately, I couldn’t glean nearly enough space from that. Then I realized that I have way more music than I actually listen to, so why not keep some music for computer listening, and some for mobile? Well that’s a fantastic idea, but implementation gets a bit sticky. I can try some convoluted system in which I keep a file of the unwanted files, update that manually, and… yeah, not too pretty. Although I can’t quite say my solution was much prettier.
My current system involves a ~/music directory, and a ~/music-all directory. My intention is to delete nothing from ~/music-all, ever. ~/music contains music I actually want to listen to, and ~/music-ipod will contain music that I like enough to carry in my 4GB of space. The key is that all the files within these three directories are hard links, so I’m not actually increasing my disk usage very much, and operations on the sets of files are much faster than if I had more than one copy of my files. So assuming I hard link everything in ~/music-all to ~/music, I can then delete things from music at will, without losing it from my drive, but getting rid of it from listening.
With a schema in mind, then there’s the question of how to keep it up to date. There are times when I want to add music to my collection, but then what do I do? I could manually link the new files over, but… well, in retrospect, perhaps that would have been simpler. But I decided I needed a script which would note the differences, relink ~/music-all to ~/music, then remove the files that I noted earlier (which were saved in a text file). The benefit of all my toil was that it now makes my updates lightning fast and not tedious in the least. I had to come up with two scripts, however: one to be run prior to changes to ~/music-all, and one once they’re made. Below are the scripts, which probably won’t be of much use to anyone else, but they can essentially be used to keep two directories in sync, but with certain persistent changes.
Wow, I just spent way too much time figuring out how to post code here, and I’m still not satisfied with the result, so I ditched it. The built-in <code> tag doesn’t seem to take to multiple lines all that well… If anyone knows how to do that, do let me know!




