Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Make a list of playlists from an iTunes XML file
#!/usr/bin/env python3
import libpytunes # https://github.com/liamks/libpytunes
if __name__ == '__main__':
l = libpytunes.Library('iTunes Music Library.xml')
with open('playlists.txt', 'w', encoding='utf-8') as f:
for p in l.getPlaylistNames():
if p not in ('Downloaded', 'Audiobooks', 'Voice Memos', 'Not One Star Rating'):
f.write(p)
f.write('===\n\n')
for s in l.getPlaylist(p).tracks:
f.write(f'[{s.album}: {s.track_number}] {s.artist} - {s.name}\n')
f.write('\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment