
By Adam Dachis How to Sync iTunes Across All Your Computers with Dropbox
Why Would I Want to Do This?
What You Should Know Before You Get StartedThis Will Probably Cost You Some Money (But Maybe Not)
Syncing with Dropbox Comes with Two Problems—Which We've Solved
First, everything in your iTunes library must be uploaded to Dropbox and then synced to your other machines. One benefit of selective sync in the latest Dropbox release is that you don't have to sync your entire library to, say, your netbook's tiny hard drive unless you want to. While syncing to your other machines can be quick if you have LAN sync enabled in your Dropbox preferences, uploading everything to your Dropbox can be fairly time consuming. If you have a very large library and a slow upstream connection, this method may not be for you. If you can gather enough patience to make it past the first big upload and your upstream connection is 768kbps or greater, you'll be in good shape.
Syncing Your iTunes Library with DropboxSyncing is the easy part, although it will involve a lot of waiting as Dropbox uploads all your music, videos, and anything else you keep in your iTunes folder. Although you shouldn't have any issues, we recommend making a backup of your iTunes library with an external hard drive so you can easily recover should something go awry. Better safe than sorry! Step One: Move Your iTunes Library
Step Two: Wait
Step Three: Set the New Location of Your iTunes Libraries on All Your Machines
Step Four: Test It OutBecause we have yet to solve the problem of keeping only one copy of iTunes running at the same time, when you perform your tests you need to make sure you manually close iTunes before opening it on another machine. That said, try copying some new songs to iTunes on one computer. When you're done, quit iTunes and open it up on another machine. If those songs are already there—as they should be (if you have LAN sync enabled)—smile, because it worked! Ensuring Only One Copy of iTunes is Open on All Your MachinesThe big challenge posed by this syncing process is keeping iTunes open on only one machine at a time, no matter where you are. The process isn't hard, but it does involve a little work. It also differs between operating systems, so here are instructions for both Windows and Mac OS X. On a Windows PC...Solving this problem is very easy on Windows. All you need is AutoHotkey and a text file. If you'd Step One: Download and Install AutoHotkeyIf you don't have AutoHotkey already installed, you can download it here (you want AutoHotkey_L). Install it and open up the default script in notepad (or whatever text editor you prefer). Step Two: Add and Edit the Following Commands to Your AutoHotkey ScriptCopy and paste the following code into your AutoHotkey script: ; Check the text file to see which computer most recently launched iTunes. ; If it is not the same as the computer running this script, iTunes will quit. #Persistent SetTimer, Alert1, 5000 ; Timer to check every 5 seconds return Alert1: FileRead, FileReadVar, C:\test.txt if (FileReadVar != A_ComputerName) { IfWinExist, ahk_class iTunes Process, Close, iTunes.exe return } return ; Launch iTunes and save a file with the network name of the computer running this script. ; This will let other computers running this script know that they should quit iTunes. ^#t:: Run iTunes.exe FileDelete, C:\test.txt FileAppend, %A_ComputerName%, C:\test.txt return Before you save and reload your script, you need to make a couple of changes. First, you'll notice there's a path to a file called test.txt. Currently it's located on the root of your C:\ drive, but you want this file to be somewhere inside of your Dropbox folder. You can name the file anything you want and put it anywhere in your Dropbox, but just make sure whatever name and location you choose is specified consistently in the AutoHotkey script.
On a Mac...If you're on a Mac, this is really simple with a free utility called Do Something When and a little bit of AppleScript. Step One: Enable Remote Apple Events
You need to do this for all of your machines because every machine will be receiving a remote event every time iTunes opens on any of them. Because this needs to work not only locally but remotely as well, you can't just use local IP addresses. This isn't a big deal if you only have a desktop and a laptop as you can just set your router to forward port 3031—the port used for Remote Apple Events—to your desktop. If you have multiple machines you'll have to get a little creative with your network setup by either remapping ports or using a VPN to avoid the problem altogether. Alternatively, if you don't want to go through that trouble, you can instead write an extra AppleScript on one desktop machine and use an Apple Remote Event to run that instead. That extra AppleScript can use the methods described in the next section to quit any running copies of iTunes. Step Two: Use AppleScript to Quit Copies of iTunesTo quit iTunes remote, you don't need more than a few lines of AppleScript. Open up AppleScript and enter the following, replacing YOUR-IP with the IP address of the machine you want to target: tell application "iTunes" of machine "eppc://YOUR-IP"
Once your script is quitting an open copies of iTunes on other computers, save it as an AppleScript application. Note: you'll need to repeat this process for every machine, creating a unique AppleScript and save it as an AppleScript application. This is because each computer needs to tell all the other computers to quit iTunes but leave its own running. If you copy that script to one of the other computers, it will leave iTunes running on the computer the script came from rather than leaving its own copy running. While the concept is pretty simple, it can be difficult to articulate, so if you're confused don't worry. If you don't understand why this is necessary but follow the instructions anyway, you should be just fine. Step Three: Download and Configure Do Something When
The first option is Rule Name and that's the first thing you need to fill out. You can set it to whatever you want, but I've named mine "Quit Inactive iTunes." In the "When" drop down, select the Choose an Application... option and select iTunes. Right beside this selection will be a few options. You can choose to do something when iTunes launches or quits. You want to choose Launches. The next line is the What line. From the first drop-down, choose Open. From the second drop-down, choose Select an Application or Document. This will provide you with a file browsing window and you'll want to navigate to the AppleScript application you created in the previous step. Select the one for the computer you're currently configuring and choose Open. Lastly, click the Save button to save your rule. At this point you're all done with this machine, although if Do Something When isn't already running you'll want to tell it to run by pressing the button at the top of the window. Now you'll need to repeat this process for each computer syncing your iTunes music and you'll be done! And that's that! We've played at iTunes syncing in the past, but this is by far the best method we've come up with, and the perks—like syncing your iDevice with any of your computers like they're the same machine—are pretty nice. We're open to improvements and suggestions, though, so if you've got any, let's hear it in the comments. You can contact Adam Dachis, the author of this post, at adachis@lifehacker.com. You can also follow him on Twitter and Facebook. | December 20th, 2010 Top Stories |
No comments:
Post a Comment