3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009-2010 Yukikaze
15 def Update_to_MP4(path):
19 avilist = glob.glob(path + "/*.avi")
20 mkvlist = glob.glob(path+"/*.mkv")
21 avilist=avilist+mkvlist
22 #recdblist.printutf8(avilist)
24 if avif.rfind("sa.avi")==-1:
25 ##b25f is title.ts.b25 avi is title.avi
26 dir = os.path.split(avif)[0]
27 title = os.path.split(avif)[1]
28 title = title.replace(".avi", "")
29 title = title.replace(".mkv", "")
30 avipath = os.path.join(dir, title + ".avi")
31 mkvpath = os.path.join(dir, title + ".mkv")
32 mp4path = os.path.join(dir, title + ".mp4")
33 if not os.path.exists(mp4path):
34 if os.path.exists(avipath):
35 avidtime = int(time.time()-os.path.getmtime(avipath))
37 if os.path.exists(mkvpath):
38 mkvdtime = int(time.time()-os.path.getmtime(mkvpath))
40 recdblist.printutf8(mkvpath+":"+mp4path)
41 tv2mp4.mkv2mp4(mkvpath,mp4path)
43 recdblist.printutf8(avipath+":"+mp4path)
44 tv2mp4.avi2mp4(avipath,mp4path)
46 recdblist.printutf8(avipath+":"+mp4path)
47 tv2mp4.avi2mp4(avipath,mp4path)
49 if not os.path.exists(avipath):
50 if os.path.exists(mkvpath):
51 mkvdtime = int(time.time()-os.path.getmtime(mkvpath))
53 recdblist.printutf8(mkvpath+":"+mp4path)
54 tv2mp4.mkv2mp4(mkvpath,mp4path)
56 avilist = glob.glob(path + "/*.avi")
57 mkvlist = glob.glob(path+"/*.mkv")
58 mp4list = glob.glob(path+"/*.mp4")
59 tslist = glob.glob(path+"/*.ts")
60 b25list = glob.glob(path+"/*.ts.b25")
61 filelist=avilist+mkvlist+tslist+b25list+mp4list
63 tbtime=datetime.datetime.now()+datetime.timedelta(seconds=60)
64 tbtime2=datetime.datetime.now()+datetime.timedelta(seconds=1200)
66 if fn.rfind("sa.avi")==-1 and fn.rfind(".120.avi")==-1 and os.path.getsize(fn)>1*1000*1000:
67 dir = os.path.split(fn)[0]
68 file = os.path.split(fn)[1]
69 title = os.path.splitext(file)[0]
70 title = unicode(title,'utf-8')
73 ext = os.path.splitext(file)[1]
75 title=title.replace(".ts","")
76 dbs=rec10d.rec10db.select_by_name_time_timeline(title,tbtime,tbtime2)
78 proc=check_process(dir, title)
79 chtxtt=rec10d.rec10db.select_chtxt_by_title_timeline_log(title)
84 """chtxtt=rec10d.rec10db.select_chtxt_by_title_timeline_log(title)
88 add.append([recdblist.REC_AUTO_SUGGEST_DECODE,title,nchtxt])
90 add.append([recdblist.REC_AUTO_SUGGEST_ENCODE,title,nchtxt])
92 add.append([recdblist.REC_AUTO_SUGGEST_AVI2FP,title,nchtxt])
94 # add.append([recdblist.REC_AUTO_SUGGEST_AP2FP,title,nchtxt])
97 rec10d.rec10db.new_auto_proc()
99 rec10d.rec10db.add_auto_proc(a[0],a[1],a[2])
102 処理がどの段階まで言ったのかを調査し返す。
114 def check_process(path,title):
115 path1 = os.path.join(path,title+".mkv")
116 if os.path.exists(path1):
117 if int(time.time()-os.path.getmtime(path1))>300:
121 elif os.path.exists(os.path.join(path,title+".mp4")):
122 if int(time.time()-os.path.getmtime(os.path.join(path,title+".mp4")))>300:
126 elif os.path.exists(os.path.join(path,title+".264")):
127 if int(time.time()-os.path.getmtime(os.path.join(path,title+".264")))>300:
131 elif os.path.exists(os.path.join(path,title+".ts.log")):
132 if int(time.time()-os.path.getmtime(os.path.join(path,title+".ts")))<300:
136 elif os.path.exists(os.path.join(path,title+".ts")):
137 if int(time.time()-os.path.getmtime(os.path.join(path,title+".ts")))>300:
141 elif os.path.exists(os.path.join(path,title+".sa.avi")):
142 if int(time.time()-os.path.getmtime(os.path.join(path,title+".sa.avi")))>300:
146 elif os.path.exists(os.path.join(path,title+".ts.b25")):
147 if int(time.time()-os.path.getmtime(os.path.join(path,title+".ts.b25")))>300:
151 def update_timeline_epg(btime,etime):
152 dbl=rec10d.rec10db.select_bytime_all_timeline(btime, etime)
155 #[chtxtt, title, btime, etime,exp,longexp,category]
156 if db['type']==recdblist.REC_KEYWORD or db['type']==recdblist.REC_KEYWORD_EVERY_SOME_DAYS:
157 ret=epgdb.searchtime2(db['title'], db['btime'], db['deltatime'], db['chtxt'])
158 rec10d.rec10db.update_epg_timeline(db['type'], db['chtxt'], db['title'], db['btime'], ret[2],ret[3],ret[1])
159 elif db['type']==recdblist.REC_RESERVE or db['type']==recdblist.REC_FINAL_RESERVE :
160 ret=epgdb.searchtime2(db['title'], db['btime'],"5", db['chtxt'])
161 rec10d.rec10db.update_epg_timeline(db['type'], db['chtxt'], db['title'], db['btime'], ret[2],ret[3],ret[1])