Created
May 16, 2015 12:07
-
-
Save jhargis/99bee77e7db1286567c9 to your computer and use it in GitHub Desktop.
Convert Grooveshark playlist files into .pls files for import into soundiiz.com
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/python | |
# -*- coding: utf-8 -*- | |
#"SongName","ArtistName","AlbumName" | |
"""Convert Grooveshark playlist into .pls file for import into any music | |
service supported by http://soundiiz.com | |
usage: put this file in the same directory as the playlist you want to | |
convert. rename the file to tracks.csv then | |
python ./mk_playist.py > tracks.pls | |
Drop your new tracks.pls file into soundiiz' upload/conversion tool | |
""" | |
import csv | |
track_list = [] | |
with open('tracks.csv') as f: | |
reader = csv.reader(f) | |
for row in reader: | |
track_list.append(row) | |
def create_playlist(track_list): | |
yield '[playlist]\n' | |
num = 0 | |
entry = ( | |
'File%d=%s\n' | |
'Title%d=%s\n' | |
'Length%d=-1\n') | |
for track in track_list: | |
num += 1 | |
song = track[0] | |
artist = track[1] | |
album = track[2 | |
filename = "Reggae\%s\%s\%s - %s.mp3" % (artist, album, artist, song) | |
title = "%s - %s" % (artist, song) | |
yield entry % (num, filename, num, title, num) | |
yield ( | |
'NumberOfEntries=%d\n' | |
'Version=2\n') % num | |
for pls_line in create_playlist(track_list): | |
print pls_line, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment