It script is copy from original audio file to directory of you decide.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import sys
import os
import plistlib
import urlparse
import urllib
verbose = True
fn = sys.argv[1]
dest = sys.argv[2]
d = plistlib.readPlist(fn)
tracks = d['Tracks']
for tkey in d['Tracks'].keys():
aupath = urlparse.urlparse(urllib.unquote(tracks[tkey]['Location'])).path
if verbose:
print(aupath)
# copy audio file
src = file(aupath, 'rb')
destf = file(os.path.join(dest, os.path.basename(aupath)), 'wb')
audio = src.read()
src.close()
destf.write(audio)
destf.close()
|
Tags: itunes