#!/usr/bin/env python import sys # Geordie Millar # plsconcat.py - a tool for joining .pls files into one big one streamid = 1 titleid = 1 lengthid = 1 streams = {} title = {} length = {} for file in sys.argv[1:]: f = open(file, 'r') plsfile = f.read() f.close() plsfile = plsfile.split("\n") for line in plsfile: if not line.startswith("[playlist]"): if not line.startswith("NumberOfEntries="): if line.startswith("File"): streams[streamid] = line[6:].replace("\r","") # fscking windows linebreaks streamid += 1 if line.startswith("Title"): title[titleid] = line[7:].replace("\r","") titleid += 1 if line.startswith("Length"): length[lengthid] = line[8:].replace("\r","") lengthid += 1 numofstreams = range(1,streamid) print "[playlist]" print "NumberOfEntries=%i" % (streamid - 1) for thisstream in numofstreams: print "File%i=%s" % (thisstream, streams[thisstream]) print "Title%i=%s" % (thisstream, title[thisstream]) print "Length%i=%s" % (thisstream, length[thisstream])