Skip to content

Instantly share code, notes, and snippets.

@tlvince
Created September 27, 2010 17:50
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 tlvince/599472 to your computer and use it in GitHub Desktop.
Save tlvince/599472 to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
# lastexport2mpd.py
# Copyright 2010 Tom Vincent <http://www.tlvince.com/contact/>
import os
import sys
import time
file = sys.path[0] + "/exported_tracks.txt"
with open(file) as tracks:
with open(sys.path[0] + "/mpd-formatted-tracks.txt", mode='w', encoding='utf-8') as outFile:
for line in tracks:
timestamp, track, artist, album, trackmbid, artistmbid, albummbid = line.strip("\n").split("\t")
timestamp = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.localtime(int(timestamp)))
outFile.write(timestamp + " " + artist + " - " + track + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment