I instead of copying my whole library back over, I set up a simple music cache with Automator and Python.
Working on the premise that I'm most likely to listen to music I've already listened to, the Automator script copies the current track from my external drive to the directory "~/Music/Local Cache/".![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEityPN5Jm9eSg2PX1vGEiBRqlIAvurAxNqZZPlfrRn49Oc1jT7N_I4Cqs6vJtlnYI5oLJFa84fwuO62kzHYFnmFKJaWXazCzMEUQ0RWXrPsI52rUQwHOGGEpv-trWj0WM1Q8FglKaXvVwk/s320/Picture+1.png)
#! /usr/bin/env python
import os
import time
while(1):
os.popen4("automator '~/Music/iTunes Cache/Scripts/iTunesCache.workflow'")
time.sleep(30)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4RBlS_6W4D7-N4QRo5US5IY4yKO8rRGvCFFvhKc8OBcwuxROSNrscTFn2o2k1gLu7bfuS6AcsM23FmNaFoJjON-BGyGU0SvPgLglCQR7b-HGwznwnfE5JOd1DBMBoFtsjd9_iNKypdqA/s320/Picture+4.png)
Working on the premise that I'm most likely to listen to music I've already listened to, the Automator script copies the current track from my external drive to the directory "~/Music/Local Cache/".
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEityPN5Jm9eSg2PX1vGEiBRqlIAvurAxNqZZPlfrRn49Oc1jT7N_I4Cqs6vJtlnYI5oLJFa84fwuO62kzHYFnmFKJaWXazCzMEUQ0RWXrPsI52rUQwHOGGEpv-trWj0WM1Q8FglKaXvVwk/s320/Picture+1.png)
I wrote a Python script to run the Automator script every 30 seconds.
#! /usr/bin/env python
import os
import time
while(1):
os.popen4("automator '~/Music/iTunes Cache/Scripts/iTunesCache.workflow'")
time.sleep(30)
Named it "iTunes Launcher.py" and saved it in "~Music/iTunes Cache/Scripts/" along with "iTunesCache.workflow"
Made it executable, changed the icon, and placed it in the dock:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4RBlS_6W4D7-N4QRo5US5IY4yKO8rRGvCFFvhKc8OBcwuxROSNrscTFn2o2k1gLu7bfuS6AcsM23FmNaFoJjON-BGyGU0SvPgLglCQR7b-HGwznwnfE5JOd1DBMBoFtsjd9_iNKypdqA/s320/Picture+4.png)
Run iTunes from the launcher, and your current songs are cached. The Automator script is set to load each copied song into the playlist "Local Cache." This places the song in my library twice, the local and external versions, so I can go back later and remove references to the external drive using iTunes "Show Duplicates" feature.
No comments:
Post a Comment