Skip to content

Instantly share code, notes, and snippets.

@toby
Created May 2, 2016 02:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toby/b9c3b2b320807a5d15de7adb9373ff30 to your computer and use it in GitHub Desktop.
Save toby/b9c3b2b320807a5d15de7adb9373ff30 to your computer and use it in GitHub Desktop.
osascript -ss -e 'tell application "iTunes" to {|artists|: artist, |albums|: album, |tracks|: name, |added|: date added} of tracks of library playlist 1' | sed 's/[[:<:]]date[[:>:]]//g' | sed "s/:{/:[/g" | sed "s/}}/]}/g" | sed "s/},/],/g" | sed "s/artists:/\"artists\":/g" | sed "s/albums:/\"albums\":/g" | sed "s/tracks:/\"tracks\":/g" | sed "s/added:/\"added\":/g" | python -c 'from __future__ import print_function; import sys, json; reload(sys); sys.setdefaultencoding("utf-8"); x = json.load(sys.stdin); map(lambda t: print(t[0] + "\t" + t[1] + "\t" + t[2] + "\t" + t[3]), zip(x["artists"], x["albums"], x["tracks"], x["added"]))'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment