Skip to content

Instantly share code, notes, and snippets.

@idan
Created November 16, 2010 22:45
Show Gist options
  • Save idan/702669 to your computer and use it in GitHub Desktop.
Save idan/702669 to your computer and use it in GitHub Desktop.
from appscript import *
import csv
reader = csv.reader(open('songlist.csv', 'rb'))
itunes = app('iTunes')
playlist = itunes.user_playlists['A Playlist']
for row in reader:
name, artist, album = row
print ("Copying %s by %s [%s}" % (name, artist, album))
try:
track = itunes.library_playlists[1].tracks[((its.artist == artist).AND(its.album == album)).AND(its.name == name)].items[1].get()
itunes.duplicate(track, to=playlist)
except:
print ("*** Skipped %s by %s [%s}" % (name, artist, album))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment