global REC_CHANGING_CANTAINER
#ここから処理のちに移動
-global REC_MOVE_AFTER_RECORD
-global REC_MOVE_AFTER_RECORD_FINAL
-global REC_MOVE_AFTER_RECORD_RECORDING
-global REC_MOVE_AFTER_DECODE
-global REC_MOVE_AFTER_DECODE_FINAL
-global REC_MOVE_AFTER_DECODE_RECORDING
-global REC_MOVE_AFTER_DECODE_DECODE_QUE
-global REC_MOVE_AFTER_DECODE_DECODING
-global REC_MOVE_AFTER_ENCODE
-global REC_MOVE_AFTER_ENCODE_FINAL
-global REC_MOVE_AFTER_ENCODE_RECORDING
-global REC_MOVE_AFTER_ENCODE_DECODE_QUE
-global REC_MOVE_AFTER_ENCODE_DECODING
-global REC_MOVE_AFTER_ENCODE_ENCODE_QUE
-global REC_MOVE_AFTER_ENCODE_ENCODING
+
global REC_MOVE_END
#ここから自動で提起される処理。
REC_AVI_TO_MP4 = "convert_avi_mp4"
REC_MKV_TO_MP4 = "convert_mkv_mp4"
-REC_MOVE_AFTER_RECORD = "move_rec"
-REC_MOVE_AFTER_RECORD_FINAL = "move_rec_final"
-REC_MOVE_AFTER_RECORD_RECORDING ="move_rec_recording"
-REC_MOVE_AFTER_DECODE = "move_dec"
-REC_MOVE_AFTER_DECODE_FINAL = "move_dec_final"
-REC_MOVE_AFTER_DECODE_RECORDING = "move_dec_recording"
-REC_MOVE_AFTER_DECODE_DECODE_QUE ="move_dec_que"
-REC_MOVE_AFTER_DECODE_DECODING = "move_dec_decoding"
-REC_MOVE_AFTER_ENCODE = "move_enc"
-REC_MOVE_AFTER_ENCODE_FINAL = "move_enc_final"
-REC_MOVE_AFTER_ENCODE_RECORDING = "move_enc_recording"
-REC_MOVE_AFTER_ENCODE_DECODE_QUE = "move_enc_decque"
-REC_MOVE_AFTER_ENCODE_DECODING = "move_enc_decoding"
-REC_MOVE_AFTER_ENCODE_ENCODE_QUE = "move_enc_encque"
-REC_MOVE_AFTER_ENCODE_ENCODING = "move_enc_encoding"
REC_MOVE_END = "move_end"
REC_AUTO_SUGGEST_REC = "auto_suggest_rec"
import sys
import time
import shutil
-import traceback
import auto_rec
import auto_process
recdb.delete_old_auto_keyword("1")
tasks = recdb.getnow("2")
inum = recdb.countRecNow_minutes("10")
- #pyprint traceback.format_exc()
recdblist.printutf8(u"rec10処理開始"+ datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
recdblist.printutf8(u"直近録画予約件数:" + str(inum) + u"BS/CS録画中件数:" + str(status.getBSCSRecording()) + u"TE録画中件数:" + str(status.getTERecording()) )
encodenum=0
typetxtfinal=""
if typetxt==recdblist.REC_RESERVE:
typetxtfinal=recdblist.REC_FINAL_RESERVE
- elif typetxt==recdblist.REC_MOVE_AFTER_DECODE:
- typetxtfinal=recdblist.REC_MOVE_AFTER_DECODE_FINAL
- elif typetxt==recdblist.REC_MOVE_AFTER_RECORD:
- typetxtfinal=recdblist.REC_MOVE_AFTER_RECORD_FINAL
- elif typetxt==recdblist.REC_MOVE_AFTER_ENCODE:
- typetxtfinal=recdblist.REC_MOVE_AFTER_ENCODE_FINAL
tnow = datetime.datetime.now()
dtt = bt-tnow
dt = dtt.days * 24 * 60 * 60 + dtt.seconds
if typetxt==recdblist.REC_FINAL_RESERVE:
typetxting=recdblist.REC_TS_RECORDING
typetxtdecque=recdblist.REC_TS_DECODE_QUE
- elif typetxt==recdblist.REC_MOVE_AFTER_DECODE_FINAL:
- typetxting=recdblist.REC_MOVE_AFTER_DECODE_RECORDING
- typetxtdecque=recdblist.REC_MOVE_AFTER_DECODE_DECODE_QUE
- elif typetxt==recdblist.REC_MOVE_AFTER_RECORD_FINAL:
- typetxting=recdblist.REC_MOVE_AFTER_RECORD_RECORDING
- typetxtdecque=""
- elif typetxt==recdblist.REC_MOVE_AFTER_ENCODE_FINAL:
- typetxting=recdblist.REC_MOVE_AFTER_ENCODE_RECORDING
- typetxtdecque=recdblist.REC_MOVE_AFTER_ENCODE_DECODE_QUE
tnow = datetime.datetime.now()
dtt = bt-tnow
dt = dtt.days * 24 * 60 * 60 + dtt.seconds
ttitle=title+"_"+datetime.datetime.now().strftime("%Y%m%d%H%M")
tv2avi.timetv2b25(recpath + "/" + ttitle + ".avi", chtxt, btime, etime, opt)
recdb.del_reckey(typetxting, title, chtxt, btime)
- if typetxtdecque != "":
+ if not re.search("R", opt):
tnow = datetime.datetime.now()
bt = datetime.datetime.strptime(btime, "%Y-%m-%d %H:%M:%S")
et = datetime.datetime.strptime(etime, "%Y-%m-%d %H:%M:%S")
et = et + dt + datetime.timedelta(seconds=600)
btime = bt.strftime("%Y-%m-%d %H:%M:%S")
etime = et.strftime("%Y-%m-%d %H:%M:%S")
- recdb.rec_reckey(typetxtdecque, ttitle, chtxt, btime, etime, opt)
+ recdb.rec_reckey(recdblist.REC_MOVE_END, ttitle, chtxt, btime, etime, opt)
else:
shutil.copy(os.path.join(recpath,title+".ts.b25"), os.path.join(movepath,title+".ts.b25"))
sys.exit()
typetxting=recdblist.REC_TS_DECODING
typetxtmiss=recdblist.REC_MISS_DECODE
typetxtencque=recdblist.REC_ENCODE_QUE
- elif typetxt== recdblist.REC_MOVE_AFTER_DECODE_DECODE_QUE:
- typetxting=recdblist.REC_MOVE_AFTER_DECODE_DECODING
- typetxtmiss=recdblist.REC_MISS_DECODE
- typetxtencque=""
- elif typetxt== recdblist.REC_MOVE_AFTER_ENCODE_DECODE_QUE:
- typetxting=recdblist.REC_MOVE_AFTER_ENCODE_DECODING
- typetxtmiss=recdblist.REC_MISS_DECODE
- typetxtencque=recdblist.REC_MOVE_AFTER_ENCODE_ENCODE_QUE
tnow = datetime.datetime.now()
dtt = bt-tnow
dt = dtt.days * 24 * 60 * 60 + dtt.seconds
bt = datetime.datetime.strptime(btime, "%Y-%m-%d %H:%M:%S")
et = datetime.datetime.strptime(etime, "%Y-%m-%d %H:%M:%S")
dt = et-bt
- if not typetxtencque=="":
+ if not re.search("D", opt):
tnow = datetime.datetime.now()
bt = tnow + datetime.timedelta(seconds=600)
et = bt + dt
btime = bt.strftime("%Y-%m-%d %H:%M:%S")
etime = et.strftime("%Y-%m-%d %H:%M:%S")
- recdb.rec_reckey(typetxtencque, title, chtxt, btime, etime, opt)
+ recdb.rec_reckey(recdblist.REC_MOVE_END, title, chtxt, btime, etime, opt)
else:
if opt.rfind("d")>=0:
shutil.copy(os.path.join(recpath,title+".sa.avi"),os.path.join(movepath,title+".sa.avi"))
if typetxt==recdblist.REC_ENCODE_QUE:
typetxting=recdblist.REC_ENCODE_LOCAL
typetxtfin=recdblist.REC_FIN_LOCAL
- elif typetxt==recdblist.REC_MOVE_AFTER_ENCODE_ENCODE_QUE:
- typetxting=recdblist.REC_ENCODE_LOCAL
- typetxtfin=recdblist.REC_MOVE_END
if dt < 10 * 60:
if status.getEncoding() < int(configreader.getenv("enc_max")):
recdblist.printutf8(opt)
tv2mp4.ts2mp4(pin, pout, opt)
#tv2avi.ts2avi(pin, pout, opt)
recdb.del_reckey(typetxting, title, chtxt, btime)
- if typetxtfin==recdblist.REC_MOVE_END:
+ if re.search("R", opt):
shutil.copy(os.path.join(recpath,title+".mp4"), os.path.join(movepath,title+".mp4"))
+ recdb.rec_reckey(recdblist.REC_MOVE_END, title, chtxt, btime, etime, opt)
recdb.rec_reckey(typetxtfin, title, chtxt, btime, etime, opt)
sys.exit()
else:
status.changeBSCSRecording(1)
else:
status.changeTERecording(1)
- tv2b25ts(pout + ".b25", ch, time)
+ try:
+ tv2b25ts(pout + ".b25", ch, time)
+ except Exception, inst:
+ print "error occures in tv2ts.py tv2ts"
+ print type(inst)
+ print inst
if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
status.changeBSCSRecording(-1)
else:
status.changeBSCSRecording(1)
else:
status.changeTERecording(1)
- doexe = exe + ' ' + ch + ' ' + time + ' \'' + pout + '\''
- recdblist.printutf8(doexe)
- txt=u"####recpt1-log####\n"
- txt = txt + unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
- logo=pout.replace(".ts.b25",".log")
- f=open(logo,'w')
- f.write(txt.encode('utf-8'))
- f.close()
+ try:
+ doexe = exe + ' ' + ch + ' ' + time + ' \'' + pout + '\''
+ recdblist.printutf8(doexe)
+ txt=u"####recpt1-log####\n"
+ txt = txt + unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
+ logo=pout.replace(".ts.b25",".log")
+ f=open(logo,'w')
+ f.write(txt.encode('utf-8'))
+ f.close()
+ except Exception, inst:
+ print "error occures in tv2ts.py tv2b25ts"
+ print type(inst)
+ print inst
if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
status.changeBSCSRecording(-1)
else: