CS2update=0
BSupdate=0
for bctype , chtxt in db.execute("SELECT bctype,chtxt FROM chdata WHERE updatetime < datetime(\'now\',\'localtime\',\'-6 hours\')"):
- #print bctype
- if bctype=="cs":
+ print bctype
+ if bctype=="cs" or bctype==u"cs":
if CSupdate==0:
- ret.append("cs")
+ ret.append(u"cs")
CSupdate=1
print "csの番組表取得開始"
db.execute("UPDATE chdata SET updatetime=datetime(\'now\',\'localtime\') WHERE bctype = \""+bctype+"\"")
- if bctype=="cs2":
+ elif bctype=="cs2" or bctype==u"cs2":
if CS2update==0:
- ret.append("cs2")
- CSupdate=1
- print "csの番組表取得開始"
+ ret.append(u"cs2")
+ CS2update=1
+ print "cs2の番組表取得開始"
db.execute("UPDATE chdata SET updatetime=datetime(\'now\',\'localtime\') WHERE bctype = \""+bctype+"\"")
- elif bctype=="bs":
+ elif bctype=="bs" or bctype==u"bs":
if BSupdate==0:
- ret.append("bs")
+ ret.append(u"bs")
BSupdate=1
print "bsの番組表取得開始"
db.execute("UPDATE chdata SET updatetime=datetime(\'now\',\'localtime\') WHERE bctype = \""+bctype+"\"")
print "チャンネルデータ"
for bctype, ontv, chtxt, ch, csch ,updatetime in db.execute("SELECT bctype,ontv,chtxt,ch,csch,updatetime FROM chdata"):
- print (bctype+","+ontv+","+chtxt+","+ch+","+csch+","+updatetime)
+ print {"txt":bctype+","+ontv+","+chtxt+","+ch+","+csch+","+updatetime,"ch":ch}
db.close()
print "録画予約"
for task in tasks:
ret['btime']=btime
ret['etime']=etime
ret['opt']=opt
+ if deltatime==None or deltatime=="":
+ deltatime="3"
+ if deltaday==None or deltaday=="":
+ deltaday="7"
if typet=='key':
ret['deltatime']=deltatime
elif typet=='keyevery':
tasks=recdb.getnow("1")
if len(tasks)==0:
update=chdb.update()
- print "番組表更新処理"
+ #print "番組表更新処理"
print update
if len(update)>0:
print "番組表を更新"
bctype=chdb.chsearch(ch)['bctype']
print ch+":"+bctype
timet="120"
- if re.search('cs',bctype):
+ if re.search(u'cs',bctype):
mode="/CS"
timet="300"
- elif re.search('bs',bctype):
+ elif re.search(u'bs',bctype):
mode="/BS"
timet="300"
else :
- mode=chdb.bctypesearch('te'+ch)['ontv']
+ mode=chdb.bctypesearch(u'te'+ch)['ontv']
tsepg2xml=configreader.getpath("tsepg2xml")
epgdump=configreader.getpath("epgdump")
time.sleep(5)
+ print type(ch)
+ print ch
tv2ts.tv2tsmix(pout+".ts",ch,"180")
- if not os.access(pout+".ts", os.F_OK):
+ t=0
+ while not os.access(pout+".ts", os.F_OK):
time.sleep(10)
tv2ts.tv2tsmix(pout+".ts",ch,"180")
+ t=t+1
+ if t>10:
+ break
exe="export LANG=ja_JP.UTF-8 && /usr/bin/nice -n 19 wine "+tsepg2xml+" "+mode+" "+pout+".ts >"+pout
#exe="export LANG=ja_JP.UTF-8 && /usr/bin/nice -n 19 "+epgdump+" "+mode+" "+pout+".ts "+pout
print exe