Skip to content

Instantly share code, notes, and snippets.

@jhargis
Created May 16, 2015 12:07
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 jhargis/99bee77e7db1286567c9 to your computer and use it in GitHub Desktop.
Save jhargis/99bee77e7db1286567c9 to your computer and use it in GitHub Desktop.
Convert Grooveshark playlist files into .pls files for import into soundiiz.com
#!/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