#!/usr/bin/python #Credits: Original version: John C. Spray #Modifications: Daelstorm import sys import re if len(sys.argv)<2: print "Insufficient arguments!" print "Usage: ./m3u2html-d mylist.m3u > mypage.html" sys.exit() try: lines=open(sys.argv[1]).readlines() except: print "Unable to open file '%s'!" % sys.argv[1] sys.exit() titlename=sys.argv[1] print "Playlist: %s" % titlename print "" print "

Playlist: %s

" % sys.argv[1] print "
" number = 0 skipaline=0 for i in range(1,len(lines)): line=lines[i] if line[0:7]=="#EXTINF": continue # Ignore this line elif line[0:7]=="#EXTM3U": continue # Ignore this line # Hack for my playlist generator -- denotates a timecheck # also, adds http urls elif line[0:4]=="http" or line[0:2]=="--": number = number +1 print ""% (line, line) # End hack else: try: filename=re.search("/([^/]*)$",line).group()[1:]; # cut "prefix/" off except: continue # Ignore this line number = number +1 print "" % (line, filename) print "
Num
Filename
", number, "
%s
", number, "
%s

Generated by m3u2html-d.py

"