__author__="yukikaze"
__date__ ="$2009/09/14 17:38:25$"
-
import glob
import n_gram
import os
import configreader
import recdblist
-recordedpath=configreader.getpath("recorded")
-recpath=configreader.getpath("recpath")
+recordedpath=unicode(configreader.getpath("recorded"),'utf-8')
+recpath=unicode(configreader.getpath("recpath"),'utf-8')
def search_b25(path):
"""
録画フォルダを検索し、各QUEの実行状況を表示する
def veryfySize(path):
#vsize=[297,497,596,1196]#SD 30m 1h 1.5h 2h
vsize=[245,275,295,591,830]
- vsize=vsize+[325,449,560,590,602,690,860,1237]
+ vsize=vsize+[325,449,560,590,602,690,805,860,1014,1138,1237]
#vsize=vsize+[458,916]#HD 30m 1h
#vsize=vsize+[381,895,447]
ret = 0
lfpath=[]
ngram=[]
for ft in folderpath:
- fullpath=os.path.join(path, ft)
+ fullpath=os.path.join(path.encode('utf-8'), ft)
if os.path.isdir(fullpath):
lfpath.append(fullpath)
ftt=os.listdir(fullpath)
if len(ftt)>0:
for ft2 in ftt:
- folderpath.append(os.path.join(fullpath, ft2))
+ try:
+ folderpath.append(os.path.join(fullpath, ft2))
+ except Exception, inst:
+ #print type(inst)
+ #print inst
+ ""
else:
lfpath.append(fullpath)
for dirp in lfpath:
cmpp=""
appp=""
+ ntitle=title
if os.path.isdir(dirp):
cmpp=os.path.dirname(dirp)
appp=dirp
else:
cmpp=os.path.basename(dirp)
appp=os.path.dirname(dirp)
- p=n_gram.trigram(title.decode("utf-8"),cmpp.decode("utf-8"))
+ p=n_gram.trigram(ntitle,cmpp)
if p>0:
ngram.append((p,appp))
ngram=list(set(ngram))
parser.add_option("-l","--list",action="store_true",dest="list",default=False,help="File listing mode(test for -a)")
(opts,args)=parser.parse_args(sys.argv)
if opts.ltitle!="":
- sf=searchFolder(opts.ltitle, recordedpath)
- recdblist.printutf8(os.path.join(sf, destNameMP4(opts.ltitle,recpath,sf)+".mp4"))
+ #print opts.ltitle
+ ltitle=unicode(opts.ltitle,'utf-8')
+ sf=searchFolder(ltitle, recordedpath)
+ recdblist.printutf8(os.path.join(sf, destNameMP4(ltitle,recpath,sf)+".mp4"))
+ #print os.path.join(sf, destNameMP4(ltitle,recpath,sf)+".mp4")
elif opts.auto:
sa=search_mp4(recpath, recordedpath)
for t in sa:
for t in sa:
sf=searchFolder(t,recordedpath)
if sf!="":
- recdblist.printutf8(t+" : "+os.path.join(sf, destNameMP4(t, recpath,sf)+".mp4"))
+ recdblist.printutf8(t+u" : "+os.path.join(sf, destNameMP4(t, recpath,sf)+".mp4"))
elif opts.etitle!="":
- execMove(opts.etitle,recpath, recordedpath)
+ etitle=unicode(opts.etitle,'utf-8')
+ execMove(etitle,recpath, recordedpath)
if dnow.hour==12 and dnow.minute<5 :
pid = os.fork()
if pid != 0:
- time.sleep(1)
+ ""
else:
for k in recdb.get_key():
search_keyword(k)
dt = dtt.days * 24 * 60 * 60 + dtt.seconds
print dt
if dt < 6 * 60 and dt > 0:
+ newtitle=title
recdb.del_reckey(typetxtnow, title, chtxt, btime)
- recdb.rec_reckey(typetxting, title, chtxt, btime, etime, opt)
- recdblist.printutf8(u"録画開始 "+title+" "+btime+" "+etime)
- ttitle=title
- #recdblist.printutf8(title)
testpath=[os.path.join(recpath,title+".ts.b25")]
testpath.append(os.path.join(recpath,title+".ts"))
testpath.append(os.path.join(recpath,title+".avi"))
for ti in testpath:
if os.path.exists(ti):
tcheck=tcheck+1
- if tcheck>0:
- ttitle=title+"_"+datetime.datetime.now().strftime("%Y%m%d%H%M")
- tv2avi.timetv2b25(recpath + "/" + ttitle + ".avi", chtxt, btime, etime, opt)
+ if re.search("N", opt) or tcheck>0:
+ newtitle=newtitle+u"_"+bt.strftime("%Y%m%d%H%M")
+ recdb.rec_reckey(typetxting, newtitle, chtxt, btime, etime, opt)
+ recdblist.printutf8(u"録画開始 "+newtitle+" "+btime+" "+etime)
+ tv2avi.timetv2b25(recpath + "/" + newtitle + ".avi", chtxt, btime, etime, opt)
recdb.del_reckey(typetxting, title, chtxt, btime)
if not re.search("R", opt):
tnow = datetime.datetime.now()
tv2mp4.ts2mp4(pin, pout, opt)
#tv2avi.ts2avi(pin, pout, opt)
recdb.del_reckey(typetxting, title, chtxt, btime)
- if re.search("R", opt):
+ if re.search("E", 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)