#!/usr/bin/python ''' SVPlayer m3u playlist import script. (c) 2011 Jan ONDREJ (SAL) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. ''' import sys f = open(sys.argv[1], 'rt') print "CHANNELS = [" name = "Unknown" for line in f.readlines(): line = line.strip() if line.startswith("#EXTINF:"): name = line[8:] if name.startswith("0,"): name = name[2:] continue elif line.startswith("#"): continue # comment elif line.startswith("rtp://"): print ' multicast("%s", "%s"),' % (name, line) else: print ' media("%s", "%s"),' % (name, line) print "]"