3 # iRec10EPG Rec10 iEPG supporting tool
4 #Copyright 2009 Yukikaze
12 mypath=os.path.dirname(sys.argv[0])
13 def rec10web(webpath,title,station,btime,etime):
14 browserpath="title="+title+"&btime="+btime+"&etime="+etime+"&station="+station
15 browserpath=urllib.quote_plus(browserpath,"=&")
16 browserpath=webpath+"?"+browserpath
19 webbrowser.open(browserpath,new=2)
20 def iepg2rec10webopts(path):
29 for line in codecs.open(path,'r','shift_jis'):
30 if re.search('station:',line):
31 station=line.replace("station:","")
32 station=station.replace(" ","")
33 station=station.replace("\r\n","")
34 elif re.search('year:',line):
35 year=line.replace("year:","")
36 year=year.replace(" ","")
37 year=year.replace("\r\n","")
38 elif re.search('month:',line):
39 month=line.replace("month:","")
40 month=month.replace(" ","")
41 month=month.replace("\r\n","")
42 elif re.search('date:',line):
43 date=line.replace("date:","")
44 date=date.replace(" ","")
45 date=date.replace("\r\n","")
46 elif re.search('start:',line):
47 start=line.replace("start:","")
48 start=start.replace(" ","")
49 start=start.replace("\r\n","")
50 elif re.search('end:',line):
51 end=line.replace("end:","")
52 end=end.replace(" ","")
53 end=end.replace("\r\n","")
54 elif re.search('program-title:',line):
55 title=line.replace("program-title:","")
56 title=title.replace(" ","")
57 title=title.replace("\r\n","")
59 ret['title']=title.encode('UTF-8')
60 ret['btime']=year+"-"+month+"-"+date+" "+start+":00"
61 ret['btime']=ret['btime'].encode('UTF-8')
62 ret['etime']=year+"-"+month+"-"+date+" "+end+":00"
63 ret['etime']=ret['etime'].encode('UTF-8')
64 ret['station']=station.encode('UTF-8')
68 confp=ConfigParser.SafeConfigParser()
69 Conf=os.path.join(mypath, 'setting.ini')
71 rec10path=confp.get('path','rec10web')
74 webopt=iepg2rec10webopts(argvs[1])
77 rec10web(rec10path,webopt['title'],webopt['station'],webopt['btime'],webopt['etime'])