3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009 Yukikaze
11 path=str(os.path.dirname(os.path.abspath(__file__)))+"/"
15 tnow=datetime.datetime.now()
17 lastup=datetime.datetime.strptime(chdb.chtxtsearch(chtxt)[0]['update'],"%Y-%m-%d %H:%M:%S")
19 lastup=datetime.datetime.strptime("2009-04-01 00:00:00","%Y-%m-%d %H:%M:%S")
21 dt=dt.days*24*60+dt.seconds
23 ts2epg.write(tmppath+"epgdate.xml",chdb.chtxtsearch(chtxt)['ch'])
24 xml2db.xml2db(tmppath+"epgdate.xml",path+"ch.db",chdb.chtxtsearch(chtxt)['bctype'])
26 bctypel=chdb.bctypesearch(bctype)
28 ts2epg.write(tmppath+"epgdate.xml",chdb.bctypesearch(bctype)['ch'])
29 xml2db.xml2db(tmppath+"epgdate.xml",path+"ch.db",bctype)
43 db=sqlite3.connect(dbpath)
46 for ch, title, start, stop in db.execute("SELECT channel,title,start,stop FROM tv WHERE title LIKE \"%"+titletxt+"%\""):
47 btime=start.replace(" +0900","")
48 btime=btime[0:4]+"-"+btime[4:6]+"-"+btime[6:8]+" "+btime[8:10]+":"+btime[10:12]+":00"
49 etime=stop.replace(" +0900","")
50 etime=etime[0:4]+"-"+etime[4:6]+"-"+etime[6:8]+" "+etime[8:10]+":"+etime[10:12]+":00"
52 chtxt=chdb.ontvsearch(ch)['chtxt']
56 ret.append(chtxt+","+title.encode('utf-8')+","+btime+","+etime)
59 def searchtime(titletxt,time,deltatime):#時間以内のものだけを表示 deltatimeはhours
61 db=sqlite3.connect(dbpath)
64 deltatime=int(deltatime)
65 for ch, title, start, stop in db.execute("SELECT channel,title,start,stop FROM tv WHERE title LIKE \"%"+titletxt+"%\""):
66 btime=start.replace(" +0900","")
67 btime=btime[0:4]+"-"+btime[4:6]+"-"+btime[6:8]+" "+btime[8:10]+":"+btime[10:12]+":00"
68 etime=stop.replace(" +0900","")
69 etime=etime[0:4]+"-"+etime[4:6]+"-"+etime[6:8]+" "+etime[8:10]+":"+etime[10:12]+":00"
70 bt=datetime.datetime.strptime(btime,"%Y-%m-%d %H:%M:%S")
71 t=datetime.datetime.strptime(time,"%Y-%m-%d %H:%M:%S")
73 chtxt=chdb.ontvsearch(ch)['chtxt']
78 dt=dt.days*24*60*60+dt.seconds
80 if dt<deltatime*60*60:
81 ret.append(chtxt+","+title.encode('utf-8')+","+btime+","+etime)