#!/usr/bin/python
# coding: UTF-8
# Rec10 TS Recording Tools
-# Copyright (C) 2009 Yukikaze
+# Copyright (C) 2009-2010 Yukikaze
import os
import glob
import time
+import datetime
import recdblist
import rec10d
b25list = glob.glob(path+"/*.ts.b25")
filelist=avilist+mkvlist+tslist+b25list+mp4list
add=[]
+ tbtime=datetime.datetime.now()+datetime.timedelta(seconds=60)
+ tbtime2=datetime.datetime.now()+datetime.timedelta(seconds=1200)
for fn in filelist:
- if fn.rfind("sa.avi")==-1 and fn.rfind(".120.avi")==-1:
+ if fn.rfind("sa.avi")==-1 and fn.rfind(".120.avi")==-1 and os.path.getsize(fn)>1*1000*1000:
dir = os.path.split(fn)[0]
file = os.path.split(fn)[1]
title = os.path.splitext(file)[0]
title = unicode(title,'utf-8')
+
+ #print dbs
ext = os.path.splitext(file)[1]
if ext == ".b25":
title=title.replace(".ts","")
- proc=check_process(dir, title)
- if proc=="b25":
+ dbs=rec10d.rec10db.select_by_name_time_timeline(title,tbtime,tbtime2)
+ if len(dbs)==0:
+ proc=check_process(dir, title)
chtxtt=rec10d.rec10db.select_chtxt_by_title_timeline_log(title)
nchtxt=""
if chtxtt!=None:
nchtxt=chtxtt
- add.append([recdblist.REC_AUTO_SUGGEST_DECODE,title,nchtxt])
- elif proc=="ts":
- add.append([recdblist.REC_AUTO_SUGGEST_ENCODE,title,""])
- elif proc =="avi":
- add.append([recdblist.REC_AUTO_SUGGEST_AVI2FP,title,""])
- elif proc =="mkv":
- add.append([recdblist.REC_AUTO_SUGGEST_AP2FP,title,""])
+ if proc=="b25":
+ """chtxtt=rec10d.rec10db.select_chtxt_by_title_timeline_log(title)
+ nchtxt=""
+ if chtxtt!=None:
+ nchtxt=chtxtt"""
+ add.append([recdblist.REC_AUTO_SUGGEST_DECODE,title,nchtxt])
+ elif proc=="ts":
+ add.append([recdblist.REC_AUTO_SUGGEST_ENCODE,title,nchtxt])
+ elif proc =="264":
+ add.append([recdblist.REC_AUTO_SUGGEST_AVI2FP,title,nchtxt])
+ #elif proc =="mp4":
+ # add.append([recdblist.REC_AUTO_SUGGEST_AP2FP,title,nchtxt])
+ #print add
if len(add)>0:
- rec10d.rec10db.new_auto_proc_tmp()
- for a in add:
- rec10d.rec10db.add_auto_proc_tmp(a[0],a[1],a[2])
rec10d.rec10db.new_auto_proc()
- rec10d.rec10db.update_auto_proc()
+ for a in add:
+ rec10d.rec10db.add_auto_proc(a[0],a[1],a[2])
+ time.sleep(1)
"""
処理がどの段階まで言ったのかを調査し返す。
return
return "mp4"
else:
return "mp4making"
- elif os.path.exists(os.path.join(path,title+".avi")):
- if int(time.time()-os.path.getmtime(os.path.join(path,title+".avi")))>300:
- return "avi"
+ elif os.path.exists(os.path.join(path,title+".264")):
+ if int(time.time()-os.path.getmtime(os.path.join(path,title+".264")))>300:
+ return "264"
else:
return "encoding"
+ elif os.path.exists(os.path.join(path,title+".ts.log")):
+ if int(time.time()-os.path.getmtime(os.path.join(path,title+".ts")))<300:
+ return "encoding"
+ else:
+ return "ts"
elif os.path.exists(os.path.join(path,title+".ts")):
if int(time.time()-os.path.getmtime(os.path.join(path,title+".ts")))>300:
return "ts"