Last active
March 2, 2020 17:14
-
-
Save grimpy/3d9f2554f1e9b083c1dd189d33190347 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 mpd | |
def sorter(song): | |
return (int(song['date']), song['album'], int(song['disc']), int(song['track'])) | |
def main(): | |
client = mpd.MPDClient() | |
client.connect('127.0.0.1', 6600) | |
playlist = client.playlistinfo() | |
playlist.sort(key=sorter) | |
for idx, song in enumerate(playlist): | |
client.moveid(song['id'], idx) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment