ltitle=unicode(opts.ltitle,'utf-8')
sf=guess.searchFolder(ltitle, recordedpath)
print "###MKV###"
- recdblist.printutf8(os.path.join(sf, auto_move.get_move_dest_path(ltitle,recpath,sf,".mkv")+".mkv"))
+ recdblist.printutf8(os.path.join(sf, auto_move.get_move_dest_path(ltitle,recpath,sf,".mkv")+".mkv"),verbose_level=100)
print "\n"
print "###MP4###"
- recdblist.printutf8(os.path.join(sf, auto_move.get_move_dest_path(ltitle,recpath,sf,".mp4")+".mp4"))
+ recdblist.printutf8(os.path.join(sf, auto_move.get_move_dest_path(ltitle,recpath,sf,".mp4")+".mp4"),verbose_level=100)
print "\n"
elif opts.auto:##-A の場合
sa=auto_move.search_file(recpath, recordedpath, ".mkv")
for t in sa:
- recdblist.printutf8(u"自動推測実行中-MKV")
+ recdblist.printutf8(u"自動推測実行中-MKV",verbose_level=100)
sf=guess.searchFolder(t,recordedpath)
if sf!="":
- recdblist.printutf8(u"移動先")
- recdblist.printutf8(t+" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".mkv")+".mkv"))
- recdblist.printutf8(u"実行中")
+ recdblist.printutf8(u"移動先",verbose_level=100)
+ recdblist.printutf8(t+" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".mkv")+".mkv"),verbose_level=100)
+ recdblist.printutf8(u"実行中",verbose_level=100)
auto_move.execMove(t, recpath, recordedpath,".mkv",1)
else:
- recdblist.printutf8(t+" can't find matching folder")
+ recdblist.printutf8(t+" can't find matching folder",verbose_level=100)
sa=auto_move.search_file(recpath, recordedpath, ".mp4")
for t in sa:
- recdblist.printutf8(u"自動推測実行中-MP4")
+ recdblist.printutf8(u"自動推測実行中-MP4",verbose_level=100)
sf=guess.searchFolder(t,recordedpath)
if sf!="":
- recdblist.printutf8(u"移動先")
- recdblist.printutf8(t+" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".mp4")+".mp4"))
- recdblist.printutf8(u"実行中")
+ recdblist.printutf8(u"移動先",verbose_level=100)
+ recdblist.printutf8(t+" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".mp4")+".mp4"),verbose_level=100)
+ recdblist.printutf8(u"実行中",verbose_level=100)
auto_move.execMove(t, recpath, recordedpath,".mp4",1)
else:
- recdblist.printutf8(t+" can't find matching folder")
+ recdblist.printutf8(t+" can't find matching folder",verbose_level=100)
elif opts.delete:##-Dの場合
sa=auto_move.search_file(recpath, recordedpath,".mkv")
for t in sa:
for t in sa:
sf=guess.searchFolder(t,recordedpath)
if sf!="":
- recdblist.printutf8(t+u" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".mkv")+".mkv"))
+ recdblist.printutf8(t+u" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".mkv")+".mkv"),verbose_level=100)
sa=auto_move.search_file(recpath, recordedpath,".mp4")
for t in sa:
sf=guess.searchFolder(t,recordedpath)
if sf!="":
- recdblist.printutf8(t+u" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".mp4")+".mp4"))
+ recdblist.printutf8(t+u" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".mp4")+".mp4"),verbose_level=100)
elif opts.etitle!="":
if os.path.exists(os.path.join(recpath, etitle+".mkv")):
auto_move.execMove(etitle,recpath, recordedpath,".mkv",1)
print "\n"
sa=auto_move.search_file(recpath, tsmovepath,".ts")
else:
- recdblist.printutf8(u"ts_movepathが設定されていません。/etc/rec10.confを設定してください。")
+ recdblist.printutf8(u"ts_movepathが設定されていません。/etc/rec10.confを設定してください。",verbose_level=100)
elif opts.tsmove:##-Tの場合
tsmovepath=""
try:
for t in sa:
sf=guess.searchFolder(t,tsmovepath,700)
if sf!="":
- recdblist.printutf8(u"移動先")
- recdblist.printutf8(t+" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".ts")+".ts"))
- recdblist.printutf8(u"実行中")
+ recdblist.printutf8(u"移動先",verbose_level=100)
+ recdblist.printutf8(t+" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".ts")+".ts"),verbose_level=100)
+ recdblist.printutf8(u"実行中",verbose_level=100)
auto_move.execMove(t, recpath, tsmovepath,".ts",0)
sa=auto_move.search_file(recpath, tsmovepath,".ts")
else:
- recdblist.printutf8(u"ts_movepathが設定されていません。/etc/rec10.confを設定してください。")
+ recdblist.printutf8(u"ts_movepathが設定されていません。/etc/rec10.confを設定してください。",verbose_level=100)
elif opts.seriespath!="":##-Sの場合##与えられたパスにシリーズがそろっているかを調べる。
ss=guess.detSeriesNum(opts.seriespath)
for sstitle, ssv in ss.iteritems():
time.sleep(5)
rec10d.rec10db.update_by_bctype_epg_ch(bctype)
except Exception, inst:
- recdblist.Commonlogex("Error","updatebc(epgdb.py)", str(type(inst)), str(inst))
+ recdblist.Commonlogex("Error","updatebc(epgdb.py)", str(type(inst)), str(inst),log_level=200)
xml2db_dom.xml2db_dom(tmppath + bctype + "epgdata.bak.xml", bctype)
rec10d.rec10db.update_status_by_bctype_epg_ch(bctype, "2")
def updatebc_bak(bctype):
ff=[]
maxnum=0
for file in files:
- recdblist.printutf8(unicode(file,'utf-8'))
+ recdblist.printutf8(unicode(file,'utf-8'),verbose_level=800)
file=os.path.join(movepath,file)
if os.path.isfile(file):
name=os.path.splitext(os.path.split(file)[1])
title=title.replace(u"[新]","")
title=title.replace(u" 新","")
new=1
- recdblist.printutf8(title)
+ recdblist.printutf8(title,verbose_level=800)
title=auto_move.getTitle(title)##titleから日時を除く
title=title.replace(u"無料≫","")
#rA=re.compile(".+(?P<title>)#\d(?P<num>)\s[0,10]\z")
print str.encode('utf-8')
def install():
version = recdblist.version
- recdblist.printutf8(u"rec10の環境インストールを開始します。")
+ recdblist.printutf8(u"rec10の環境インストールを開始します。",verbose_level=100)
time.sleep(1)
- recdblist.printutf8(u"環境インストール処理中・・・")
+ recdblist.printutf8(u"環境インストール処理中・・・",verbose_level=100)
path = str(os.path.dirname(os.path.abspath(__file__)))
confp = ConfigParser.SafeConfigParser()
Conf = 'rec10.conf'
if confpath!="":
confp.read(confpath)
else:
- recdblist.printutf8(u"rec10.confが見つかりません。")
- recdblist.printutf8(u"このinstall.pyと同じフォルダに置くか、/etc/rec10.confもしくは/etc/rec10/rec10.confにおいてください。")
+ recdblist.printutf8(u"rec10.confが見つかりません。",verbose_level=100)
+ recdblist.printutf8(u"このinstall.pyと同じフォルダに置くか、/etc/rec10.confもしくは/etc/rec10/rec10.confにおいてください。",verbose_level=100)
sys.exit(1)
- recdblist.printutf8(u"設定ファイルの読み込みを確認//設定ファイルのパスは"+confpath)
+ recdblist.printutf8(u"設定ファイルの読み込みを確認//設定ファイルのパスは"+confpath,verbose_level=100)
if confp.get('path',"recpath")=="/path of /recording":
- recdblist.printutf8(u"録画先のフォルダを設定してください(recpath=)")
+ recdblist.printutf8(u"録画先のフォルダを設定してください(recpath=)",verbose_level=100)
sys.exit(1)
- recdblist.printutf8(u"DB処理に入ります")
+ recdblist.printutf8(u"DB処理に入ります",verbose_level=100)
if os.path.exists(os.path.join(path,"rec10d.py")):
try:
update_db_all()
except Exception, inst:
- recdblist.printutf8(u"DB処理中にエラーが出ました。configファイルのDB設定を見直してください。")
- recdblist.printutf8(str(type(inst)))
- recdblist.printutf8(str(inst))
- recdblist.printutf8(u"チャンネル設定に入ります")
+ recdblist.printutf8(u"DB処理中にエラーが出ました。configファイルのDB設定を見直してください。",verbose_level=100)
+ recdblist.printutf8(str(type(inst)),verbose_level=100)
+ recdblist.printutf8(str(inst),verbose_level=100)
+ recdblist.printutf8(u"チャンネル設定に入ります",verbose_level=100)
if os.path.exists(os.path.join(path,"chlist.xml")):
- recdblist.printutf8(u"チャンネルリストが見つかりました。||chlist.xml")
+ recdblist.printutf8(u"チャンネルリストが見つかりました。||chlist.xml",verbose_level=100)
else:
- recdblist.printutf8(u"チャンネルリストが見つかりません。"+os.path.join(path,"chlist.xml")+u"を作成してください。")
- recdblist.printutf8(u"東京/名古屋/神戸のサンプルがchlist_sample_*.xmlにあるため、参考にしてください。")
+ recdblist.printutf8(u"チャンネルリストが見つかりません。"+os.path.join(path,"chlist.xml")+u"を作成してください。",verbose_level=100)
+ recdblist.printutf8(u"東京/名古屋/神戸のサンプルがchlist_sample_*.xmlにあるため、参考にしてください。",verbose_level=100)
sys.exit(1)
bsok=int(confp.get('env',"bs"))
csok=int(confp.get('env',"cs"))
import chdata
chdata.new_chdata(bsok,csok)
- recdblist.printutf8(u"おめでとうございます 初期設定は完了しました。")
- recdblist.printutf8(u"rec10を実行するユーザーのcrontabに"+os.path.join(path,"rec10")+u"を追加してください(5分周期が目安)")
+ recdblist.printutf8(u"おめでとうございます 初期設定は完了しました。",verbose_level=100)
+ recdblist.printutf8(u"rec10を実行するユーザーのcrontabに"+os.path.join(path,"rec10")+u"を追加してください(5分周期が目安)",verbose_level=100)
import rec10d
rec10d.rec10db.change_installed_in_status()
def getpath(cmd):
if rec10d.rec10db.select_installed_in_status()==1:
if rec10d.rec10db.select_version_in_status()==0:
tversion=0
- recdblist.printutf8(u"既存のDBが見つかりました。0.9.1と仮定してアップデート処理を行います。")
+ recdblist.printutf8(u"既存のDBが見つかりました。0.9.1と仮定してアップデート処理を行います。",verbose_level=100)
update_db(0)
time.sleep(1)
else:
- recdblist.printutf8(u"既存のDBが見つかりました。アップデート処理を行います。")
+ recdblist.printutf8(u"既存のDBが見つかりました。アップデート処理を行います。",verbose_level=100)
tversion=int(rec10d.rec10db.select_version_in_status())
while (recdblist.version>tversion):
update_db(tversion)
remove_ts = 0
[log]
-verbose = 400#デーモンとして使う場合は変更する必要はありません。
+verbose_level = 400#デーモンとして使う場合は変更する必要はありません。
log_level = 400#
\ No newline at end of file
import configreader
import dbMySQL
import timerec
+import recdblist
path = str(os.path.dirname(os.path.abspath(__file__))) + "/"
global rec10db
def main():
rec10db.new_in_status()
else:
rec10db = dbSQLite.DB_SQLite(path + "ch.db")
+recdblist.log_level_now=configreader.getlog("log_level")
+recdblist.verbose_level_now=configreader.getlog("verbose_level")
if __name__ == "__main__":
main()
import tv2mkv
import tv2mp4
import install
+from recdblist import verbose_level_now
import recdblist
recpath = configreader.getpath('recpath')
movepath = configreader.getpath('move_destpath')
recdb.delete_old_auto_keyword("1")
tasks = recdb.getnow("3")
inum = recdb.countRecNow_minutes("10")
- 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()) )
+ recdblist.printutf8(u"rec10処理開始"+ datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),verbose_level=800)
+ recdblist.printutf8(u"直近録画予約件数:" + str(inum) + u"BS/CS録画中件数:" + str(status.getBSCSRecording()) + u"TE録画中件数:" + str(status.getTERecording()) ,verbose_level=800)
encodenum=0
b25num=0
dnow=datetime.datetime.now()
recnum = 0
if bctype.find('te') > -1:
recnum = status.getTERecording() + recdb.countRecNow_minutes_TE("10")
- recdblist.printutf8(u"放送種別:"+bctype + u"||該当チューナー実行中件数:" + str(status.getTERecording()) + u":直近予約件数:" + str(recdb.countRecNow_minutes_TE("10")))
+ recdblist.printutf8(u"放送種別:"+bctype + u"||該当チューナー実行中件数:" + str(status.getTERecording()) + u":直近予約件数:" + str(recdb.countRecNow_minutes_TE("10")),verbose_level=800)
recnum = int(configreader.getenv("te_max")) -recnum
else:
recnum = status.getBSCSRecording() + recdb.countRecNow_minutes_BSCS("10")
- recdblist.printutf8(u"放送種別:"+bctype + u"||該当チューナー実行中件数:" + str(status.getBSCSRecording()) + u":直近予約件数:" + str(recdb.countRecNow_minutes_BSCS("10")))
+ recdblist.printutf8(u"放送種別:"+bctype + u"||該当チューナー実行中件数:" + str(status.getBSCSRecording()) + u":直近予約件数:" + str(recdb.countRecNow_minutes_BSCS("10")),verbose_level=800)
recnum = int(configreader.getenv("bscs_max")) -recnum
if recnum >0 :
recdblist.printutf8(str(update))
- rec10d.rec10db.update_status_by_bctype_epg_ch(bctype, "0")
+ rec10d.rec10db.update_status_by_bctype_epg_ch(bctype, "0",verbose_level=750)
epgdb.updatebc(bctype)
update = chdb.update()
i = i + 1
topt=status.getSettings_auto_opt()
recdb.recreserv(titlet,chtxtt, btimet, etimet,topt)
except Exception, inst:
- recdblist.Commonlogex("Error", "search_keyword_auto_jbk(timerec.py)", str(type(inst)),str(inst))
+ recdblist.Commonlogex("Error", "search_keyword_auto_jbk(timerec.py)", str(type(inst)),str(inst),log_level=200)
else:
try:
recdb.add_auto_keyword(chtxtt, titlet, btimet, etimet)
except Exception, inst:
- recdblist.Commonlogex("Error", "search_keyword(timerec.py)", str(type(inst)),str(inst))
+ recdblist.Commonlogex("Error", "search_keyword(timerec.py)", str(type(inst)),str(inst),log_level=200)
def type_reserve(typetxt,chtxt,title,bt,et,opt):
btime = bt.strftime("%Y-%m-%d %H:%M:%S")
etime = et.strftime("%Y-%m-%d %H:%M:%S")
auto_rec.add_key("ALL", titlen,exp+" "+longexp)
recdblist.printutf8(u"追いかけ機能実行中: "+title+" : "+titlen+" "+btimen+" "+etimen)
except Exception, inst:
- recdblist.Commonlogex("Error", "Oikake DB(timerec.py)", str(type(inst)),str(inst))
+ recdblist.Commonlogex("Error", "Oikake DB(timerec.py)", str(type(inst)),str(inst),log_level=200)
else:
recdblist.printutf8(u"追いかけ機能エラー:番組データが見付かりません。")
else:
auto_rec.add_key(chtxt, titlen,exp+" "+longexp)
auto_rec.add_key("ALL", titlen,exp+" "+longexp)
#recdblist.printutf8(u"追いかけ機能実行中: "+title+" : "+titlen+" "+btimen+" "+etimen)
- recdblist.Commonlogex(u"通常", "Oikake (timerec.py)",u"追いかけ機能実行中",u"追いかけ機能実行中: "+title+" : "+titlen+" "+btimen+" "+etimen)
+ recdblist.Commonlogex(u"通常", "Oikake (timerec.py)",u"追いかけ機能実行中",u"追いかけ機能実行中: "+title+" : "+titlen+" "+btimen+" "+etimen,log_level=500)
except Exception, inst:
- recdblist.Commonlogex("Error", "Oikake DB(timerec.py)", str(type(inst)),str(inst))
+ recdblist.Commonlogex("Error", "Oikake DB(timerec.py)", str(type(inst)),str(inst),log_level=200)
elif dt <= 20 * 60:
try:
recdb.del_reckey(typetxtnow, title, chtxt, btime)
recdb.rec_reckey(typetxtfinal, title, chtxt, btime, etime, opt)
except Exception, inst:
- recdblist.Commonlogex("Error", "Oikake DB(timerec.py)", str(type(inst)),str(inst))
+ recdblist.Commonlogex("Error", "Oikake DB(timerec.py)", str(type(inst)),str(inst),log_level=200)
def type_final(typetxt,chtxt,title,bt,et,opt):
btime = bt.strftime("%Y-%m-%d %H:%M:%S")
etime = et.strftime("%Y-%m-%d %H:%M:%S")
newtime=bt
newtitle=newtitle+u"_"+iff+newtime.strftime("%Y-%m-%dT%H-%M-%S")
recdb.rec_reckey(typetxting, newtitle, chtxt, btime, etime, opt)
- recdblist.Commonlogex(u"通常","timerec.py",u"録画開始 "+newtitle+" "+btime+" "+etime,"")
+ recdblist.Commonlogex(u"通常","timerec.py",u"録画開始 "+newtitle+" "+btime+" "+etime,"",log_level=500)
tv2avi.timetv2b25(recpath + "/" + newtitle + ".avi", chtxt, btime, etime, opt)
recdb.del_reckey(typetxting, newtitle, chtxt, btime)
if not re.search("R", opt):
recdb.rec_reclog(titlet, chtxtt, btimet, etimet, opt, exp,longexp,category)
auto_rec.add_key(chtxt, titlet,exp+" "+longexp)
auto_rec.add_key("ALL", titlet,exp+" "+longexp)
- recdblist.Commonlogex(u"通常","timerec.py",u"key "+title+u" : "+titlet+u" "+btimet+u" "+etimet,"")
+ recdblist.Commonlogex(u"通常","timerec.py",u"key "+title+u" : "+titlet+u" "+btimet+u" "+etimet,"",log_level=500)
#except Exception, inst:
# recdblist.printutf8("Error happened in REC_KEYWORD DB")
# recdblist.printutf8(type(inst))
errtxt1="move ts error.\n"
errtxt2=str(type(inst))+"\n"
errtxt2=errtxt2+str(inst)
- recdblist.Commonlogex("Error", "type_decode_que(timerec.py)", errtxt1,errtxt2)
+ recdblist.Commonlogex("Error", "type_decode_que(timerec.py)", errtxt1,errtxt2,log_level=200)
recdb.rec_reckey(recdblist.REC_MOVE_END, title, chtxt, btime, etime, opt)
else:
recdb.del_reckey(typetxtnow, title, chtxt, btime)
errtxt1="move mkv/mp4 error."
errtxt2=str(type(inst))+"\n"
errtxt2=errtxt2+str(inst)
- recdblist.Commonlogex("Error", "type_encode_que(timerec.py)", errtxt1,errtxt2)
+ recdblist.Commonlogex("Error", "type_encode_que(timerec.py)", errtxt1,errtxt2,log_level=200)
recdb.rec_reckey(recdblist.REC_MOVE_END, title, chtxt, btime, etime, opt)
recdb.rec_reckey(typetxtfin, title, chtxt, btime, etime, opt)
sys.exit()
"""
指定された時間分tsを取得してepgの入ったxmlとして書き出す
"""
- recdblist.Commonlogex(u"通常","write_time(ts2epg.py)",u"Ts-EPG XML書き出し処理開始" ,u"CH:"+ch)
+ recdblist.Commonlogex(u"通常","write_time(ts2epg.py)",u"Ts-EPG XML書き出し処理開始" ,u"CH:"+ch,log_level=500)
timet = times
if re.search(u'CS', ch):
mode = "/CS"
tv2ts.tv2tsmix(pout + ".ts", ch, timet)
exe = "export LANG=ja_JP.UTF-8 && nice -n 15 " + epgdump + " " + mode + " " + pout + ".ts " + pout
recdblist.printutf8(exe)
- recdblist.Commonlogex(u"通常", "write_time(ts2epg.py)", exe,"")
+ recdblist.Commonlogex(u"通常", "write_time(ts2epg.py)", exe,"",log_level=500)
os.system(exe)
time.sleep(10)
tm2v=pin.replace(".ts",".m2v")
encode_sar(tm2v, pout,size,is24fps,quality,crf,deinterlace)
except Exception, inst:
- recdblist.Commonlogex("Error", "ts2x264(ts2x264.py)", str(type(inst)), str(inst))
+ recdblist.Commonlogex("Error", "ts2x264(ts2x264.py)", str(type(inst)), str(inst),log_level=200)
else:
try:
encode_sar(pin, pout,size,is24fps,quality,crf,deinterlace)
except Exception, inst:
- recdblist.Commonlogex("Error", "ts2x264(ts2x264.py)", str(type(inst)), str(inst))
+ recdblist.Commonlogex("Error", "ts2x264(ts2x264.py)", str(type(inst)), str(inst),log_level=200)
def encode_sar(pin,pout,size,is24fps,quality,crf,deinterlace=1):
mencoder=configreader.getpath("mencoder")
encvf=""
try:
tv2b25ts(pout + ".b25", ch, time)
except Exception, inst:
- recdblist.Commonlogex(u"Error",u"tv2ts(tv2ts.py)", str(type(inst)),str(inst))
+ recdblist.Commonlogex(u"Error",u"tv2ts(tv2ts.py)", str(type(inst)),str(inst),log_level=200)
if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
status.changeBSCSRecording(-1)
else:
else:
newtitle=title
except Exception, inst:
- recdblist.Commonlogex("Error", "addTitle_Subtitle(xml2db_dob.py)", str(type(inst)),str(inst))
+ recdblist.Commonlogex("Error", "addTitle_Subtitle(xml2db_dob.py)", str(type(inst)),str(inst),log_level=200)
newtitle=title
return newtitle
\ No newline at end of file