Created
November 2, 2020 19:10
-
-
Save dblume/249fbc90ce5ef0772b05b5f387f828a4 to your computer and use it in GitHub Desktop.
Make a list of playlists from an iTunes XML file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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