#!/usr/bin/env python
”’
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 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Copyright (C) 2010 Nikiforakis Manos ([email protected])
”’
import re, urllib
HTML = urllib.urlopen(“http://www.e-radio.gr”).readlines()
sstring = re.compile(“(?<=logos\/gr\/promo\/)([A-Za-z0-9-]+)")
k = 1
pls=[]
pls.append("[Playlist]\n")
pls.append("NumberOfEntries=…")
print 'Wait while fetching http://www.e-radio.gr and adding radio stations in playlist…'
for line in HTML:
radios = sstring.findall(line)
#print radios
i = 0
while i+1 0:
# print checkresult[0], stationurl;
pass
else:
#Get the TITLE
title_re=re.compile(‛()(.*?)()’)
title=title_re.findall(a)
print ‛Added %s’ %(title[0][1])
#Get the URI
mms_re=re.compile(”’(“[http|mms].*?”)”’)
mms=mms_re.findall(a)
mms_uri= mms[1].strip(”’””’) # 0 for http, 1 for mms
#print “File%d=%s” %(k,mms_uri)
pls.append(“File%d=%s\n” %(k,mms_uri))
k += 1
i += 1
pls[1]=”NumberOfEntries=%d\n” %(k-1)
playlist_file=open(‛eradio.pls’, ‛w’)
for station in pls:
playlist_file.write(station)
playlist_file.close()