recdb.delete_old("6")
tasks=recdb.getnow("2")
#print tasks
- inum=recdb.countRecNow("1")
+ inum=recdb.countRecNow_minutes("10")
+ #inum=recdb.countRecNow("1")
print "now-rectask"
print "inum:"+str(inum)+"bscsrec:"+str(status.getBSCSRecording())+"terec:"+str(status.getTERecording())+" epg:"+str(status.getEPGUpdating())
- if inum+status.getBSCSRecording()+status.getTERecording() < 2:
- update=chdb.update()
- print "番組表更新処理"
- if len(update)>0:
- pid=os.fork()
- if pid!=0:
- time.sleep(1)
- else:
- for bctype in update:
- i=0
+ #if inum+status.getBSCSRecording()+status.getTERecording() < 2:
+ update=chdb.update()
+ print "番組表更新処理"
+ if len(update)>0:
+ pid=os.fork()
+ if pid!=0:
+ time.sleep(1)
+ else:
+ i=0
+ for bctype in update:
+ recnum=0
+ if bctype.find('te')!=-1:
+ recnum=status.getTERecording()+recdb.countRecNow_minutes_TE("10")
+ print bctype+"//ing:"+str(status.getTERecording())+":task:"+str(recdb.countRecNow_minutes_TE("10"))
+ else:
+ recnum=status.getBSCSRecording()+recdb.countRecNow_minutes_BSCS("10")
+ print bctype+"//ing:"+str(status.getBSCSRecording())+":task:"+str(recdb.countRecNow_minutes_BSCS("10"))
+ if recnum < 2:
print update
rec10d.rec10db.update_status_by_bctype_chdata(bctype,"0")
epgdb.updatebc(bctype)
update=chdb.update()
- rec10d.rec10db.update_by_bctype_chdata(bctype)
- i=i+1
- if i>5:
- break
- sys.exit()
+ #rec10d.rec10db.update_by_bctype_chdata(bctype)
+ i=i+1
+ if i>1:
+ break
+ sys.exit()
"""if len(update)>0 and status.getEPGUpdating()==0:
#status.setEPGUpdating(1)
print "番組表を更新"
dt=dtt.days*24*60*60+dtt.seconds
if task["type"]==recdb.REC_RESERVE:#"res,"+chtxt+","+title+","+btime+","+etime+","+opt
- isUpdate=0
print dt
if (dt<58*60 and dt>20*60):
pid=os.fork()
if pid!=0:#親プロセスの場合
""
else:#子プロセスの場合 アップデートを行って終了
- cht=chdb.chtxtsearch(chtxt)['bctype']
+ bctypet=chdb.chtxtsearch(chtxt)['bctype']
+ chdatat=rec10d.rec10db.select_by_bctype_chdata(bctypet)
+ dt1=datetime.datetime.now()-datetime.datetime.strptime(chdatat[5],"%Y-%m-%d %H:%M:%S")
+ dt1=dt1.days*24*60*60+dt1.seconds
+ if dt1<60*60:
+ recdata=epgdb.searchtime2(title.decode('utf-8'),btime,"5",chtxt)
+ chtxtn=recdata[0]
+ titlen=recdata[1]
+ btimen=recdata[2]
+ etimen=recdata[3]
+ bt=datetime.datetime.strptime(btimen,"%Y-%m-%d %H:%M:%S")
+ et=datetime.datetime.strptime(etimen,"%Y-%m-%d %H:%M:%S")
+ btimen=bt.strftime("%Y-%m-%d %H:%M:%S")
+ etimen=et.strftime("%Y-%m-%d %H:%M:%S")
+ if chtxt!="":
+ try:
+ recdb.del_reckey(recdb.REC_RESERVE, title, chtxt, btime)
+ recdb.rec_reckey(recdb.REC_FINAL_RESERVE, titlen, chtxtn, btimen, etimen, opt)
+ except Exception,inst:
+ print type(inst)
+ print inst
+ else:
+ print "nothing match"
+ else:
+ rec10d.rec10db.update_status_by_bctype_chdata(bctypet,"3")
+ """cht=chdb.chtxtsearch(chtxt)['bctype']
if cht.find('te')!=-1:
cht='te'
else:
print "nothing match"
else:
""
- sys.exit()
+ sys.exit()"""
+
elif dt<=10*60:
try:
recdb.del_reckey(recdb.REC_RESERVE, title, chtxt, btime)
global db,bctype
bctype=bctypetemp
#print path
- createDB()
+ #createDB()
#db.execute('drop table tv')
#db.execute('drop table ch')
p.CharacterDataHandler=char_data
parseDocument(p,xmlpath)
-def createDB():
+#def createDB():
+# global bctype
+# rec10d.rec10db.new_tv(bctype)
+# rec10d.rec10db.new_ch(bctype)
+#def writetvDB(bctype,channel,start,stop,title,desc):#tvdateは(放送種別,チャンネル,start,stop,title,desc)の形式
+# rec10d.rec10db.add_tv(bctype,channel,start,stop,title,desc)
+def writemultitvDB(tvlists):
global bctype
rec10d.rec10db.new_tv(bctype)
- rec10d.rec10db.new_ch(bctype)
-def writetvDB(bctype,channel,start,stop,title,desc):#tvdateは(放送種別,チャンネル,start,stop,title,desc)の形式
- rec10d.rec10db.add_tv(bctype,channel,start,stop,title,desc)
-def writemultitvDB(tvlists):
rec10d.rec10db.add_multi_tv(tvlists)
-def writechDB(bctype,id,display):#tvdateは(チャンネル,display)の形式
- rec10d.rec10db.add_ch(bctype,id,display)
+#def writechDB(bctype,id,display):#tvdateは(チャンネル,display)の形式
+# rec10d.rec10db.add_ch(bctype,id,display)
def writemultichDB(chlists):
+ global bctype
+ rec10d.rec10db.new_ch(bctype)
rec10d.rec10db.add_multi_ch(chlists)
def parseDocument(p,xmlfile):
f=open(xmlfile,'r')
xmldate[lastflag]+=data
else:
xmldate[lastflag]=data
-
-
-
-