Programmatic iTunes library mods
February 4, 2006 1:05 PM Subscribe
I'm looking for some kind of library for reading and writing from the iTunes database.
I emphasize that because I'm not interested in dealing with the iPod, except in the sense that I want to have a setup similar to that described in this thread.
My issue is similar to this poster's. I will have the vast bulk of my music on an NFS share on my old machine, with some subset on the new hotness of my Macbook Pro. Since I'm reasonably competent at the coding thing, but less competent at the reverse engineering thing, I want to make use of someone else's invention of the wheel.
Broadly speaking, I want to maintain two libraries for iTunes, one of which that includes the files on both my MacBook and my NFS share, and one of which that includes only those on the macbook. Further, I want to be able to synchronize them when I change states from connected to unconnected and vice versa. The last thing I want to do is have some kind of easy (in the sense that mv $folder $newfolder && update_lib_locations $oldfolder $newfolder is easy. I'm not looking for AI, here) way of moving files between underlying stores.
So, to sum up:
Thanks.
I emphasize that because I'm not interested in dealing with the iPod, except in the sense that I want to have a setup similar to that described in this thread.
My issue is similar to this poster's. I will have the vast bulk of my music on an NFS share on my old machine, with some subset on the new hotness of my Macbook Pro. Since I'm reasonably competent at the coding thing, but less competent at the reverse engineering thing, I want to make use of someone else's invention of the wheel.
Broadly speaking, I want to maintain two libraries for iTunes, one of which that includes the files on both my MacBook and my NFS share, and one of which that includes only those on the macbook. Further, I want to be able to synchronize them when I change states from connected to unconnected and vice versa. The last thing I want to do is have some kind of easy (in the sense that mv $folder $newfolder && update_lib_locations $oldfolder $newfolder is easy. I'm not looking for AI, here) way of moving files between underlying stores.
So, to sum up:
- I want to provide the illusion of one single library, that gains and loses songs depending on my connected storage devices.
- I expect to have to write this myself.
- I'm totally new to the Mac
- I want a freakin' pony!
Thanks.
Unfortunately, iTunes is very unfriendly to this sort of networkish thing. Start by poking around at Doug's Applescripts for iTunes to get a sense of what has been done with iTunes via Applescript. You may also want to check out this tutorial on using Perl to control iTunes.
There may be a way to automate swapping variables in the presumptive underlying preferences files; my guess is that these variables are not directly exposed via AppleScript (but could surely be wrong).
Trying to model this from a long-time Mac-user's viewpoint, it seems most attempts to solve similar problems with the iApps have involved discrete copies of the actual data (iPhoto libraries, duplicate folder trees of music tracks).
Best of luck!
posted by mwhybark at 1:47 PM on February 4, 2006
There may be a way to automate swapping variables in the presumptive underlying preferences files; my guess is that these variables are not directly exposed via AppleScript (but could surely be wrong).
Trying to model this from a long-time Mac-user's viewpoint, it seems most attempts to solve similar problems with the iApps have involved discrete copies of the actual data (iPhoto libraries, duplicate folder trees of music tracks).
Best of luck!
posted by mwhybark at 1:47 PM on February 4, 2006
There is a file called "iTunes Music Library.xml" in ~/Music/iTunes. You can use the NSPropertyList classes to read and write from it, no libraries required. iTunes will only re-read the XML file if you zero (reduce to zero bytes in length, not delete) the non-XML iTunes Music Library file, which it would otherwise read from.
That should be enough to get started, though I think what you're trying to do is much harder than you think.
posted by cillit bang at 2:13 PM on February 4, 2006
That should be enough to get started, though I think what you're trying to do is much harder than you think.
posted by cillit bang at 2:13 PM on February 4, 2006
I think that all the points in the previous thread apply here. The only twist you add is "the illusion of one library."
This illusion could be maintained if you had a script that polled periodically for the presence of the remote drive; if present, switch to the big library; if not, switch to the small library.
I agree this is Not Easy.
posted by adamrice at 4:16 PM on February 4, 2006
This illusion could be maintained if you had a script that polled periodically for the presence of the remote drive; if present, switch to the big library; if not, switch to the small library.
I agree this is Not Easy.
posted by adamrice at 4:16 PM on February 4, 2006
Response by poster: "Easy" is less of an issue than "Possible." Call me arrogant if you wish, but I have reason to believe that, provided the reverse engineering part of it was taken care of, I'd be able to pull the rest off.
That being said... Bah.
You'd think that this sort of thing would be a primary use case for the pro machines.
posted by ChrisR at 10:20 PM on February 4, 2006
That being said... Bah.
You'd think that this sort of thing would be a primary use case for the pro machines.
posted by ChrisR at 10:20 PM on February 4, 2006
Alright, I don't think it's possible in any vaguely reliable way. You're welcome to try though.
posted by cillit bang at 4:53 AM on February 5, 2006
posted by cillit bang at 4:53 AM on February 5, 2006
If iTunes can't find a music file when it tries to play it, it will flag it and move on; it doesn't delete it from the library.
You could just keep one main playlist, and alias the NFS share folders into your iTunes Music Library. When you were off-net, the songs wouldn't play, but no further damage would occur.
For example:
~/Music/iTunes Music Folder/iTunes Music/Band I ripped on MacBook -- real folder
~/Music/iTunes Music Folder/iTunes Music/OldBandFromNFS -- alias to NFS share
The only stumbling block would be if you ripped new music off-net and it tried to store it to an aliased folder. Then it would overwrite the alias folder and they'd fall out of sync.
Also, if you want to keep the NFS share as superset, I'd:
1. Keep a Smart Playlist of "songs added [since] [date of last sync]"
2. Use Automator to script copying the songs in that playlist to the NFS share.
But this is all going to get into a total mess when you get drunk and just want to play some songs.
Buy an iPod. It's designed for this sort of syncing.
posted by bonaldi at 7:29 AM on February 5, 2006
You could just keep one main playlist, and alias the NFS share folders into your iTunes Music Library. When you were off-net, the songs wouldn't play, but no further damage would occur.
For example:
~/Music/iTunes Music Folder/iTunes Music/Band I ripped on MacBook -- real folder
~/Music/iTunes Music Folder/iTunes Music/OldBandFromNFS -- alias to NFS share
The only stumbling block would be if you ripped new music off-net and it tried to store it to an aliased folder. Then it would overwrite the alias folder and they'd fall out of sync.
Also, if you want to keep the NFS share as superset, I'd:
1. Keep a Smart Playlist of "songs added [since] [date of last sync]"
2. Use Automator to script copying the songs in that playlist to the NFS share.
But this is all going to get into a total mess when you get drunk and just want to play some songs.
Buy an iPod. It's designed for this sort of syncing.
posted by bonaldi at 7:29 AM on February 5, 2006
This thread is closed to new comments.
posted by ChrisR at 1:06 PM on February 4, 2006