elif tT5:
ntitle=tT5.group(1)
return ntitle
-def search_file(temppath,recpath,ext):
+def searchFile(temppath,recpath,ext):
"""
録画一時フォルダ内ファイルを検索
"""
if veryfySize(avipath):
ret.append(title)
return ret
-def get_move_dest_path(title,temppath,recpath,ext):
+def getMoveDestpath(title,temppath,recpath,ext):
dstpath=os.path.join(recpath,title+ext)
srcpath=os.path.join(temppath,title+ext)
if os.path.exists(dstpath):
gmtime=time.gmtime(os.path.getmtime(srcpath))
iff=""
try:
- iff=u"("+configreader.getenv("iff")+u")_"
+ iff=u"("+configreader.getEnvSetting("iff")+u")_"
if iff==u"()_":
iff = u""
except:
recdblist.printutf8(u"同サイズのファイルが存在します")
return title
-def get_delpath(temppath,title,addfp=1):
+def getDelpath(temppath,title,addfp=1):
delpath=[os.path.join(temppath,title+".ts")]
delpath.append(os.path.join(temppath,title+".avi"))
if addfp==1:
srcpath=os.path.join(temppath,title+ext)
sf=guess.searchFolder(title, recpath)
if sf!="":
- destpath=os.path.join(sf,get_move_dest_path(title, temppath, sf, ext)+ext)
+ destpath=os.path.join(sf,getMoveDestpath(title, temppath, sf, ext)+ext)
if os.path.exists(destpath):
if os.path.getsize(destpath) == os.path.getsize(srcpath):
recdblist.printutf8(u"同名同サイズのファイルが存在します。")
if autodel==1:
recdblist.printutf8(u"関連ファイルを削除します。")
- delpath=get_delpath(temppath, title)
+ delpath=getDelpath(temppath, title)
for dp in delpath:
try:
os.remove(dp)
shutil.copy(srcpath, destpath)
#shutil.copy(srcpath, destpath)
if autodel==1:
- delpath=get_delpath(temppath, title)
+ delpath=getDelpath(temppath, title)
for dp in delpath:
try:
os.remove(dp)
except:
""
def execDelete(title,temppath):
- delpath=get_delpath(temppath, title,0)
+ delpath=getDelpath(temppath, title,0)
recdblist.printutf8(title+u" 関連の一時ファイルを削除します")
for dp in delpath:
try:
import rec10d
import tv2mp4
import epgdb
-def Update_to_MP4(path):
+def updateToMP4(path):
"""
!現在未使用!
録画一時フォルダ内mp4ファイルを検索
ret=[]
#[chtxtt, title, btime, etime,exp,longexp,category]
if db['type']==recdblist.REC_KEYWORD or db['type']==recdblist.REC_KEYWORD_EVERY_SOME_DAYS:
- ret=epgdb.searchtime2(db['title'], db['btime'], db['deltatime'], db['chtxt'])
+ ret=epgdb.searchTime(db['title'], db['btime'], db['deltatime'], db['chtxt'])
if len(ret)>4 and len(ret[2])>18:
rec10d.rec10db.update_epg_timeline(db['type'], db['chtxt'], db['title'], db['btime'], ret[2],ret[3],ret[1],ret[4])
if not (db['btime'] == ret[2] and db['etime']==ret[3]):
else:
rec10d.rec10db.update_status_change_timeline(db['type'], db['chtxt'], db['title'], db['btime'], "1")
elif db['type']==recdblist.REC_RESERVE or db['type']==recdblist.REC_FINAL_RESERVE :
- ret=epgdb.searchtime2(db['title'], db['btime'],"5", db['chtxt'])
+ ret=epgdb.searchTime(db['title'], db['btime'],"5", db['chtxt'])
if len(ret)>4 and len(ret[2])>18:
rec10d.rec10db.update_epg_timeline(db['type'], db['chtxt'], db['title'], db['btime'], ret[2],ret[3],ret[1],ret[4])
if not (db['btime'] == ret[2] and db['etime']==ret[3]):
dbl=rec10d.rec10db.select_byepgtime_all_timeline(epgbtime, epgetime)
for db in dbl:
if db['type']==recdblist.REC_KEYWORD or db['type']==recdblist.REC_KEYWORD_EVERY_SOME_DAYS:
- dbn=epgdb.count_epgschedule(db['epgbtime'], db['epgetime'])
+ dbn=epgdb.countEpgSchedule(db['epgbtime'], db['epgetime'])
try:
- bctypet=chdb.chtxtsearch(db['chtxt'])['bctype']
+ bctypet=chdb.searchFromCHtxt(db['chtxt'])['bctype']
if bctypet.find("cs") > -1 or bctypet.find("bs") > -1 :
if dbn[1]>status.getRecordingMax()[1]:
rec10d.rec10db.update_status_dup_timeline(db['type'], db['chtxt'], db['title'], db['btime'], "1")
elif os.path.getsize(os.path.join(path,title+".ts"))>200*1000*1000:
dp.append(os.path.join(path,title+".ts.b25"))
if level > 4 :
- if configreader.getenv("remove_ts")=="1":
+ if configreader.getEnvSetting("remove_ts")=="1":
dp.append(os.path.join(path,title+".ts"))
if level > 9 :
dp.append(os.path.join(path,title+".avi"))
# Copyright (C) 2009-2010 Yukikaze
import n_gram
import rec10d
-def get_db_key(key,chtxt):
+def getDBKey(key,chtxt):
return rec10d.rec10db.select_by_key_in_auto_bayes_key(key, chtxt)
-def change_db_epg(chtxt,beforenum,newnum):
+def changeDBEpg(chtxt,beforenum,newnum):
rec10d.rec10db.change_ratio_all_reduce_in_auto_bayes_key(chtxt, beforenum, newnum)
-def change_db_num(chtxt,recaddnum,alladdnum):
+def changeDBNum(chtxt,recaddnum,alladdnum):
"""
add num.(Not change)
"""
rec10d.rec10db.add_num_in_auto_bayes_key(chtxt, recaddnum,alladdnum)
-def change_db_ratio_rec(key,chtxt,beforenum,addnum):
+def changeDBRatioRec(key,chtxt,beforenum,addnum):
rec10d.rec10db.change_ratio_rec_in_auto_bayes_key(key, chtxt, beforenum, addnum)
-def change_db_ratio_rec_many(chtxt,beforenum,list):
+def changeDBRatioMultiRec(chtxt,beforenum,list):
rec10d.rec10db.change_multi_ratio_rec_in_auto_bayes_key(chtxt, beforenum, list)
-def change_db_reduce_ratio_rec(chtxt,beforenum,addnum):
+def changeDBReduceRatioRec(chtxt,beforenum,addnum):
rec10d.rec10db.change_ratio_rec_reduce_in_auto_bayes_key(chtxt, beforenum, addnum)
-def change_db_ratio_all(key,chtxt,beforenum,addnum):
+def changeDBRatioAll(key,chtxt,beforenum,addnum):
rec10d.rec10db.change_ratio_all_in_auto_bayes_key(key, chtxt, beforenum, addnum)
-def change_db_ratio_all_many(chtxt,beforenum,list):
+def changeDBRatioMultiAll(chtxt,beforenum,list):
rec10d.rec10db.change_multi_ratio_all_in_auto_bayes_key(chtxt,beforenum, list)
-def get_db_num(chtxt):
- ret=get_db_key("NUM", chtxt)
+def getDBNum(chtxt):
+ ret=getDBKey("NUM", chtxt)
if len(ret)<3:
rec10d.rec10db.add_in_auto_bayes_key("NUM", chtxt, 1,1)
- ret=get_db_key("NUM", chtxt)
+ ret=getDBKey("NUM", chtxt)
return ret
-def update_recall(chtxt,titles,descs,newnum):
+def updateRecall(chtxt,titles,descs,newnum):
"""
update recall
"""
titles=" "+titles+" "
descs=" "+descs+" "
str1=titles*2+descs+titles*2
- noun=n_gram.get_noun_quad_gram(str1)
- bnum=get_db_num(chtxt)[3]
+ noun=n_gram.getNounQuadGram(str1)
+ bnum=getDBNum(chtxt)[3]
if bnum<1:
bnum=100
- change_db_ratio_all_many(chtxt, bnum,noun)
- change_db_epg(chtxt, bnum, newnum)
- change_db_num(chtxt, 0, newnum)
-def add_key(chtxt,title,desc):
+ changeDBRatioMultiAll(chtxt, bnum,noun)
+ changeDBEpg(chtxt, bnum, newnum)
+ changeDBNum(chtxt, 0, newnum)
+def addKey(chtxt,title,desc):
title=u" "+title+u" "
desc=u" "+desc+u" "
str1=title*2+desc+title*2##タイトルは重視したいので幾度か足す。
- noun=n_gram.get_noun_quad_gram(str1)#nounは辞書のキーに文字を、中身に出現回数を書いたもの。
- bnum=get_db_num(chtxt)[2]
+ noun=n_gram.getNounQuadGram(str1)#nounは辞書のキーに文字を、中身に出現回数を書いたもの。
+ bnum=getDBNum(chtxt)[2]
if bnum<1:
bnum=1
- change_db_ratio_rec_many(chtxt, bnum, noun)
- change_db_num(chtxt,1,0)
- change_db_reduce_ratio_rec(chtxt, bnum,1)
-def calc_key(chtxt,title,desc):
+ changeDBRatioMultiRec(chtxt, bnum, noun)
+ changeDBNum(chtxt,1,0)
+ changeDBReduceRatioRec(chtxt, bnum,1)
+def calcKey(chtxt,title,desc):
"""
"""
title=u" "+title+u" "
desc=u" "+desc+u" "
str1=title*2+desc+title*2##タイトルは重視したいので幾度か足す。
- noun=n_gram.get_noun_quad_gram(str1)#nounは辞書のキーに文字を、中身に出現回数を書いたもの。
+ noun=n_gram.getNounQuadGram(str1)#nounは辞書のキーに文字を、中身に出現回数を書いたもの。
tnum=1
nump=0
for key,num in noun.items():
- pp=get_db_key(key,chtxt)
- pp2=get_db_key(key,"ALL")
+ pp=getDBKey(key,chtxt)
+ pp2=getDBKey(key,"ALL")
if len(pp)>3:
tarec=0
taall=0
import chdb
import tv2mp4
import tv2ts
-def test_all_ch_encode(option,stime):
- chl=chdb.getall()
+def testAllCHEncode(option,stime):
+ chl=chdb.getAll()
print chl
- path= configreader.getpath("test")
+ path= configreader.getPathSetting("test")
tpath=os.path.join(path, "encode_test")
if not os.path.exists(tpath):
os.mkdir(tpath)
(opts,args)=parser.parse_args(sys.argv)
if opts.encode_option != "":##-sの場合
print "test_all_ch_encode"
- test_all_ch_encode(opts.encode_option, "10")
\ No newline at end of file
+ testAllCHEncode(opts.encode_option, "10")
\ No newline at end of file
path = str(os.path.dirname(os.path.abspath(__file__))) + "/"
-def chadd(bctype, chtxt, ch, csch):#すべて文字列
+def chAdd(bctype, chtxt, ch, csch):#すべて文字列
rec10d.rec10db.add_epg_ch(bctype,chtxt, ch, csch, u"2010-01-01 00:00:00")
-def chlistadd(cl):
+def addCHlist(cl):
if len(cl)>0:
for c in cl:
- chadd(c[0],c[1],c[2],c[3])
-def new_chdata(bs,cs):
+ chAdd(c[0],c[1],c[2],c[3])
+def newCHdata(bs,cs):
rec10d.rec10db.new_epg_ch()
- chlistadd(getChList(os.path.join(path,"chlist.xml")))
+ addCHlist(getCHlist(os.path.join(path,"chlist.xml")))
if bs==1:
#bs放送の設定 全国共通のはず
- chlistadd(getChList(os.path.join(path,"chlist_bs.xml")))
+ addCHlist(getCHlist(os.path.join(path,"chlist_bs.xml")))
if cs==1:
#CS放送(スカパーe2)主に基本パックに入ってるものを中心に
- chlistadd(getChList(os.path.join(path,"chlist_cs.xml")))
-def new_chdata_all():
+ addCHlist(getCHlist(os.path.join(path,"chlist_cs.xml")))
+def newAllCHdata():
bs=0
cs=0
try:
- bs=int(configreader.getenv("bs"))
- cs=int(configreader.getenv("cs"))
+ bs=int(configreader.getEnvSetting("bs"))
+ cs=int(configreader.getEnvSetting("cs"))
except:
""
- new_chdata(bs,cs)
-def getChList(xmlpath):
+ newCHdata(bs,cs)
+def getCHlist(xmlpath):
dom=xml.dom.minidom.parse(file(xmlpath))
chlist=[]
for ch in dom.getElementsByTagName('channel'):
chlist.append([bctype,ontv,chtxt,chd,csch])
return chlist
if __name__ == "__main__":
- new_chdata_all()
\ No newline at end of file
+ newAllCHdata()
\ No newline at end of file
# モジュール属性 argv を取得するため
import rec10d
-def chtxtsearch(chtxtin):
+def searchFromCHtxt(chtxtin):
chtxtt=chtxtin.replace("_0","_%")
ret = []
for datum in rec10d.rec10db.select_by_chtxt_epg_ch(chtxtt):
if len(ret) == 0:
ret.append(None)
return ret[0]
-def bctypesearch(bctypein):
+def getChCSchFromCHtxt(chtxt):
+ ret = {'csch':chtxt.split("_")[1],'ch':chtxt.split("_")[0]}
+ return ret
+def searchFromBctype(bctypein):
ret = []
for datum in rec10d.rec10db.select_by_bctype_epg_ch(bctypein):
rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4]}
if len(ret) == 0:
ret.append(None)
return ret[0]
-def chsearch(chin):
+def searchFromCH(chin):
ret = []
for datum in rec10d.rec10db.select_by_ch_epg_ch(chin):
rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4]}
if len(ret) == 0:
ret.append(None)
return ret[0]
-def getall():
+def getAll():
ret = []
for datum in rec10d.rec10db.select_all_epg_ch():
rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4]}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<rec10_ch>\r
- <channel bctype="bs" ch="101" csch="0" chtxt="bs-nhk-1" ontvcode="3001.ontvjapan.com"/>\r
- <channel bctype="bs" ch="102" csch="0" chtxt="bs-nhk-2" ontvcode="3002.ontvjapan.com"/>\r
- <channel bctype="bs" ch="103" csch="0" chtxt="bs-nhk-hi" ontvcode="3003.ontvjapan.com"/>\r
- <channel bctype="bs" ch="141" csch="0" chtxt="bs-nittere" ontvcode="3004.ontvjapan.com"/>\r
- <channel bctype="bs" ch="151" csch="0" chtxt="bs-asahi" ontvcode="3005.ontvjapan.com"/>\r
- <channel bctype="bs" ch="161" csch="0" chtxt="bs-tbs" ontvcode="3006.ontvjapan.com"/>\r
- <channel bctype="bs" ch="171" csch="0" chtxt="bs-japan" ontvcode="3007.ontvjapan.com"/>\r
- <channel bctype="bs" ch="181" csch="0" chtxt="bs-fuji" ontvcode="3008.ontvjapan.com"/>\r
- <channel bctype="bs" ch="211" csch="0" chtxt="bs-11" ontvcode="3013.ontvjapan.com"/>\r
-</rec10_ch>\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<rec10_ch>\r
- <!--\r
- bctypeのcs1,cs2は放送の衛星ごとに変えてください。\r
- 番組表データがそれぞれの衛星チャンネルのものしか含まれないためです。\r
- -->\r
- <!--標準のパックに入ったもの-->\r
- <!--映画-->\r
- <channel bctype="cs2" ch="CS6" csch="223" chtxt="neco" ontvcode="1008.ontvjapan.com"/>\r
- <channel bctype="cs2" ch="CS6" csch="224" chtxt="yo-ga" ontvcode="1009.ontvjapan.com"/>\r
- <channel bctype="cs1" ch="CS10" csch="228" chtxt="thecinema" ontvcode="1217.ontvjapan.com"/>\r
- <channel bctype="cs1" ch="CS2" csch="239" chtxt="nihoneiga" ontvcode="1086.ontvjapan.com"/>\r
- <channel bctype="cs2" ch="CS18" csch="240" chtxt="movieplus" ontvcode="1007.ontvjapan.com"/>\r
- <!--スポーツ-->\r
- <!--音楽-->\r
- <!--バラエティ-->\r
- <channel bctype="cs2" ch="CS22" csch="293" chtxt="family" ontvcode="1015.ontvjapan.com"/>\r
- <!--総合エンターテインメント-->\r
- <!--<channel bctype="cs2" ch="CS24" csch="300" chtxt="nittereplus" ontvcode="300ch.ontvjapan.com"/>-->\r
- <channel bctype="cs2" ch="CS22" csch="301" chtxt="tbsch" ontvcode="3201.ontvjapan.com"/>\r
- <channel bctype="cs2" ch="CS12" csch="303" chtxt="tereasa" ontvcode="1092.ontvjapan.com"/>\r
- <!--<channel bctype="cs2" ch="CS16" csch="305" chtxt="ginga" ontvcode="305ch.ontvjapan.com"/>-->\r
- <channel bctype="cs2" ch="CS20" csch="307" chtxt="fuji-one" ontvcode="1073.ontvjapan.com"/>\r
- <channel bctype="cs2" ch="CS20" csch="308" chtxt="fuji-two" ontvcode="1072.ontvjapan.com"/>\r
- <!--海外ドラマ-->\r
- <channel bctype="cs2" ch="CS6" csch="311" chtxt="axn" ontvcode="1014.ontvjapan.com"/>\r
- <channel bctype="cs2" ch="CS4" csch="312" chtxt="fox" ontvcode="1016.ontvjapan.com"/>\r
- <!--アニメ-->\r
- <channel bctype="cs1" ch="CS8" csch="335" chtxt="kidshd" ontvcode="335ch.ontvjapan.com"/>\r
- <channel bctype="cs2" ch="CS20" csch="332" chtxt="animax" ontvcode="1047.ontvjapan.com"/>\r
- <channel bctype="cs2" ch="CS4" csch="334" chtxt="disney" ontvcode="1213.ontvjapan.com"/>\r
- <!--ドキュメンタリー-->\r
- <channel bctype="cs2" ch="CS20" csch="340" chtxt="disch" ontvcode="1062.ontvjapan.com"/>\r
- <channel bctype="cs2" ch="CS20" csch="341" chtxt="anipla" ontvcode="1193.ontvjapan.com"/>\r
- <channel bctype="cs2" ch="CS16" csch="342" chtxt="hisch" ontvcode="1050.ontvjapan.com"/>\r
- <channel bctype="cs2" ch="CS6" csch="343" chtxt="natiogeo" ontvcode="1204.ontvjapan.com"/>\r
- <!--ニュース-->\r
- <channel bctype="cs2" ch="CS12" csch="353" chtxt="bbc" ontvcode="1070.ontvjapan.com"/>\r
- <channel bctype="cs2" ch="CS12" csch="354" chtxt="cnn" ontvcode="1069.ontvjapan.com"/>\r
- <!--趣味-->\r
- <!--その他-->\r
- <channel bctype="cs1" ch="CS10" csch="800" chtxt="ch800" ontvcode="800ch.epgdata.ontvjapan"/>\r
- <channel bctype="cs1" ch="CS10" csch="801" chtxt="ch801" ontvcode="801ch.epgdata.ontvjapan"/>\r
- <channel bctype="cs1" ch="CS10" csch="802" chtxt="ch802" ontvcode="802ch.epgdata.ontvjapan"/>\r
- <!--\r
- <channel bctype="cs2" ch="CS16" csch="333" chtxt="atx" ontvcode="1201.ontvjapan.com"/>\r
- -->\r
-</rec10_ch>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<rec10_ch>\r
- <channel bctype="te13" ch="13" csch="0" chtxt="nhk-k" ontvcode="0502.ontvjapan.com"/>\r
- <channel bctype="te14" ch="14" csch="0" chtxt="yomiuri" ontvcode="0507.ontvjapan.com"/>\r
- <channel bctype="te15" ch="15" csch="0" chtxt="abc" ontvcode="0505.ontvjapan.com"/>\r
- <channel bctype="te16" ch="16" csch="0" chtxt="mbs" ontvcode="0504.ontvjapan.com"/>\r
- <channel bctype="te17" ch="17" csch="0" chtxt="kansai" ontvcode="0506.ontvjapan.com"/>\r
- <channel bctype="te18" ch="18" csch="0" chtxt="tv-osaka" ontvcode="0513.ontvjapan.com"/>\r
- <channel bctype="te22" ch="22" csch="0" chtxt="nhk-s" ontvcode="0501.ontvjapan.com"/>\r
- <channel bctype="te26" ch="26" csch="0" chtxt="sun-tv" ontvcode="0509.ontvjapan.com"/>\r
-</rec10_ch>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<rec10_ch>\r
- <channel bctype="te13" ch="13" csch="0" chtxt="nhk-k" ontvcode="0442.ontvjapan.com"/>\r
- <channel bctype="te20" ch="20" csch="0" chtxt="nhk-s" ontvcode="0432.ontvjapan.com"/>\r
- <channel bctype="te22" ch="22" csch="0" chtxt="me-tere" ontvcode="0404.ontvjapan.com"/>\r
- <channel bctype="te18" ch="18" csch="0" chtxt="cbc" ontvcode="0405.ontvjapan.com"/>\r
- <channel bctype="te21" ch="21" csch="0" chtxt="toukai" ontvcode="0406.ontvjapan.com"/>\r
- <channel bctype="te19" ch="19" csch="0" chtxt="chukyo" ontvcode="0407.ontvjapan.com"/>\r
- <channel bctype="te23" ch="23" csch="0" chtxt="aichi" ontvcode="0420.ontvjapan.com"/>\r
- <channel bctype="te27" ch="27" csch="0" chtxt="mie" ontvcode="0417.ontvjapan.com"/>\r
-</rec10_ch>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<rec10_ch>\r
- <channel bctype="te27" ch="27" csch="0" chtxt="nhk-s" ontvcode="0031.ontvjapan.com"/>\r
- <channel bctype="te26" ch="26" csch="0" chtxt="nhk-k" ontvcode="0041.ontvjapan.com"/>\r
- <channel bctype="te25" ch="25" csch="0" chtxt="nittere" ontvcode="0004.ontvjapan.com"/>\r
- <channel bctype="te22" ch="22" csch="0" chtxt="tbs" ontvcode="0005.ontvjapan.com"/>\r
- <channel bctype="te21" ch="21" csch="0" chtxt="fuji" ontvcode="0006.ontvjapan.com"/>\r
- <channel bctype="te24" ch="24" csch="0" chtxt="asahi" ontvcode="0007.ontvjapan.com"/>\r
- <channel bctype="te23" ch="23" csch="0" chtxt="tokyo" ontvcode="0008.ontvjapan.com"/>\r
- <!--<channel bctype="te" ch="" csch="0" chtxt="tvk" ontvcode="0009.ontvjapan.com"/>\r
- <channel bctype="te" ch="" csch="0" chtxt="chiba" ontvcode="0010.ontvjapan.com"/>\r
- <channel bctype="te" ch="" csch="0" chtxt="gunma" ontvcode="0011.ontvjapan.com"/>\r
- <channel bctype="te" ch="" csch="0" chtxt="tama" ontvcode="0012.ontvjapan.com"/>-->\r
- <channel bctype="tehu" ch="28" csch="1088" chtxt="housou1" ontvcode="0013a.ontvjapan.com"/>\r
- <channel bctype="tehu" ch="28" csch="1089" chtxt="housou2" ontvcode="0013b.ontvjapan.com"/>\r
- <channel bctype="tehu" ch="28" csch="1090" chtxt="housou3" ontvcode="0013c.ontvjapan.com"/>\r
- <channel bctype="te20" ch="20" csch="0" chtxt="mxtv" ontvcode="0016.ontvjapan.com"/>\r
- <!--<channel bctype="te" ch="" csch="0" chtxt="tochigi" ontvcode="0018.ontvjapan.com"/>-->\r
-</rec10_ch>
\ No newline at end of file
auto_move.execMove(t, recpath, recordedpath,".mkv",1)
else:
recdblist.printutf8(t+" can't find matching folder",verbose_level=100)
- sa=auto_move.search_file(recpath, recordedpath, ".mp4")
+ sa=auto_move.searchFile(recpath, recordedpath, ".mp4")
for t in sa:
recdblist.printutf8(u"自動推測実行中-MP4",verbose_level=100)
sf=guess.searchFolder(t,recordedpath)
sa=auto_move.search_file(recpath, recordedpath,".mkv")
for t in sa:
auto_move.execDelete(t, recpath)
- sa=auto_move.search_file(recpath, recordedpath,".mp4")
+ sa=auto_move.searchFile(recpath, recordedpath,".mp4")
for t in sa:
auto_move.execDelete(t, recpath)
elif opts.list:##-lの場合
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"),verbose_level=100)
- sa=auto_move.search_file(recpath, recordedpath,".mp4")
+ sa=auto_move.searchFile(recpath, recordedpath,".mp4")
for t in sa:
sf=guess.searchFolder(t,recordedpath)
if sf!="":
except:
""
if tsmovepath!="":
- sa=auto_move.search_file(recpath, tsmovepath,".ts")
+ sa=auto_move.searchFile(recpath, tsmovepath,".ts")
for t in sa:
sf=guess.searchFolder(t,tsmovepath,700)
if sf!="":
recdblist.printutf8(t+u" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".ts")+".ts"))
print "\n"
- sa=auto_move.search_file(recpath, tsmovepath,".ts")
+ sa=auto_move.searchFile(recpath, tsmovepath,".ts")
else:
recdblist.printutf8(u"ts_movepathが設定されていません。/etc/rec10.confを設定してください。",verbose_level=100)
elif opts.tsmove:##-Tの場合
""
if tsmovepath!="":
sa=auto_move.search_file(recpath, tsmovepath,".ts")
- for t in sa:
+ searchFilein sa:
sf=guess.searchFolder(t,tsmovepath,700)
if sf!="":
recdblist.printutf8(u"移動先",verbose_level=100)
recdblist.printutf8(sstitle+" "+str(maxt))
else:
recdblist.printutf8(u"**"+sstitle+" |"+str(maxt)+"| "+nuke)
-
-
elif os.path.exists(os.path.join("/etc/rec10","rec10.conf")):
confpath=os.path.join("/etc/rec10","rec10.conf")
confp.read(confpath)
-def getpath(string):
+def getPathSetting(string):
global confp
return confp.get('path', string)
-def getdbpath(string):
+def getDBPathSetting(string):
global confp
return confp.get('db', string)
-def getenv(string):
+def getEnvSetting(string):
global confp
return confp.get('env', string)
-def getlog(string):
+def getLogSetting(string):
global confp
return confp.get('log', string)
Conf = 'rec10.conf'
confpath=os.path.join(mypath,Conf)
confp.read(confpath)
-def getpath(string):
+def getPathSetting(string):
global confp
return confp.get('path', string)
-def getdbpath(string):
+def getDBPathSetting(string):
global confp
return confp.get('db', string)
-def getenv(string):
+def getEnvSetting(string):
global confp
return confp.get('env', string)
-def setpath(option,value):
+def setPath(option,value):
global confp
return confp.set('path',option,value)
-def setdbpath(option,value):
+def setDBPath(option,value):
global confp
return confp.set('db',option,value)
-def setenv(option,value):
+def setEnv(option,value):
global confp
return confp.set('env',option,value)
-def writeconf():
+def writeConf():
global confp
f=open(confpath,"w")
confp.write(f)
con.close()
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "init (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "init (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
db = self.connect_db()
try:
db[1].execute('\
)')
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "init (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "init (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
self.new_epg_timeline("")
self.new_in_timeline_log()
db[1].execute('drop table epg_ch')
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and (inst[0]==1050 or inst[0]==1051))):
- recdblist.Commonlogex("Error", "new_epg_ch drop (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "new_epg_ch drop (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
try:
db[1].execute('\
)')
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "new_epg_ch (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "new_epg_ch (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def add_epg_ch(self, bctype, chtxt, ch, csch, updatetime):
db[1].execute('drop table auto_proc_tmp')
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and (inst[0]==1050 or inst[0]==1051))):
- recdblist.Commonlogex("Error", "new_auto_proc_tmp drop (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "new_auto_proc_tmp drop (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
try:
db[1].execute('\
)')
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "new_auto_proc_tmp (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "new_auto_proc_tmp (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def update_auto_proc(self):
db[1].execute('INSERT INTO auto_proc SELECT * FROM auto_proc_tmp')
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "update_auto_proc (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "update_auto_proc (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def new_auto_proc(self):
db[1].execute('drop table auto_proc')
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and (inst[0]==1050 or inst[0]==1051))):
- recdblist.Commonlogex("Error", "new_auto_proc drop (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "new_auto_proc drop (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
try:
db[1].execute('\
)')
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "new_auto_proc (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "new_auto_proc (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def add_auto_proc(self,type,title,chtxt):
db[1].execute('drop table in_settings')
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and (inst[0]==1050 or inst[0]==1051))):
- recdblist.Commonlogex("Error", "drop_in_settings (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "drop_in_settings (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def new_in_settings(self):
db = self.connect_db()
db[1].execute("INSERT IGNORE into in_settings VALUE (0,0,\"H\",1)")
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "new_in_settings (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "new_in_settings (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def select_all_in_settings(self):
)')
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "new_in_timeline_log (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "new_in_timeline_log (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def select_chtxt_by_title_timeline_log(self,title):
)")
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "new_in_auto_jbk_key (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "new_in_auto_jbk_key (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def add_in_auto_jbk_key(self,key):
db = self.connect_db()
db[1].execute('drop table in_status')
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and (inst[0]==1050 or inst[0]==1051))):
- recdblist.Commonlogex("Error", "drop_in_status (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "drop_in_status (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def new_in_status(self):
db = self.connect_db()
db[1].execute("INSERT IGNORE into in_status VALUE (0,0,0,0,0,0)")
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "new_in_status (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "new_in_status (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def select_all_in_status(self):
db = self.connect_db()
version=int(str(r[0]))
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "select_version_in_status (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "select_version_in_status (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
return version
def change_version_in_status(self,version):
db = self.connect_db()
(bctype,))
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and (inst[0]==1007 or inst[0]==1146))or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "new_epg_timeline delete (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "new_epg_timeline delete (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
try:
db[1].execute("\
CREATE TABLE epg_timeline \
)")
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "new_epg_timeline (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "new_epg_timeline (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
#db.commit()
self.close_db(db)
def add_epg_timeline(self, bctype, channel, start, stop, title, desc,longdesc, category):
db[1].execute('CREATE INDEX keycharindex ON in_auto_bayes_key(keychar)')
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "new_in_auto_bayes_key (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "new_in_auto_bayes_key (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def add_in_auto_bayes_key(self,key,chtxt,ratio_rec,ratio_all):
ratio_all=CONVERT((ratio_all*%s+%s)/%s,DECIMAL(32,14))",retl)
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "change_multi_ratio_all_in_auto_bayes_key (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "change_multi_ratio_all_in_auto_bayes_key (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def change_ratio_rec_reduce_in_auto_bayes_key(self,chtxt,beforenum,newnum):
beforenum=str(beforenum)
ratio_rec=CONVERT((ratio_rec*%s+%s)/%s,DECIMAL(32,14))",retl)
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "change_multi_ratio_rec_in_auto_bayes_key (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "change_multi_ratio_rec_in_auto_bayes_key (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def select_by_key_in_auto_bayes_key(self,key,chtxt):
db = self.connect_db()
)')
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "new_auto_timeline_keyword (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "new_auto_timeline_keyword (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
def add_auto_timeline_keyword(self,chtxt="", title="", btime="", etime=""):
db = self.connect_db()
db[1].execute('\
)')
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
- recdblist.Commonlogex("Error", "new_auto_timeline_bayes (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "new_auto_timeline_bayes (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
def add_auto_timeline_bayes(self,chtxt="", title="", btime="", etime="",point=""):
db = self.connect_db()
db[1].execute('\
db[1].execute("\
UPDATE timeline INNER JOIN epg_ch ON timeline.chtxt=epg_ch.chtxt SET timeline.chtxt=CONCAT(CONCAT(epg_ch.ch,'_'),epg_ch.csch)")
db[1].execute("\
- UPDATE timeline INNER JOIN epg_ch ON timeline.chtxt=epg_ch.chtxt SET timeline.chtxt=CONCAT('CS_',epg_ch.csch) where timeline.chtxt LIKE 'CS%'")
- db[1].execute("\
ALTER TABLE epg_ch DROP ontv")
db[1].execute("\
ALTER TABLE in_auto_jbk_key ADD auto TINYINT DEFAULT 0")
import configreader
import recdblist
path = str(os.path.dirname(os.path.abspath(__file__))) + "/"
-tmppath = configreader.getpath("tmp")+"/"
+tmppath = configreader.getPathSetting("tmp")+"/"
if tmppath=="/":
tmppath=path
def update(chtxt):
recdblist.printutf8(chtxt)
tnow = datetime.datetime.now()
try:
- lastup = datetime.datetime.strptime(chdb.chtxtsearch(chtxt)[0]['update'], "%Y-%m-%d %H:%M:%S")
+ lastup = datetime.datetime.strptime(chdb.searchFromCHtxt(chtxt)[0]['update'], "%Y-%m-%d %H:%M:%S")
except:
lastup = datetime.datetime.strptime("2009-04-01 00:00:00", "%Y-%m-%d %H:%M:%S")
dt = tnow-lastup
dt = dt.days * 24 * 60 + dt.seconds
if dt > 2 * 60 * 60:
- ts2epg.write(os.path.join(tmppath, chtxt + "epgdata.xml"), chdb.chtxtsearch(chtxt)['ch'])
- xml2db_dom.xml2db_dom(os.path.join(tmppath, chtxt + "epgdata.xml"), chdb.chtxtsearch(chtxt)['bctype'])
-def updatebc(bctype):
- bctypel = chdb.bctypesearch(bctype)
+ ts2epg.write(os.path.join(tmppath, chtxt + "epgdata.xml"), chdb.getChCSchFromCHtxt(chtxt)['ch'])
+ xml2db_dom.xml2db_dom(os.path.join(tmppath, chtxt + "epgdata.xml"), chdb.searchFromCHtxt(chtxt)['bctype'])
+def updateForBctype(bctype):
+ bctypel = chdb.searchFromBctype(bctype)
#print bctype
try:
- ts2epg.write(tmppath + bctype + "epgdata.xml", chdb.bctypesearch(bctype)['ch'])
+ ts2epg.write(tmppath + bctype + "epgdata.xml", chdb.searchFromBctype(bctype)['ch'])
xml2db_dom.xml2db_dom(tmppath + bctype + "epgdata.xml", bctype)
shutil.copyfile(tmppath + bctype + "epgdata.xml", tmppath + bctype + "epgdata.bak.xml")
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)+"\n"+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error","updatebc(epgdb.py)", str(type(inst)), str(inst)+"\n"+traceback.format_exc(),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):
- """
- update epg data by .bak file
- """
- xml2db_dom.xml2db_dom(tmppath + bctype + "epgdata.bak.xml", bctype)
-def searchtime2(titletxt, timet, deltatime, chtxt):
+def searchTime(titletxt, timet, deltatime, chtxt):
time = datetime.datetime.strptime(timet, "%Y-%m-%d %H:%M:%S")
ret = []
deltatime = int(deltatime)
ret = one
#print ret
return ret
-def searchtime_auto(keytxt, timet, deltatime):
+def searchTimeAuto(keytxt, timet, deltatime):
time = datetime.datetime.strptime(timet, "%Y-%m-%d %H:%M:%S")
ret = []
deltatime = int(deltatime)
etime = etime[0:4] + "-" + etime[4:6] + "-" + etime[6:8] + " " + etime[8:10] + ":" + etime[10:12] + ":00"
ret.append([chtxtt, title, btime, etime,exp,longexp,category])
return ret
-def count_schedule(btime,etime):
+def countSchedule(btime,etime):
"""
return rec num (int return[0]:TE /int return[1]:BS/CS)
"""
retcount[1] = ret1[1]
return retcount
-def search_schedule(btime,etime):
+def searchSchedule(btime,etime):
"""
return rec num (int return[0]:TE /int return[1]:BS/CS)
"""
ret = list(set(ret))
return ret
-def count_epgschedule(epgbtime,epgetime):
+def countEpgSchedule(epgbtime,epgetime):
"""
return rec num (int return[0]:TE /int return[1]:BS/CS)
"""
if retcount[1] < ret1[1]:
retcount[1] = ret1[1]
return retcount
-def search_epgschedule(epgbtime,epgetime):
+def searchEpgSchedule(epgbtime,epgetime):
"""
return rec num (int return[0]:TE /int return[1]:BS/CS)
"""
recdblist.printutf8(u"おめでとうございます 初期設定は完了しました。",verbose_level=100)
recdblist.printutf8(u"rec10を実行するユーザーのcrontabに"+os.path.join(path,"rec10")+u"を追加してください(5分周期が目安)",verbose_level=100)
-def getpath(cmd):
+def getLocalPath(cmd):
printutf8(cmd+u"の場所を確認中")
txt=commands.getoutput(u"which "+cmd)
if len(txt.split(" "))>3:
printutf8(u"rec10 ver "+recdblist.version_str+" installer.")
printutf8(u"rec10のインストールを開始します。")
maxn=16
- configwriter.setpath(u"wine", getpath(u"wine"))
- configwriter.setpath(u"recpt1", getpath(u"recpt1"))
+ configwriter.setPath(u"wine", getLocalPath(u"wine"))
+ configwriter.setPath(u"recpt1", getLocalPath(u"recpt1"))
#configwriter.setpath(u"x264", getpath(u"x264"))
- configwriter.setpath(u"mp4box", getpath(u"MP4Box"))
- configwriter.setpath(u"mencoder", getpath(u"mencoder"))
- configwriter.setpath(u"ffmpeg", getpath(u"ffmpeg"))
- configwriter.setpath(u"mkvmerge", getpath(u"mkvmerge"))
- configwriter.setpath(u"b25", getpath(u"b25"))
+ configwriter.setPath(u"mp4box", getLocalPath(u"MP4Box"))
+ configwriter.setPath(u"mencoder", getLocalPath(u"mencoder"))
+ configwriter.setPath(u"ffmpeg", getLocalPath(u"ffmpeg"))
+ configwriter.setPath(u"mkvmerge", getLocalPath(u"mkvmerge"))
+ configwriter.setPath(u"b25", getLocalPath(u"b25"))
printutf8(u"必須環境の設定が完了しました")
printutf8(u"個人設定に入ります")
if os.path.exists("/etc/rec10.conf"):
printutf8(u"rec10の録画ファイルが置かれる場所を入力してください(1/"+str(maxn)+")")
printutf8(u"100GB程度は確保されている必要があります")
recpath=getConf(useB,"/etc/rec10.conf","path","recpath","path : ")
- configwriter.setpath(u"recpath",recpath)
+ configwriter.setPath(u"recpath",recpath)
printutf8(u"DBの設定に入ります。")
printutf8(u"rec10が使用するMySQLのユーザーを設定してください。(2/"+str(maxn)+")")
mysql_user=getConf(useB,"/etc/rec10.conf","db","mysql_user","mysql_user : ")
- configwriter.setdbpath("mysql_user", mysql_user)
+ configwriter.setDBPath("mysql_user", mysql_user)
printutf8(u"パスワードを設定してください(3/"+str(maxn)+")")
mysql_passwd=getConf(useB,"/etc/rec10.conf","db","mysql_passwd","mysql_passwd : ")
- configwriter.setdbpath("mysql_passwd", mysql_passwd)
+ configwriter.setDBPath("mysql_passwd", mysql_passwd)
printutf8(u"同時録画可能数の設定に入ります")
printutf8(u"TE(地デジ)録画可能数(PT*だと2 白Friioだと1)(4/"+str(maxn)+")")
te_max=str(int(getConf(useB,"/etc/rec10.conf","env","te_max","te_max : ")))
- configwriter.setenv("te_max", te_max)
+ configwriter.setEnv("te_max", te_max)
printutf8(u"BS/CS110録画可能数(PT*だと2 黒Friioだと1)(5/"+str(maxn)+")")
bscs_max=str(int(getConf(useB,"/etc/rec10.conf","env","bscs_max","bscs_max : ")))
- configwriter.setenv("bscs_max", bscs_max)
+ configwriter.setEnv("bscs_max", bscs_max)
printutf8(u"同時エンコード最大数を設定してください(6/"+str(maxn)+")")
printutf8(u"CPUのコア数が目安です")
enc_max=raw_input("[2]:")
enc_max="2"
else:
enc_max=str(int(enc_max))
- configwriter.setenv("enc_max", enc_max)
+ configwriter.setEnv("enc_max", enc_max)
printutf8(u"二カ国語放送/5.1ch放送の音声変換の設定です。\nNeroAACエンコーダーを使用しますか?(NeroAACEncを別途入手してtstoolsに入れてください。))")
printutf8(u"入手先:http://www.nero.com/jpn/technologies-aac-codec.html\n (7/"+str(maxn)+")")
audioenc=raw_input("[y/N]: ")
if audioenc=="y" or audioenc=="Y":
- configwriter.setpath("useNeroAAC", "1")
+ configwriter.setPath("useNeroAAC", "1")
printutf8(u"NeroAACEncのパスを指定してください")
aacpath=getConf(useB,"/etc/rec10.conf","path","NeroAAC","[/usr/local/bin/neroAacEnc] : ")
if aacpath.replace(" ","")=="":
aacpath="/usr/local/bin/neroAacEnc"
configwriter.setpath("NeroAAC",aacpath)
else:
- configwriter.setpath("useNeroAAC", "0")
+ configwriter.setPath("useNeroAAC", "0")
printutf8(u"lameを使用します。")
printutf8(u"x264のパスを指定してください(7/"+str(maxn)+")")
x264path=getConf(useB,"/etc/rec10.conf","path","x264","x264 path : ")
if x264path.replace(" ","")=="" or not os.path.isfile(x264path):
- x264path=getpath(u"x264")
- configwriter.setpath("x264",x264path)
+ x264path=getLocalPath(u"x264")
+ configwriter.setPath("x264",x264path)
printutf8(u"保存する画質を教えてください(8/"+str(maxn)+")")
printutf8(u"x264のcrfの値です。標準だと30分で800MBほどになります")
crf=getConf(useB,"/etc/rec10.conf","env","crf","[24] : ")
if crf.replace(" ","")=="":
crf="24"
- configwriter.setenv("crf", crf)
+ configwriter.setEnv("crf", crf)
printutf8(u"アニメーションを保存する画質を教えてください(9/"+str(maxn)+")")
printutf8(u"x264のcrfの値です。標準だと30分で800MBほどになります")
a_crf=getConf(useB,"/etc/rec10.conf","env","animation_crf","[20] : ")
if a_crf.replace(" ","")=="":
a_crf="20"
- configwriter.setenv("animation_crf", a_crf)
+ configwriter.setEnv("animation_crf", a_crf)
printutf8(u"x264の圧縮率を設定してください(10/"+str(maxn)+")")
printutf8(u"x264のpresetの値です。標準だとmedium、小さければ小さいほど高圧縮になります")
preset=getConf(useB,"/etc/rec10.conf","env","x264_preset","[4] : ")
if preset.replace(" ","")=="":
preset="4"
- configwriter.setenv("x264_preset", preset)
+ configwriter.setEnv("x264_preset", preset)
printutf8(u"保存するコンテナの設定(11/"+str(maxn)+")")
printutf8(u"MP4を標準にしますか(もしくはMKVが使えます)")
useMP4=raw_input("[y/N]:")
useMP4="1"
else:
useMP4="0"
- configwriter.setenv("make_mp4", useMP4)
+ configwriter.setEnv("make_mp4", useMP4)
printutf8(u"TSファイルの自動削除(12/"+str(maxn)+")")
printutf8(u"中間体のtsファイルを削除しますか")
printutf8(u"(削除するとやり直しができないため残しておくことを推奨します。)")
removeTS="1"
else:
removeTS="0"
- configwriter.setenv("remove_ts", removeTS)
+ configwriter.setEnv("remove_ts", removeTS)
printutf8(u"チャンネルの設定に入ります(13/"+str(maxn)+")")
printutf8(u"rec10を設置する地域を選んでください。")
printutf8(u"1:東京 2:神戸 3:名古屋 4:その他")
bsok="1"
else:
bsok="0"
- configwriter.setenv("bs", bsok)
+ configwriter.setEnv("bs", bsok)
printutf8(u"CS放送(スカパーe2)は受信可能ですか?(15/"+str(maxn)+")")
csok=raw_input("y/N:")
if csok=="Y" or csok == "y" :
printutf8(u"標準パックの番組は入力してありますがそれ以外は追加でchlist_cs.xmlに追加する必要があります。")
else:
csok="0"
- configwriter.setenv("cs", csok)
+ configwriter.setEnv("cs", csok)
printutf8(u"自機識別オプション(16/"+str(maxn)+")")
printutf8(u"本rec10の識別名を入力してください")
printutf8(u"複数台のrec10を運用する場合に効果的です。空白でもかまいません。")
printutf8(u"例 kobe01")
iff=getConf(useB,"/etc/rec10.conf","env","iff","[] : ")
- configwriter.setenv("iff", iff)
+ configwriter.setEnv("iff", iff)
confp = ConfigParser.SafeConfigParser()
confp.read("/etc/rec10.conf")
if useB:
- configwriter.setpath("recorded",confp.get("path","recorded"))
- configwriter.setpath("move_destpath",confp.get("path","move_destpath"))
+ configwriter.setPath("recorded",confp.get("path","recorded"))
+ configwriter.setPath("move_destpath",confp.get("path","move_destpath"))
configwriter.setpath("tmp",confp.get("path","tmp"))
try:
configwriter.setenv("x264_addline",confp.get("env","x264_addline"))
except:
- configwriter.setenv("x264_addline","")
+ configwriter.setEnv("x264_addline","")
if confp.get("path","b25_remote")=="":
configwriter.setpath("b25_remote", "0")
elif confp.get("path","b25_remote")=="1":
- configwriter.setpath("b25_remote", confp.get("path","b25_remote"))
- configwriter.setpath("b25", confp.get("path","b25"))
+ configwriter.setPath("b25_remote", confp.get("path","b25_remote"))
+ configwriter.setPath("b25", confp.get("path","b25"))
configwriter.setpath("b25_env", confp.get("path","b25_env"))
else:
- configwriter.setpath("b25_remote", confp.get("path","b25_remote"))
+ configwriter.setPath("b25_remote", confp.get("path","b25_remote"))
- configwriter.writeconf()
+ configwriter.writeConf()
printutf8(u"初期設定が終了しました。")
printutf8(u"makeを実行した後にrootにてmake installを実行するとインストールされます。")
def getConf(useBeforeConf,Confpath,dbsection,key,defaultstr):
tmp = x
point = 0
for x in gram:
- i = find_gram(x, str2)
+ i = findGram(x, str2)
if i > 0:
i = 90 + 10 * i
else:
point = 0
count = 0
for x in gram:
- i = find_gram(x, str2)
+ i = findGram(x, str2)
if i > 0:
i = 90 + 10 * i
count=count + 1
point = point / len(str1) * 10
point = point / len(str2) * 10
return point
-def find_gram(gram, s):
+def findGram(gram, s):
"""
s中にあらわれるgramの数を調べる
"""
i = i + 1
st = st[st.find(gram) + 1:]
return i
-def get_noun_quad_gram(s):
+def getNounQuadGram(s):
"""
。
"""
else:
tmps=tmp1 + tmp2 + tmp3 + x
if tmps.find(" ")<0:
- if zenhan.check_Character_Type(tmp1)>0:
- if (zenhan.check_Character_Type(tmp1)==zenhan.check_Character_Type(tmp2)):
- if (zenhan.check_Character_Type(tmp2)==zenhan.check_Character_Type(tmp3)):
- if (zenhan.check_Character_Type(tmp3)==zenhan.check_Character_Type(x)):
+ if zenhan.checkCharacterType(tmp1)>0:
+ if (zenhan.checkCharacterType(tmp1)==zenhan.checkCharacterType(tmp2)):
+ if (zenhan.checkCharacterType(tmp2)==zenhan.checkCharacterType(tmp3)):
+ if (zenhan.checkCharacterType(tmp3)==zenhan.checkCharacterType(x)):
gram[tmps]=gram.get(tmps,0)+1
skipnum=0
else:
skipnum=3
else:
- if (zenhan.check_Character_Type(tmp3)==zenhan.check_Character_Type(x)):
+ if (zenhan.checkCharacterType(tmp3)==zenhan.checkCharacterType(x)):
skipnum=2
else:
skipnum=3
else:
- if (zenhan.check_Character_Type(tmp2)==zenhan.check_Character_Type(tmp3)):
- if (zenhan.check_Character_Type(tmp3)==zenhan.check_Character_Type(x)):
+ if (zenhan.checkCharacterType(tmp2)==zenhan.checkCharacterType(tmp3)):
+ if (zenhan.checkCharacterType(tmp3)==zenhan.checkCharacterType(x)):
skipnum=0
else:
skipnum=3
else:
- if (zenhan.check_Character_Type(tmp3)==zenhan.check_Character_Type(x)):
+ if (zenhan.checkCharacterType(tmp3)==zenhan.checkCharacterType(x)):
skipnum=2
else:
skipnum=3
global rec10db
def main():
timerec.task()
-db = configreader.getdbpath("db")
+db = configreader.getDBPathSetting("db")
if db == "MySQL":
- dbn = configreader.getdbpath("mysql_dbname")
- dbh = configreader.getdbpath("mysql_host")
- dbu = configreader.getdbpath("mysql_user")
- dbpwd = configreader.getdbpath("mysql_passwd")
- dbport = int(configreader.getdbpath("mysql_port"))
+ dbn = configreader.getDBPathSetting("mysql_dbname")
+ dbh = configreader.getDBPathSetting("mysql_host")
+ dbu = configreader.getDBPathSetting("mysql_user")
+ dbpwd = configreader.getDBPathSetting("mysql_passwd")
+ dbport = int(configreader.getDBPathSetting("mysql_port"))
rec10db = dbMySQL.DB_MySQL(dbname=dbn, host=dbh, user=dbu, passwd=dbpwd, port=dbport)
rec10db.new_in_status()
else:
for i in d:
t = i['type']
if t == "key" or t == "keyevery" or t == "rec" or t == "res":
- if len(chdb.chtxtsearch(i['chtxt'])['ch']) > 2:
+ if len(chdb.getChCSchFromCHtxt(i['chtxt'])['ch']) > 2:
ret = ret + 1
return ret
def countRecNow_minutes_TE(dminutes):
for i in d:
t = i['type']
if t == "key" or t == "keyevery" or t == "rec" or t == "res":
- if len(chdb.chtxtsearch(i['chtxt'])['ch']) < 3:
+ if len(chdb.getChCSchFromCHtxt(i['chtxt'])['ch']) < 3:
ret = ret + 1
return ret
def delete_old(dhour):
rec10d.rec10db.delete_old_auto_timeline_keyword(dhour)
def delete_old_auto_bayes(dhour):
rec10d.rec10db.delete_old_auto_timeline_bayes(dhour)
-def getall():
+def getAll():
return rec10d.rec10db.select_all_timeline()
def rec_reclog(title,chtxt,btime,etime,opt,exp,longexp,category):
rec10d.rec10db.add_in_timeline_log(chtxt,title,btime,etime,opt,exp,longexp,category)
global log_level_now
try:
- log_level_now=int(configreader.getlog("log_level"))
- verbose_level_now=int(configreader.getlog("verbose_level"))
+ log_level_now=int(configreader.getLogSetting("log_level"))
+ verbose_level_now=int(configreader.getLogSetting("verbose_level"))
except:
log_level_now=900
verbose_level_now=400
str=unicode.encode('utf-8')
print str
except Exception, inst:
- recdblist.Commonlogex("Error", "printutf8(recdblist.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "printutf8(recdblist.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)
def printuft8ex(unicode,verbose_level=500,log_level=500):
str=unicode.encode('utf-8')
if verbose_level_now > verbose_level:
f=open(logfname,mode)
f.write(str+"\n")
f.close()
-def Commonlogex(type,place,inst,txt,verbose_level=500,log_level=500):
+def addCommonlogEX(type,place,inst,txt,verbose_level=500,log_level=500):
lt=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")+u":"
if txt=="":
lt=lt+u"["+type+u"] "+place+u" "+inst
f.write(lt+"\n")
f.close()
def addCommandLog(tspath,log_title,cmd,cmd_log=""):
- addlog(tspath,cmd,log_title+u"ログ-コマンド")
- addlog(tspath,cmd_log,log_title+u"ログ-詳細")
-def addlog(tspath,txt,log_title):
+ addLog(tspath,cmd,log_title+u"ログ-コマンド")
+ addLog(tspath,cmd_log,log_title+u"ログ-詳細")
+def addLog(tspath,txt,log_title):
logo=tspath
logo=logo.replace("_1.wav",".ts")
logo=logo.replace("_2.wav",".ts")
#optt=opts.replace("E","")
#optt=optt.replace("D","")
#optt=optt.replace("R","")
- str="99"+","+datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")+","+configreader.getenv("iff")+","+chtxt+","+title+","+optt
+ str="99"+","+datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")+","+configreader.getEnvSetting("iff")+","+chtxt+","+title+","+optt
f.write(str.encode('utf-8'))
f.close()
readRecQue(os.path.join(folderpath, file))
os.remove(os.path.join(folderpath, file))
except Exception, inst:
- recdblist.Commonlogex("Error", "searchRecQue(recque.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "searchRecQue(recque.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)
\ No newline at end of file
import configreader
import recdblist
import tv2ts
-tmppath = configreader.getpath("tmp")+"/"
-tssplitterp = configreader.getpath("tssplitter")
+tmppath = configreader.getPathSetting("tmp")+"/"
+tssplitterp = configreader.getPathSetting("tssplitter")
def searchCh():
#地上デジタル
for i in xrange(13,62):
else:
rec10d.rec10db.add_epg_ch(bctype,chtxthead+"_"+lstr, ch, lstr, u"2010-01-01 00:00:00")
except Exception, inst:
- recdblist.Commonlogex("Warning", "addCh (scan_ch.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Warning", "addCh (scan_ch.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
def getChProgNum(ch):
pout=os.path.join(tmppath,"ch_"+str(ch)+".ts")
tv2ts.tv2tsmix(pout, ch, "10")
ret.append(str(int(l)))
except:
""
- recdblist.addlog(pin, doexe, u"TsSplitログ-コマンド")
- recdblist.addlog(pin, txt, u"TsSplitログ-詳細")
+ recdblist.addLog(pin, doexe, u"TsSplitログ-コマンド")
+ recdblist.addLog(pin, txt, u"TsSplitログ-詳細")
time.sleep(1)
try:
""
return rec10d.rec10db.select_all_in_settings()[0][3]
def getRecordingMax():
- return [int(configreader.getenv("te_max")),int(configreader.getenv("bscs_max"))]
+ return [int(configreader.getEnvSetting("te_max")),int(configreader.getEnvSetting("bscs_max"))]
ftpusr = "/home/ftpusr/ftp-tmp"
recordedpath = u"/home/ftpusr/ftp-video"
if __name__ == "__main__":
- print ts2x264.get_x264core_version()
\ No newline at end of file
+ print ts2x264.getX264CoreVersion()
\ No newline at end of file
import install
import recdblist
import recque
-recpath = configreader.getpath('recpath')
-movepath = configreader.getpath('move_destpath')
+recpath = configreader.getPathSetting('recpath')
+movepath = configreader.getPathSetting('move_destpath')
path = str(os.path.dirname(os.path.abspath(__file__))) + "/"
def task():
"""
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")),verbose_level=800)
- recnum = int(configreader.getenv("te_max")) -recnum
+ recnum = int(configreader.getEnvSetting("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")),verbose_level=800)
- recnum = int(configreader.getenv("bscs_max")) -recnum
+ recnum = int(configreader.getEnvSetting("bscs_max")) -recnum
if recnum >0 :
recdblist.printutf8(str(update),verbose_level=750)
rec10d.rec10db.update_status_by_bctype_epg_ch(bctype, "0")
- epgdb.updatebc(bctype)
+ epgdb.updateForBctype(bctype)
update = chdb.update()
i = i + 1
if i > 0:
else:
makeMP4=0
try:
- if configreader.getenv("make_mp4")==1:
+ if configreader.getEnvSetting("make_mp4")==1:
makeMP4=1
except:
""
else:
makeMP4=0
try:
- if configreader.getenv("make_mp4")==1:
+ if configreader.getEnvSetting("make_mp4")==1:
makeMP4=1
except:
""
tnow = datetime.datetime.now()
nows =tnow.strftime("%Y-%m-%d %H:%M:%S")
for k,auto,opt in key:
- recdatum = epgdb.searchtime_auto(k,nows, "144")
+ recdatum = epgdb.searchTimeAuto(k,nows, "144")
for recdata in recdatum:
if recdata[1] != "":
chtxtt = recdata[0]
maxnum=0
if len(ch['ch'])>2:
maxnum=epgdb.count_schedule_timeline(btimet, etimet)[1]
- maxnum=int(configreader.getenv("bscs_max"))-maxnum
+ maxnum=int(configreader.getEnvSetting("bscs_max"))-maxnum
else:
maxnum=epgdb.count_schedule_timeline(btimet, etimet)[0]
- maxnum=int(configreader.getenv("te_max"))-maxnum
+ maxnum=int(configreader.getEnvSetting("te_max"))-maxnum
if maxnum>0:
if recdb.checkduplicate(titlet, chtxtt, btimet, etimet)==0:
recdb.recreserv(titlet,chtxtt, btimet, etimet,topt)
except Exception, inst:
- recdblist.Commonlogex("Error", "search_keyword_auto_jbk(timerec.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "search_keyword_auto_jbk(timerec.py)", str(type(inst)),str(inst)+traceback.format_exc(),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)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "search_keyword(timerec.py)", str(type(inst)),str(inst)+traceback.format_exc(),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")
dtt = bt-tnow
dt = dtt.days * 24 * 60 * 60 + dtt.seconds
if (dt < 58 * 60 and dt > 30 * 60):
- bctypet = chdb.chtxtsearch(chtxt)['bctype']
+ bctypet = chdb.searchFromCHtxt(chtxt)['bctype']
chdatat = rec10d.rec10db.select_by_bctype_epg_ch(bctypet)
dt1 = datetime.datetime.strptime(chdatat[0][4], "%Y-%m-%d %H:%M:%S")-datetime.datetime.now()
dt1 = dt1.days * 24 * 60 * 60 + dt1.seconds
if dt1 < 60 * 60:
- recdata = epgdb.searchtime2(title, btime, "5", chtxt)
+ recdata = epgdb.searchTime(title, btime, "5", chtxt)
chtxtn = recdata[0]
titlen = recdata[1]
btimen = recdata[2]
recdb.del_reckey(typetxtnow, title, chtxt, btime)
recdb.rec_reckey(typetxtfinal, titlen, chtxtn, btimen, etimen, opt)
recdb.rec_reclog(titlen, chtxtn, btimen, etimen, opt, exp, longexp, category)
- auto_rec.add_key(chtxt, titlen,exp+" "+longexp)
- auto_rec.add_key("ALL", titlen,exp+" "+longexp)
+ auto_rec.addKey(chtxt, titlen,exp+" "+longexp)
+ auto_rec.addKey("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)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "Oikake DB(timerec.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
else:
recdblist.printutf8(u"追いかけ機能エラー:番組データが見付かりません。")
else:
rec10d.rec10db.update_status_by_bctype_epg_ch(bctypet, "3")
sys.exit()
elif (dt <= 30 * 60 and dt > 20 * 60):
- recdata = epgdb.searchtime2(title, btime, "5", chtxt)
+ recdata = epgdb.searchTime(title, btime, "5", chtxt)
chtxtn = recdata[0]
titlen = recdata[1]
btimen = recdata[2]
recdb.del_reckey(typetxtnow, title, chtxt, btime)
recdb.rec_reckey(typetxtfinal, titlen, chtxtn, btimen, etimen, opt)
recdb.rec_reclog(titlen, chtxtn, btimen, etimen, opt, exp, longexp, category)
- auto_rec.add_key(chtxt, titlen,exp+" "+longexp)
- auto_rec.add_key("ALL", titlen,exp+" "+longexp)
+ auto_rec.addKey(chtxt, titlen,exp+" "+longexp)
+ auto_rec.addKey("ALL", titlen,exp+" "+longexp)
#recdblist.printutf8(u"追いかけ機能実行中: "+title+" : "+titlen+" "+btimen+" "+etimen)
- recdblist.Commonlogex(u"通常", "Oikake (timerec.py)",u"追いかけ機能実行中",u"追いかけ機能実行中: "+title+" : "+titlen+" "+btimen+" "+etimen,log_level=500)
+ recdblist.addCommonlogEX(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)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "Oikake DB(timerec.py)", str(type(inst)),str(inst)+traceback.format_exc(),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)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "Oikake DB(timerec.py)", str(type(inst)),str(inst)+traceback.format_exc(),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")
if re.search("N", opt) or tcheck>0:
iff=""
try:
- iff=u"("+configreader.getenv("iff")+u")_"
+ iff=u"("+configreader.getEnvSetting("iff")+u")_"
except:
iff=""
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,"",log_level=500)
+ recdblist.addCommonlogEX(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):
except:
""
except Exception, inst:
- recdblist.Commonlogex("Error", "Move option(timerec.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "Move option(timerec.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
recdb.rec_reckey(recdblist.REC_MOVE_END, newtitle, chtxt, btime, etime, opt)
sys.exit()
def type_keyword(typetxt,chtxt,title,bt,et,opt,deltatime):
dt = dtt.days * 24 * 60 * 60 + dtt.seconds
recdblist.printutf8(str(dt), verbose_level=800)
if dt < 90 * 60:
- recdata = epgdb.searchtime2(title, btime, deltatime, chtxt)
+ recdata = epgdb.searchTime(title, btime, deltatime, chtxt)
if recdata[1] != "":
chtxtt = recdata[0]
titlet = recdata[1]
recdb.del_reckey(typetxtnow, title, chtxt, btime)
recdb.rec_reckey(typetxtres, titlet, chtxt, btimet, etimet, 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,"",log_level=500)
+ auto_rec.addKey(chtxt, titlet,exp+" "+longexp)
+ auto_rec.addKey("ALL", titlet,exp+" "+longexp)
+ recdblist.addCommonlogEX(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))
recdb.everyreserv(title, chtxt, btxt, etxt, deltatime, opt, deltaday,counter-1)
elif counter==-1:
recdb.everyreserv(title, chtxt, btxt, etxt, deltatime, opt, deltaday,-1)
- recdata = epgdb.searchtime2(title, btime, deltatime, chtxt)
+ recdata = epgdb.searchTime(title, btime, deltatime, chtxt)
if recdata[1] != "":
chtxtt = recdata[0]
titlet = recdata[1]
errtxt1="move ts error.\n"
errtxt2=str(type(inst))+"\n"
errtxt2=errtxt2+str(inst)
- recdblist.Commonlogex("Error", "type_decode_que(timerec.py)", errtxt1,errtxt2+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "type_decode_que(timerec.py)", errtxt1,errtxt2+traceback.format_exc(),log_level=200)
recdb.rec_reckey(recdblist.REC_MOVE_END, title, chtxt, btime, etime, opt)
else:
recdb.del_reckey(typetxtnow, title, chtxt, btime)
typetxting=recdblist.REC_ENCODE_LOCAL
typetxtfin=recdblist.REC_FIN_LOCAL
if dt < 10 * 60:
- if status.getEncoding() < int(configreader.getenv("enc_max")):
+ if status.getEncoding() < int(configreader.getEnvSetting("enc_max")):
recdb.del_reckey(typetxtnow, title, chtxt, btime)
recdb.rec_reckey(typetxting, title, chtxt, btime, etime, opt)
recdblist.printutf8(opt)
time.sleep(3)
makeMP4=0
try:
- if configreader.getenv("make_mp4")=="1":
+ if configreader.getEnvSetting("make_mp4")=="1":
makeMP4=1
except:
""
errtxt1="move mkv/mp4 error."
errtxt2=str(type(inst))+"\n"
errtxt2=errtxt2+str(inst)
- recdblist.Commonlogex("Error", "type_encode_que(timerec.py)", errtxt1,errtxt2+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "type_encode_que(timerec.py)", errtxt1,errtxt2+traceback.format_exc(),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()
timet = "180"
elif len(ch)>2:
timet = "240"
- write_time(pout, ch ,timet)
-def write_time(pout, ch ,times):
+ writeTime(pout, ch ,timet)
+def writeTime(pout, ch ,times):
"""
指定された時間分tsを取得してepgの入ったxmlとして書き出す
"""
- recdblist.Commonlogex(u"通常","write_time(ts2epg.py)",u"Ts-EPG XML書き出し処理開始" ,u"CH:"+ch,log_level=500)
+ recdblist.addCommonlogEX(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"
mode = "/BS"
else:
mode = str(chdb.bctypesearch(u'te' + ch)['ch'])
- epgdump = configreader.getpath("epgdump")
+ epgsearchFromBctypegreader.getPathSetting("epgdump")
if os.access(pout + ".ts", os.F_OK):
os.remove(pout + ".ts")
time.sleep(10)
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,"",log_level=500)
+ recdblist.addCommonlogEX(u"通常", "write_time(ts2epg.py)", exe,"",log_level=500)
os.system(exe)
time.sleep(10)
size="HD"
crf=18
quality=4
- quality=int(configreader.getenv("x264_preset"))
- crf=int(configreader.getenv("crf"))
+ quality=int(configreader.getEnvSetting("x264_preset"))
+ crf=int(configreader.getEnvSetting("crf"))
deinterlace=1
if re.search("H", opts):
size = "HD"
crf=crf+2
if re.search("v", opts):
is24fps=1
- crf=int(configreader.getenv("animation_crf"))
+ crf=int(configreader.getEnvSetting("animation_crf"))
if re.search("a", opts):
is24fps=1
- crf=int(configreader.getenv("animation_crf"))
+ crf=int(configreader.getEnvSetting("animation_crf"))
if re.search("I", opts):
deinterlace=0
if re.search("q",opts):
crf=crf-2
if re.search("d",opts):#二カ国語放送の場合
tm2v=pin.replace(".ts",".m2v")
- encode_ffmpeg_sar(tm2v,pout,size,is24fps,quality,crf,deinterlace)
+ encodeFFmpegSar(tm2v,pout,size,is24fps,quality,crf,deinterlace)
elif re.search("5",opts):#5.1chの場合
- encode_ffmpeg_sar(pin,pout,size,is24fps,quality,crf,deinterlace)
+ encodeFFmpegSar(pin,pout,size,is24fps,quality,crf,deinterlace)
else:
try:
- encode_sar(pin, pout,size,is24fps,quality,crf,deinterlace)
+ encodeSar(pin, pout,size,is24fps,quality,crf,deinterlace)
except Exception, inst:
- recdblist.Commonlogex("Error", "ts2x264(ts2x264.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)
-def encode_sar(pin,pout,size,is24fps,quality,crf,deinterlace=1):
- mencoder=configreader.getpath("mencoder")
- encvf=""
+ recdblist.addCommonlogEX("Error", "ts2x264(ts2x264.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)
+def encodeSar(pin,pout,size,is24fps,quality,crf,deinterlace=1):
+ mencoder=configreader.getPathSetting("mencoder")
+ egetPath
txt=""
encvf="-sws 9 -vf yadif=0,pp=l5"
harddup=",hqdn3d=2:1:2,unsharp=l3x3:0.75:c3x3:0.75,harddup"
encvf="-sws 9 -vf pullup,softskip"
harddup=",pp=l5,unsharp=l3x3:0.75:c3x3:0.75,hqdn3d=2:1:2,harddup"
if size == "HD":
- tsize=get_par_size(pin,720)
+ tsize=getParSize(pin,720)
encvf = encvf + ",scale=-3:720::0:3"+harddup
x264streamsize=str(tsize[0])+u"x720"
x264_bitrate="2500"
elif size == "WVGA":
- tsize=get_par_size(pin,480)
+ tsize=getParSize(pin,480)
encvf = encvf + ",scale=-3:480::0:3"+harddup
x264streamsize=str(tsize[0])+u"x480"
x264_bitrate="1500"
elif size == "FullHD":
- tsize=get_par_size(pin,1080)
+ tsize=getParSize(pin,1080)
encvf = encvf + ",scale=-3:1080::0:3"+harddup
x264streamsize=str(tsize[0])+u"x1080"
x264_bitrate="5000"
elif size == "QVGA_BASE":
- tsize=get_par_size(pin,240)
+ tsize=getParSize(pin,240)
encvf = encvf + ",scale=-3:240::0:3"+harddup
x264streamsize=str(tsize[0])+u"x240"
x264_bitrate="300"
elif size == "WVGA_BASE":
- tsize=get_par_size(pin,480)
+ tsize=getParSize(pin,480)
encvf = encvf + ",scale=-3:480::0:3"+harddup
x264streamsize=str(tsize[0])+u"x480"
x264_bitrate="1500"
else:
- tsize=get_par_size(pin,720)
+ tsize=getParSize(pin,720)
encvf = encvf + ",scale=-3:720::0:3"+harddup
x264streamsize=str(tsize[0])+u"x720"
x264_bitrate="2500"
streampath=os.path.join(os.path.dirname(pin),str(random.randint(10000, 99999999)))
os.system(u"mkfifo "+streampath)
encexe=mencoder+u" \""+pin+u"\" -vfm ffmpeg -quiet "+encvf+u",format=i420 "+fps+" "+ofps+" -oac mp3lame -ovc raw -of rawvideo -o \""+streampath+"\" & "
- encexe=encexe+get_x264_commandline(x264preset, x264sar, x264fps, x264profile, x264tune, pout, streampath, x264streamsize, crf=x264crf)
+ encexe=encexe+getX264Commandline(x264preset, x264sar, x264fps, x264profile, x264tune, pout, streampath, x264streamsize, crf=x264crf)
#encexe=encexe+u" nice -n 19 "+x264+" "+x264_sar+" "+x264crf+u" "+x264_addline+u" --threads "+x264_thread+" "+x264profile+x264preset+" "+x264tune+" "+x264fps+" -o \""+pout+"\" "+streampath+" "+x264streamsize
encexe=u"nice -n 19 " +encexe
recdblist.printutf8(encexe)
""
os.system("rm "+streampath)
recdblist.addCommandLog(pin, u"Mencoder", encexe, txt)
-def encode_ffmpeg_sar(pin,pout,size,is24fps,quality,crf,deinterlace=1):
+def encodeFFmpegSar(pin,pout,size,is24fps,quality,crf,deinterlace=1):
"""
"""
- ffmpeg=configreader.getpath("ffmpeg")
+ ffmpeg=configreader.getPathSetting("ffmpeg")
fps=u"-r 29.970030 "
x264fps="30000/1001"
x264streamsize=""
filter="-deinterlace"
x264sar=str(tsar[0])+":"+str(tsar[1])
if size == "HD":
- tsize=get_par_size(pin,720)
+ tsize=getParSize(pin,720)
s = "-s "+str(tsize[0])+"x720 "
x264streamsize=str(tsize[0])+u"x720"
x264_bitrate="2500"
elif size == "WVGA":
- tsize=get_par_size(pin,480)
+ tsize=getParSize(pin,480)
s = "-s "+str(tsize[0])+"x480 "
x264streamsize=str(tsize[0])+u"x480"
x264_bitrate="1500"
elif size == "FullHD":
- tsize=get_par_size(pin,1080)
+ tsize=getParSize(pin,1080)
s = "-s "+str(tsize[0])+"x1080 "
x264streamsize=str(tsize[0])+u"x1080"
x264_bitrate="5000"
elif size == "SD":
- tsize=get_par_size(pin,480)
+ tsize=getParSize(pin,480)
s = "-s "+str(tsize[0])+"x480 "
x264streamsize=str(tsize[0])+u"x480"
x264_bitrate="1250"
elif size == "QVGA_BASE":
- tsize=get_par_size(pin,240)
+ tsize=getParSize(pin,240)
s = "-s "+str(tsize[0])+"x240 "
x264streamsize=str(tsize[0])+u"x240"
x264_bitrate="300"
elif size == "WVGA_BASE":
- tsize=get_par_size(pin,480)
+ tsize=getParSize(pin,480)
s = "-s "+str(tsize[0])+"x480 "
x264streamsize=str(tsize[0])+u"x480"
x264_bitrate="1500"
else:
- tsize=get_par_size(pin,720)
+ tsize=getParSize(pin,720)
s = "-s "+str(tsize[0])+"x720 "
x264streamsize=str(tsize[0])+u"x720"
x264_bitrate="2500"
txt=""
os.environ['LANG']="ja_JP.UTF-8"
exe=ffmpeg+u" -y -i \""+pin+"\" -vsync 400 -vcodec rawvideo -pix_fmt yuv420p "+s+fps+" "+filter+" -an -f rawvideo - | "
- exe=exe+get_x264_commandline(x264preset, x264sar, x264fps, x264profile, x264tune, pout,"-", x264streamsize, crf=x264crf)
+ exe=exe+getX264Commandline(x264preset, x264sar, x264fps, x264profile, x264tune, pout,"-", x264streamsize, crf=x264crf)
exe = "nice -n 19 " + exe
txt=""
recdblist.printutf8(exe)
""
recdblist.addCommandLog(pin, u"FFmpeg動画エンコード", exe, txt)
def getMovieBaseSize(pin):
- ffmpeg=configreader.getpath("ffmpeg")
+ ffmpeg=configreader.getPathSetting("ffmpeg")
os.environ['LANG']="ja_JP.UTF-8"
exe=ffmpeg+u" -i \""+pin+"\" 2>&1"
txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
sizeMaxY=tY
return [sizeMaxX,sizeMaxY]
def getMovieBaseSize2(pin):##動画開始後すぐに解像度が変更されたときに対処
- ffmpeg=configreader.getpath("ffmpeg")
+ ffmpeg=configreader.getPathSetting("ffmpeg")
os.environ['LANG']="ja_JP.UTF-8"
exe=ffmpeg+u" -ss 5 -fs 1 -i \""+pin+"\" \""+pin+".size.ts\" 2>&1"
txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
os.remove(pin+".size.ts")
return [sizeMaxX,sizeMaxY]
def getMoviePAR(pin):
- ffmpeg=configreader.getpath("ffmpeg")
+ ffmpeg=configreader.getPathSetting("ffmpeg")
os.environ['LANG']="ja_JP.UTF-8"
exe=ffmpeg+u" -i \""+pin+"\" 2>&1"
txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
pary=tEY
return [parx,pary]
def getMoviePAR2(pin):
- ffmpeg=configreader.getpath("ffmpeg")
+ ffmpeg=configreader.getPathSetting("ffmpeg")
os.environ['LANG']="ja_JP.UTF-8"
exe=ffmpeg+u" -ss 5 -fs 1 -i \""+pin+"\" \""+pin+".size.ts\" 2>&1"
txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
os.remove(pin+".size.ts")
return [parx,pary]
def getMovieDAR(pin):
- ffmpeg=configreader.getpath("ffmpeg")
+ ffmpeg=configreader.getPathSetting("ffmpeg")
os.environ['LANG']="ja_JP.UTF-8"
exe=ffmpeg+u" -i \""+pin+"\" 2>&1"
txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
dary=tEY
return [darx,dary]
def getMovieDAR2(pin):
- ffmpeg=configreader.getpath("ffmpeg")
+ ffmpeg=configreader.getPathSetting("ffmpeg")
os.environ['LANG']="ja_JP.UTF-8"
exe=ffmpeg+u" -ss 5 -fs 1 -i \""+pin+"\" \""+pin+".size.ts\" 2>&1"
txts=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')
dary=tEY
os.remove(pin+".size.ts")
return [darx,dary]
-def get_par_size(pin,y):
+def getParSize(pin,y):
tSize=getMovieBaseSize2(pin)
if tSize[1] != 0 :
tX=tSize[0]*10*y/tSize[1]
tX=-1
tY=-1
return [tX,tY]
-def get_x264core_version():
- x264=configreader.getpath("x264")
+def getX264CoreVersion():
+ x264=configreader.getPathSetting("x264")
t1=commands.getoutput(x264+" --help|grep core")
rT=re.compile(u"x264 core:(\d*)[\d]*.*\Z")
rM=rT.match(t1)
if rM:
v=int(rM.group(1))
return v
-def get_x264_commandline(preset,sar,fps,x264profile,x264tune,pout,pin,x264streamsize,crf=-1,bitrate=0):
- x264=configreader.getpath("x264")
+def getX264Commandline(preset,sar,fps,x264profile,x264tune,pout,pin,x264streamsize,crf=-1,bitrate=0):
+ x264=configreader.getPathSetting("x264")
os.environ['LANG']="ja_JP.UTF-8"
x264_sar="--sar "+sar
x264preset=u"--preset "+preset
x264bitrate=u"--bitrate "+str(bitrate)
else:
x264crf=u"--crf "+str(crf)
- x264_addline=configreader.getenv("x264_addline")
+ x264_addline=configreader.getEnvSetting("x264_addline")
x264_thread="auto"
try:
- xtt=configreader.getenv("x264_thread")
+ xtt=configreader.getEnvSetting("x264_thread")
xtt=int(xtt)
if xtt>0:
x264_thread=str(xtt)
except:
x264_thread="auto"
- x264_addline=configreader.getenv("x264_addline")
- if get_x264core_version()>103:
+ x264_addline=configreader.getEnvSetting("x264_addline")
+ if getX264CoreVersion()>103:
x264res=u"--input-res "+x264streamsize
exe=u"nice -n 19 "+x264+" "+x264_sar+" "+x264crf+u" "+x264_addline+u" --colormatrix bt709 --threads "+x264_thread+" "+x264profile+x264preset+" "+x264tune+" "+x264fps+" "+x264res+" -o \""+pout+"\" "+pin
else:
def wav2aac_nero(pin,pout):
os.environ['LANG']="ja_JP.UTF-8"
- neroaac=configreader.getpath('NeroAAC')
+ neroaac=configreader.getPathSetting('NeroAAC')
exe=neroaac+" -br 128000 -2pass -if \""+pin+"\" -of \""+pout+"\""
try:
txt=commands.getoutput(exe.encode('utf-8'))
- recdblist.addlog(pin, exe, u"Wav2aac_Neroログ-コマンド")
- recdblist.addlog(pin, txt, u"Wav2aac_Neroログ-詳細")
+ recdblist.addLog(pin, exe, u"Wav2aac_Neroログ-コマンド")
+ recdblist.addLog(pin, txt, u"Wav2aac_Neroログ-詳細")
except:
if not os.path.exists(pout):
lame="lame"
exe=lame+" -b 128 \""+pin+"\" \""+pout+"\""
txt=commands.getoutput(exe.encode('utf-8'))
- recdblist.addlog(pin, exe, u"Wav2aac_Lameログ-コマンド")
- recdblist.addlog(pin, txt, u"Wav2aac_Lameログ-詳細")
+ recdblist.addLog(pin, exe, u"Wav2aac_Lameログ-コマンド")
+ recdblist.addLog(pin, txt, u"Wav2aac_Lameログ-詳細")
def wav2mp3_lame(pin,pout):
os.environ['LANG']="ja_JP.UTF-8"
lame="lame"
txt=commands.getoutput(exe.encode('utf-8'))
except:
""
- recdblist.addlog(pin, exe, u"Wav2aac_Lameログ-コマンド")
- recdblist.addlog(pin, txt, u"Wav2aac_Lameログ-詳細")
+ recdblist.addLog(pin, exe, u"Wav2aac_Lameログ-コマンド")
+ recdblist.addLog(pin, txt, u"Wav2aac_Lameログ-詳細")
def ts2single_audio(pts,opts):
paac=pts.replace(".ts",".aac")
- ffmpeg=configreader.getpath("ffmpeg")
+ ffmpeg=configreader.getPathSetting("ffmpeg")
e0=ffmpeg+" -i \""+pts+"\" -y -vn -f aac -acodec copy \""+paac+"\""
p0=subprocess.Popen(e0,shell=True)
os.waitpid(p0.pid, 0)
if os.path.getsize(paac)<1000:#1mで1kb以下の場合自動で終了
try:
logt=unicode(p0.communicate()[0], "UTF-8")
- recdblist.addlog(pts,e0, "FFmpeg音声取り出しログ-コマンド")
- recdblist.addlog(pts,logt, "FFmpeg音声取り出しログ-詳細")
+ recdblist.addLog(pts,e0, "FFmpeg音声取り出しログ-コマンド")
+ recdblist.addLog(pts,logt, "FFmpeg音声取り出しログ-詳細")
except:
""
- recdblist.Commonlogex("[Error]", "ffmpeg aac getting. (ts2single_audio@tv2audio.py)", u"AAC demux error(ffmpeg)", "", verbose_level=200, log_level=200)
+ recdblist.addCommonlogEX("[Error]", "ffmpeg aac getting. (ts2single_audio@tv2audio.py)", u"AAC demux error(ffmpeg)", "", verbose_level=200, log_level=200)
os.kill(p0.pid,signal.SIGKILL)
os.remove(paac)
ts2single_mp3_ffmpeg(pts)
ts2single_fp_BonTsDemux(pts,opts)
else:
logt=unicode(p0.communicate()[0], "UTF-8")
- recdblist.addlog(pts,e0, "FFmpeg音声取り出しログ-コマンド")
- recdblist.addlog(pts,logt, "FFmpeg音声取り出しログ-詳細")
+ recdblist.addLog(pts,e0, "FFmpeg音声取り出しログ-コマンド")
+ recdblist.addLog(pts,logt, "FFmpeg音声取り出しログ-詳細")
else:
try:
logt=unicode(p0.communicate()[0], "UTF-8")
- recdblist.addlog(pts,e0, "FFmpeg音声取り出しログ-コマンド")
- recdblist.addlog(pts,logt, "FFmpeg音声取り出しログ-詳細")
+ recdblist.addLog(pts,e0, "FFmpeg音声取り出しログ-コマンド")
+ recdblist.addLog(pts,logt, "FFmpeg音声取り出しログ-詳細")
except:
""
- recdblist.Commonlogex("[Error]", "ffmpeg aac getting. (ts2single_audio@tv2audio.py)", u"AAC demux error(ffmpeg)", "", verbose_level=200, log_level=200)
+ recdblist.addCommonlogEX("[Error]", "ffmpeg aac getting. (ts2single_audio@tv2audio.py)", u"AAC demux error(ffmpeg)", "", verbose_level=200, log_level=200)
try:
os.kill(p0.pid,signal.SIGKILL)
except:
if os.path.getsize(paac)<1000:#1mで1kb以下の場合自動で終了
try:
logt=unicode(p0.communicate()[0], "UTF-8")
- recdblist.addlog(pts,e0, "FFmpeg音声取り出しログ-コマンド")
- recdblist.addlog(pts,logt, "FFmpeg音声取り出しログ-詳細")
+ recdblist.addLog(pts,e0, "FFmpeg音声取り出しログ-コマンド")
+ recdblist.addLog(pts,logt, "FFmpeg音声取り出しログ-詳細")
except:
""
- recdblist.Commonlogex("[Error]", "ffmpeg aac getting. (ts2single_audio@tv2audio.py)", u"AAC demux error(ffmpeg)", "", verbose_level=200, log_level=200)
+ recdblist.addCommonlogEX("[Error]", "ffmpeg aac getting. (ts2single_audio@tv2audio.py)", u"AAC demux error(ffmpeg)", "", verbose_level=200, log_level=200)
os.remove(paac)
ts2single_mp3_ffmpeg(pts)
if not os.path.exists(pts.replace(".ts",".mp3")):
else:
try:
logt=unicode(p0.communicate()[0], "UTF-8")
- recdblist.addlog(pts,e0, "FFmpeg音声取り出しログ-コマンド")
- recdblist.addlog(pts,logt, "FFmpeg音声取り出しログ-詳細")
+ recdblist.addLog(pts,e0, "FFmpeg音声取り出しログ-コマンド")
+ recdblist.addLog(pts,logt, "FFmpeg音声取り出しログ-詳細")
except:
""
else:
try:
logt=unicode(p0.communicate()[0], "UTF-8")
- recdblist.addlog(pts,e0, "FFmpeg音声取り出しログ-コマンド")
- recdblist.addlog(pts,logt, "FFmpeg音声取り出しログ-詳細")
+ recdblist.addLog(pts,e0, "FFmpeg音声取り出しログ-コマンド")
+ recdblist.addLog(pts,logt, "FFmpeg音声取り出しログ-詳細")
except:
""
- recdblist.Commonlogex("[Error]", "ffmpeg aac getting. (ts2single_audio@tv2audio.py)", u"AAC demux error(ffmpeg)", "", verbose_level=200, log_level=200)
+ recdblist.addCommonlogEX("[Error]", "ffmpeg aac getting. (ts2single_audio@tv2audio.py)", u"AAC demux error(ffmpeg)", "", verbose_level=200, log_level=200)
ts2single_mp3_ffmpeg(pts)
if not os.path.exists(pts.replace(".ts",".mp3")):
ts2single_fp_BonTsDemux(pts,opts)
def ts2singlewav(pts,opts):
- bontsdemux = configreader.getpath('bontsdemux')
+ bontsdemux = configreader.getPathSetting('bontsdemux')
bonpin = "Z:\\" + pts[1:]
outf = os.path.splitext(pts)[0]
bonpout = "Z:\\" + outf[1:]
recdblist.addCommandLog(ots, u"BonTsDemux 音声取り出し", exe, logt)
def ts2single_mp3_ffmpeg(pts):
pmp3=pts.replace(".ts",".mp3")
- ffmpeg=configreader.getpath("ffmpeg")
+ ffmpeg=configreader.getPathSetting("ffmpeg")
e0=ffmpeg+" -i \""+pts+"\" -y -vn -ab 128k \""+pmp3+"\""
p0=subprocess.Popen(e0,shell=True)
os.waitpid(p0.pid, 0)
try:
logt=unicode(p0.communicate()[0], "UTF-8")
- recdblist.addlog(pts,e0, "FFmpeg_mp3音声取り出しログ-コマンド")
- recdblist.addlog(pts,logt, "FFmpeg_mp3音声取り出しログ-詳細")
+ recdblist.addLog(pts,e0, "FFmpeg_mp3音声取り出しログ-コマンド")
+ recdblist.addLog(pts,logt, "FFmpeg_mp3音声取り出しログ-詳細")
except:
""
def ts2single_fp_BonTsDemux(pts,opts):
useNero=0
try:
- if configreader.getpath("useNeroAAC")=="1" and os.path.exists(configreader.getpath("NeroAAC")):
+ if configreader.getPathSetting("useNeroAAC")=="1" and os.path.exists(configreader.getPathSetting("NeroAAC")):
useNero=1
except:
useNero=0
"""
delay is string
"""
- bontsdemux = configreader.getpath('bontsdemux')
- wine = configreader.getpath('wine')
+ bontsdemux = configreader.getPathSetting('bontsdemux')
+ wine = configreader.getPathSetting('wine')
bonpin = "Z:\\" + pin[1:]
outf = os.path.splitext(pin)[0]
bonpout = "Z:\\" + outf[1:]
ffpout22=ffpout2.replace(".wav",".mp3")
useNero=0
try:
- if configreader.getpath("useNeroAAC")=="1" and os.path.exists(configreader.getpath("NeroAAC")):
+ if configreader.getPathSetting("useNeroAAC")=="1" and os.path.exists(configreader.getPathSetting("NeroAAC")):
useNero=1
except:
useNero=0
os.remove(ffpout1)
os.remove(ffpout2)
def ts2pentaaudio_BonTsDemux(pin, delay,opts):
- bontsdemux = configreader.getpath('bontsdemux')
- wine = configreader.getpath('wine')
+ bontsdemux = configreader.getPathSetting('bontsdemux')
+ wine = configreader.getPathSetting('wine')
bonpin = "Z:\\" + pin[1:]
outf = os.path.splitext(pin)[0]
bonpout = "Z:\\" + outf[1:]
ffpout21=ffpout1.replace(".wav",".mp3")
useNero=0
try:
- if configreader.getpath("useNeroAAC")=="1" and os.path.exists(configreader.getpath("NeroAAC")):
+ if configreader.getPathSetting("useNeroAAC")=="1" and os.path.exists(configreader.getPathSetting("NeroAAC")):
useNero=1
except:
useNero=0
dt = et-tnow
rectime = dt.seconds-5
rectime = str(rectime)
- tv2ts.tv2b25ts(tsout + ".ts.b25", chdb.chtxtsearch(chtxt)['ch'], rectime)
+ tv2ts.tv2b25ts(tsout + ".ts.b25", chdb.getChCSchFromCHtxt(chtxt)['ch'], rectime)
def b252ts(pout, chtxt, btime, etime, opt):
"""
poutはタイトル(自動的にtitle.b25 title.tsと名前がつきます。)
if pentaaudio == 1:
tv2audio.ts2pentaaudio_BonTsDemux(aviin, recdblist.BONTSDEMUX_DELAY, opt)
except Exception, inst:
- recdblist.Commonlogex("Error", "b252ts(tv2avi.py)", str(type(inst))+traceback.format_exc(), str(inst))
+ recdblist.addCommonlogEX("Error", "b252ts(tv2avi.py)", str(type(inst))+traceback.format_exc(), str(inst))
status.changeB25Decoding(-1)
def ts2avi(pin, pout, opt):
status.changeEncoding(1)
-import auto_process
#!/usr/bin/python
# coding: UTF-8
# Rec10 TS Recording Tools
import tv2mp4
import configreader
import subprocess
+import auto_process
def ts2mkv(pin, pout, opt):
tpout=pout.replace(".mkv",".mp4")
tv2mp4.ts2mp4(pin, tpout, opt)
if os.path.exists(pout) and os.path.getsize(pout)>os.path.getsize(tpout)*0.9:
os.remove(tpout)
def mp42mkv(pmkv,pmp4):
- exe = configreader.getpath("mkvmerge")
+ exe = configreader.getPathSetting("mkvmerge")
e1=exe +" -o \""+pmkv+u"\" \""+pmp4+"\""
p=subprocess.Popen(e1,shell=True)
os.waitpid(p.pid, 0)
duration="-fps 29.970030 "##ffmpegが24fpsに対応していないための措置\r
if re.search("I",opt):\r
duration="-fps 29.970030 "\r
- exe = configreader.getpath("mp4box")\r
+ exe = configreader.getPathSetting("mp4box")\r
txt=""\r
os.environ['LANG']="ja_JP.UTF-8"\r
pints=pin.replace(".264",".ts")\r
else:\r
auto_process.deltmpfile(dir, title, ".mp4")\r
def mkv2mp4(pin,pout):\r
- exeb = configreader.getpath(u"mkvextract")\r
- exe = configreader.getpath(u"mp4Box")\r
- #dtsedit=configreader.getpath("DtsEdit")\r
- wineexe=configreader.getpath("wine")\r
+ exeb = configreader.getPathSetting(u"mkvextract")\r
+ exe = configreader.getPath(u"mp4Box")\r
+ #dtsedit=configreader.getPath("DtsEdit")\r
+ wineexe=configreader.getPathSetting("wine")\r
dir=os.path.split(pin)[0]\r
title=os.path.split(pin)[1]\r
title=os.path.splitext(title)[0]\r
if os.path.exists(pout):\r
auto_process.deltmpfile(dir, title, ".mp4")\r
def addCaption(pts,pmp4):##字幕の追加を試みる。\r
- wineexe=configreader.getpath("wine")\r
+ wineexe=configreader.getPathSetting("wine")\r
pincap=pts.replace(".ts",".srt")\r
try:\r
- cap2ass=configreader.getpath("caption2ass")\r
+ cap2ass=configreader.getPathSetting("caption2ass")\r
except:\r
cap2ass=""\r
if os.path.isfile(cap2ass):\r
recdblist.addlog(pts,logt, u"Captionログ-詳細")\r
if os.path.exists(pincap):\r
if os.path.getsize(pincap)>1000:\r
- exe = configreader.getpath("mp4box")\r
+ exe = configreader.getPathSetting("mp4box")\r
e1s=exe +u" -add \""+pincap+"\" \""+pmp4+"\""\r
addmp4(pincap,pmp4,e1s)\r
def addAudio(pts,pmp4,opts):#オプションに応じた音声の追加を行う\r
- exe = configreader.getpath("mp4box")\r
+ exe = configreader.getPathSetting("mp4box")\r
if re.search("d",opts) or re.search("5",opts):#二カ国語放送/5.1ch放送の場合\r
paac1=pts.replace(".ts","_1.aac")\r
paac2=pts.replace(".ts","_2.aac")\r
try:
tv2b25ts(pout + ".b25", ch, time)
except Exception, inst:
- recdblist.Commonlogex(u"Error",u"tv2ts(tv2ts.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX(u"Error",u"tv2ts(tv2ts.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
status.changeBSCSRecording(-1)
else:
except:
""
def tv2b25ts(pout, ch, time):
- exe = configreader.getpath('recpt1')
+ exe = configreader.getPathSetting('recpt1')
if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
status.changeBSCSRecording(1)
else:
try:
doexe = exe + ' ' + ch + ' ' + time + ' \'' + pout + '\''
recdblist.printutf8(doexe)
- recdblist.addlog(pout, doexe, u"recpt1ログ-コマンド")
+ recdblist.addLog(pout, doexe, u"recpt1ログ-コマンド")
recdblist.addlog(pout, unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8'), u"recpt1ログ-詳細")
except Exception, inst:
- recdblist.Commonlogex(u"Error",u"tv2b25ts(tv2ts.py)", str(type(inst)),str(inst))
+ recdblist.addCommonlogEX(u"Error",u"tv2b25ts(tv2ts.py)", str(type(inst)),str(inst))
if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
status.changeBSCSRecording(-1)
else:
status.changeTERecording(-1)
def tv2b25ts_b25(pout, ch, time):
- exe = configreader.getpath('recpt1')
+ exe = configreader.getPathSetting('recpt1')
doexe = exe + ' --b25 ' + ch + ' ' + time + ' \'' + pout + '\''
os.system(doexe)
def b252tsmix(pin, pout):
if not (os.path.exists(pout) and os.path.getsize(pin)>os.path.getsize(pout)*0.95 and os.path.getsize(pin)<os.path.getsize(pout)*1.05):
exe=""
- if configreader.getpath('b25_remote')=="1":
+ if configreader.getPathSetting('b25_remote')=="1":
try:
- exe = configreader.getpath('b25_env')+" && "
+ exe = configreader.getPathSetting('b25_env')+" && "
except:
inst=u"b25_remoteがオンになっていますが、b25_envが設定されていないかコメントアウトされています。"
- recdblist.Commonlogex(u"Error",u"b252tsmix(tv2ts.py)", "",inst)
- exe = exe + "nice -n 17 " + configreader.getpath('b25')
+ recdblist.addCommonlogEX(u"Error",u"b252tsmix(tv2ts.py)", "",inst)
+ exe = exe + "nice -n 17 " + configreader.getPathSetting('b25')
doexe = exe + u' \"' + pin + u'\" \"' + pout + u'\"'
recdblist.printutf8(doexe)
txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
- recdblist.addlog(pin, doexe, u"b25ログ-コマンド")
+ recdblist.addLog(pin, doexe, u"b25ログ-コマンド")
recdblist.addlog(pin, txt, u"b25ログ-詳細")
def tsmix2ts(pin, pout, csch):#csch=0ならcsの処理をしない
- doexe = configreader.getpath("tssplitter") + " \""+ pin + "\" \""+ pout + "\" " + str(csch)
+ doexe = configreader.getPathSetting("tssplitter") + " \""+ pin + "\" \""+ pout + "\" " + str(csch)
doexe = "nice -n 18 " + doexe
os.environ['LANG']="ja_JP.UTF-8"
txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
- recdblist.addlog(pin, doexe, u"TsSplitログ-コマンド")
- recdblist.addlog(pin, txt, u"TsSplitログ-詳細")
+ recdblist.addLog(pin, doexe, u"TsSplitログ-コマンド")
+ recdblist.addLog(pin, txt, u"TsSplitログ-詳細")
time.sleep(1)
if os.access(pout, os.F_OK) and os.path.getsize(pout)>10*1000*1000:
os.remove(pin)
for o in obj:
rc=rc+getText(o)
return rc
-def writemultitvDB(bctype,tvlists):
+def writeMultiTVDB(bctype,tvlists):
rec10d.rec10db.new_epg_timeline(bctype)
for channel,start,stop,title,desc,longdesc,category in tvlists:
rec10d.rec10db.add_epg_timeline(bctype, channel, start, stop, title, desc, longdesc, category)
-def writemultichDB(chlists):
+def writeMultiCHDB(chlists):
for chtxt,dn in chlists:
rec10d.rec10db.update_chname_by_chtxt_epg_ch(chtxt,dn)
def xml2db_dom(xmlpath, bctype):#bctypeは放送種別で'TE'(地デジ)BS,CSがある。地デジの場合は te数字 が入る
longdesc=zenhan.toHankaku_ABC123(getText_item(tv.getElementsByTagName("longdesc")))
category=zenhan.toHankaku_ABC123(getText_item(tv.getElementsByTagName("category")))
title=addTitle_Subtitle(rHisch,1,title,desc)
- tch=chdb.chtxtsearch(channel)
+ tch=chdb.searchFromCHtxt(channel)
if tch!=None:
if tch.get('bctype',"")==bctype:
bt=bayes.get(tch['chtxt'],["","",0])
bt2=[bt[0]+title+" ",bt[1]+desc+" "+longdesc+" ",bt[2]+1]
bayes[tch['chtxt']]=bt2
tvlist.append([channel,start,stop,title,desc,longdesc,category])
- p=auto_rec.calc_key(tch['chtxt'], title,desc+" "+longdesc)
+ p=auto_rec.calcKey(tch['chtxt'], title,desc+" "+longdesc)
if p>2000:
bttt=datetime.datetime.strptime(start,"%Y%m%d%H%M%S")
bttt=bttt-datetime.timedelta(seconds=1200)
maxnum=0
if len(ch['ch'])>2:
maxnum=epgdb.count_schedule_timeline(bttime, ettime)[1]
- maxnum=int(configreader.getenv("bscs_max"))-maxnum
+ maxnum=int(configreader.getEnvSetting("bscs_max"))-maxnum
else:
maxnum=epgdb.count_schedule_timeline(bttime, ettime)[0]
- maxnum=int(configreader.getenv("te_max"))-maxnum
+ maxnum=int(configreader.getEnvSetting("te_max"))-maxnum
if maxnum>0:
topt=status.getSettings_auto_opt()
recdb.recreserv(title,tch['chtxt'], bttime, ettime,topt)
dom.unlink()
if len(chlist) > 0:
- writemultichDB(chlist)
+ writeMultiCHDB(chlist)
chlist = []
if len(tvlist) > 0:
- writemultitvDB(bctype,tvlist)
+ writeMultiTVDB(bctype,tvlist)
tvlist = []
for ct,list in bayes.items():
- auto_rec.update_recall(ct,list[0],list[1],list[2])
- auto_rec.update_recall("ALL",list[0],list[1],list[2])
+ auto_rec.updateRecall(ct,list[0],list[1],list[2])
+ auto_rec.updateRecall("ALL",list[0],list[1],list[2])
dtb=datetime.datetime.now()-dtb
recdblist.printutf8(bctype + u" epg取り出し終了")
recdblist.printutf8(str(dtb.days * 24 * 60 * 60 + dtb.seconds)+u"seconds taken for updating bayes-auto DB .")
else:
newtitle=title
except Exception, inst:
- recdblist.Commonlogex("Error", "addTitle_Subtitle(xml2db_dob.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+ recdblist.addCommonlogEX("Error", "addTitle_Subtitle(xml2db_dob.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
newtitle=title
return newtitle
\ No newline at end of file
s = h_number[i]
retstr = retstr + s
return retstr
-def check_Character_Type(character):
+def checkCharacterType(character):
"""
return code is 1:Alphabet 2:Hiragana 3:Katakana 4:Kanji
"""