From: gn64_jp Date: Wed, 25 Nov 2009 12:18:29 +0000 (+0000) Subject: change many function. X-Git-Url: http://git.osdn.net/view?p=rec10%2Frec10-git.git;a=commitdiff_plain;h=b7ca5813a4ee351109e87c25d2e77bfa6e32f22d change many function. git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@252 4e526526-5e11-4fc0-8910-f8fd03428081 --- diff --git a/rec10/trunk/src/auto_process.py b/rec10/trunk/src/auto_process.py index a7b1f3c..45de50b 100644 --- a/rec10/trunk/src/auto_process.py +++ b/rec10/trunk/src/auto_process.py @@ -56,7 +56,7 @@ def auto_check(path): tslist = glob.glob(path+"/*.ts") b25list = glob.glob(path+"/*.ts.b25") filelist=avilist+mkvlist+tslist+b25list - rec10d.rec10db.new_procstatus() + rec10d.rec10db.new_auto_proc() for fn in filelist: if fn.rfind("sa.avi")==-1: dir = os.path.split(fn)[0] @@ -67,13 +67,13 @@ def auto_check(path): title=title.replace(".ts","") proc=check_process(dir, title) if proc=="b25": - rec10d.rec10db.add_procstatus(recdb.REC_AUTO_SUGGEST_DECODE,title) + rec10d.rec10db.add_auto_proc(recdb.REC_AUTO_SUGGEST_DECODE,title) elif proc=="ts": - rec10d.rec10db.add_procstatus(recdb.REC_AUTO_SUGGEST_ENCODE,title) + rec10d.rec10db.add_auto_proc(recdb.REC_AUTO_SUGGEST_ENCODE,title) elif proc =="avi": - rec10d.rec10db.add_procstatus(recdb.REC_AUTO_SUGGEST_AVI2MP4,title) + rec10d.rec10db.add_auto_proc(recdb.REC_AUTO_SUGGEST_AVI2MP4,title) elif proc =="mkv": - rec10d.rec10db.add_procstatus(recdb.REC_AUTO_SUGGEST_MKV2MP4,title) + rec10d.rec10db.add_auto_proc(recdb.REC_AUTO_SUGGEST_MKV2MP4,title) """ 処理がどの段階まで言ったのかを調査し返す。 return diff --git a/rec10/trunk/src/auto_rec.py b/rec10/trunk/src/auto_rec.py index 162adeb..f15ff84 100644 --- a/rec10/trunk/src/auto_rec.py +++ b/rec10/trunk/src/auto_rec.py @@ -5,28 +5,28 @@ import n_gram import rec10d def get_db_key(key,chtxt): - return rec10d.rec10db.select_by_key_bayeskey(key, chtxt) + return rec10d.rec10db.select_by_key_in_auto_bayes_key(key, chtxt) def change_db_epg(chtxt,beforenum,newnum): - rec10d.rec10db.change_ratio_all_reduce_bayeskey(chtxt, beforenum, newnum) + rec10d.rec10db.change_ratio_all_reduce_in_auto_bayes_key(chtxt, beforenum, newnum) def change_db_num(chtxt,recaddnum,alladdnum): """ add num.(Not change) """ - rec10d.rec10db.add_num_bayeskey(chtxt, recaddnum,alladdnum) + rec10d.rec10db.add_num_in_auto_bayes_key(chtxt, recaddnum,alladdnum) def change_db_ratio_rec(key,chtxt,beforenum,addnum): - rec10d.rec10db.change_ratio_rec_bayeskey(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): - rec10d.rec10db.change_multi_ratio_rec_bayeskey(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): - rec10d.rec10db.change_ratio_rec_reduce_bayeskey(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): - rec10d.rec10db.change_ratio_all_bayeskey(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): - rec10d.rec10db.change_multi_ratio_all_bayeskey(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) if len(ret)<3: - rec10d.rec10db.add_bayeskey("NUM", chtxt, 1,1) + rec10d.rec10db.add_in_auto_bayes_key("NUM", chtxt, 1,1) ret=get_db_key("NUM", chtxt) return ret def update_recall(chtxt,titles,descs,newnum): diff --git a/rec10/trunk/src/chdata.py b/rec10/trunk/src/chdata.py index be228c4..8d2110c 100644 --- a/rec10/trunk/src/chdata.py +++ b/rec10/trunk/src/chdata.py @@ -6,7 +6,7 @@ import rec10d #CS放送では複数のチャンネルを指定する必要があるためチャンネル名をテキストデータで持っておき(chtxt)、必要に応じて変換する #ontvはepgデータなどで指定されている名前 #ここの設定は愛知県の設定(+CS放送スカパーe2 +BS) -rec10d.rec10db.new_chdata() +rec10d.rec10db.new_epg_ch() def chadd(bctype, ontv, chtxt, ch, csch):#すべて文字列 """ ChannelDBに指定したデータを追加する @@ -20,7 +20,7 @@ def chadd(bctype, ontv, chtxt, ch, csch):#すべて文字列 uchtxt = unicode(chtxt) uch = unicode(ch) ucsch = unicode(csch) - rec10d.rec10db.add_chdata(ubct, uontv, uchtxt, uch, ucsch, u"2009-04-01 00:00:00") + rec10d.rec10db.add_epg_ch(ubct, uontv, uchtxt, uch, ucsch, u"2009-04-01 00:00:00") #チャンネルの設定 #chadd('放送種別','ontvコード(ontvのサイトなどで調べられる)','略称(何でもよい)','チャンネル(物理チャンネル)','CS放送の場合の内訳') diff --git a/rec10/trunk/src/chdb.py b/rec10/trunk/src/chdb.py index 361a9a3..0a55525 100644 --- a/rec10/trunk/src/chdb.py +++ b/rec10/trunk/src/chdb.py @@ -7,7 +7,7 @@ import rec10d def ontvsearch(ontvin): ret = [] - for datum in rec10d.rec10db.select_by_ontv_chdata(ontvin): + for datum in rec10d.rec10db.select_by_ontv_epg_ch(ontvin): rett = {'bctype':datum[0], 'ontv':datum[1], 'chtxt':datum[2], 'ch':datum[3], 'csch':datum[4], 'update':datum[5]} ret.append(rett) if len(ret) == 0: @@ -15,7 +15,7 @@ def ontvsearch(ontvin): return ret[0] def chtxtsearch(chtxtin): ret = [] - for datum in rec10d.rec10db.select_by_chtxt_chdata(chtxtin): + for datum in rec10d.rec10db.select_by_chtxt_epg_ch(chtxtin): rett = {'bctype':datum[0], 'ontv':datum[1], 'chtxt':datum[2], 'ch':datum[3], 'csch':datum[4], 'update':datum[5]} ret.append(rett) if len(ret) == 0: @@ -23,7 +23,7 @@ def chtxtsearch(chtxtin): return ret[0] def bctypesearch(bctypein): ret = [] - for datum in rec10d.rec10db.select_by_bctype_chdata(bctypein): + for datum in rec10d.rec10db.select_by_bctype_epg_ch(bctypein): rett = {'bctype':datum[0], 'ontv':datum[1], 'chtxt':datum[2], 'ch':datum[3], 'csch':datum[4], 'update':datum[5]} ret.append(rett) if len(ret) == 0: @@ -31,7 +31,7 @@ def bctypesearch(bctypein): return ret[0] def chsearch(chin): ret = [] - for datum in rec10d.rec10db.select_by_ch_chdata(chin): + for datum in rec10d.rec10db.select_by_ch_epg_ch(chin): rett = {'bctype':datum[0], 'ontv':datum[1], 'chtxt':datum[2], 'ch':datum[3], 'csch':datum[4], 'update':datum[5]} ret.append(rett) if len(ret) == 0: @@ -39,7 +39,7 @@ def chsearch(chin): return ret[0] def getall(): ret = [] - for datum in rec10d.rec10db.select_all_chdata(): + for datum in rec10d.rec10db.select_all_epg_ch(): rett = {'bctype':datum[0], 'ontv':datum[1], 'chtxt':datum[2], 'ch':datum[3], 'csch':datum[4], 'update':datum[5]} ret.append(rett) if len(ret) == 0: @@ -50,7 +50,7 @@ def update(): CSupdate = 0 CS2update = 0 BSupdate = 0 - for datum in rec10d.rec10db.select_get_update_chdata("6"): + for datum in rec10d.rec10db.select_get_update_epg_ch("6"): bctype = datum[0] if bctype == "cs1" or bctype == u"cs1": if CSupdate == 0: diff --git a/rec10/trunk/src/dbMySQL.py b/rec10/trunk/src/dbMySQL.py index 837e4bc..cae6164 100644 --- a/rec10/trunk/src/dbMySQL.py +++ b/rec10/trunk/src/dbMySQL.py @@ -27,7 +27,7 @@ class DB_MySQL: db = self.connect_db() try: db[1].execute('\ - CREATE TABLE rectime \ + CREATE TABLE main_timetable \ (\ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,\ type VARCHAR(20),\ @@ -43,12 +43,12 @@ class DB_MySQL: except: "" self.close_db(db) - self.new_tv("") - self.new_ch("") - self.new_reclog() - self.new_bayeskey() - self.new_recjbk() - self.new_procstatus() + self.new_epg_timeline("") + self.new_epg_ch("") + self.new_in_timeline_log() + self.new_in_auto_bayes_key() + self.new_in_auto_jbk_key() + self.new_auto_proc() def connect_db(self): """ dbへの接続 @@ -60,39 +60,40 @@ class DB_MySQL: def close_db(self, db): db[1].close() db[0].close() - def new_chdata(self): + def new_epg_ch(self): db = self.connect_db() try: - db[1].execute('drop table chdata') + db[1].execute('drop table epg_ch') except: "" try: db[1].execute('\ - CREATE TABLE chdata \ + CREATE TABLE epg_ch \ (\ bctype VARCHAR(15),\ ontv VARCHAR(30) PRIMARY KEY,\ chtxt VARCHAR(15),\ ch VARCHAR(20),\ csch VARCHAR(20),\ + chname VARCHAR(40),\ updatetime DATETIME,\ status TINYINT\ )') except: "" self.close_db(db) - def add_chdata(self, bctype, ontv, chtxt, ch, csch, updatetime): + def add_epg_ch(self, bctype, ontv, chtxt, ch, csch, updatetime): db = self.connect_db() db[1].execute('\ - INSERT INTO chdata \ - VALUES (%s,%s,%s,%s,%s,%s,%s)', \ + INSERT INTO epg_ch \ + VALUES (%s,%s,%s,%s,%s,"",%s,%s)', \ (bctype, ontv, chtxt, ch, csch, updatetime, "1")) self.close_db(db) - def select_by_ontv_chdata(self, ontv): + def select_by_ontv_epg_ch(self, ontv): db = self.connect_db() dbexe = db[1].execute("\ SELECT bctype,ontv,chtxt,ch,csch,updatetime \ - FROM chdata \ + FROM epg_ch \ WHERE ontv = %s", \ (ontv,)) ret = [] @@ -105,11 +106,11 @@ class DB_MySQL: r[5] = r[5].strftime("%Y-%m-%d %H:%M:%S") ret.append(r) return ret - def select_by_chtxt_chdata(self, chtxt): + def select_by_chtxt_epg_ch(self, chtxt): db = self.connect_db() dbexe = db[1].execute("\ SELECT bctype,ontv,chtxt,ch,csch,updatetime \ - FROM chdata \ + FROM epg_ch \ WHERE chtxt = %s", \ (chtxt,)) ret = [] @@ -122,11 +123,11 @@ class DB_MySQL: r[5] = r[5].strftime("%Y-%m-%d %H:%M:%S") ret.append(r) return ret - def select_by_bctype_chdata(self, bctype): + def select_by_bctype_epg_ch(self, bctype): db = self.connect_db() dbexe = db[1].execute("\ SELECT bctype,ontv,chtxt,ch,csch,updatetime,status \ - FROM chdata \ + FROM epg_ch \ WHERE bctype = %s", \ (bctype,)) ret = [] @@ -141,12 +142,12 @@ class DB_MySQL: r[6] = str(r[6]) ret.append(r) return ret - def select_by_ch_chdata(self, ch): + def select_by_ch_epg_ch(self, ch): db = self.connect_db() dbexe = db[1].execute("\ SELECT \ bctype,ontv,chtxt,ch,csch,updatetime \ - FROM chdata \ + FROM epg_ch \ WHERE ch = %s", \ (ch,)) ret = [] @@ -159,11 +160,11 @@ class DB_MySQL: r[5] = r[5].strftime("%Y-%m-%d %H:%M:%S") ret.append(r) return ret - def select_all_chdata(self): + def select_all_epg_ch(self): db = self.connect_db() dbexe = db[1].execute("\ SELECT bctype,ontv,chtxt,ch,csch,updatetime \ - FROM chdata \ + FROM epg_ch \ ") ret = [] dls = [] @@ -175,9 +176,9 @@ class DB_MySQL: r[5] = r[5].strftime("%Y-%m-%d %H:%M:%S") ret.append(r) return ret - def select_get_update_chdata(self, dhour): + def select_get_update_epg_ch(self, dhour): db = self.connect_db() - dbexe = db[1].execute("SELECT bctype,chtxt,status FROM chdata \ + dbexe = db[1].execute("SELECT bctype,chtxt,status FROM epg_ch \ WHERE \ ( \ updatetime < DATE_SUB(now(),INTERVAL " + dhour + " HOUR) \ @@ -193,53 +194,62 @@ class DB_MySQL: ret = db[1].fetchall() self.close_db(db) return ret - def update_by_bctype_chdata(self, bctype): + def update_by_bctype_epg_ch(self, bctype): db = self.connect_db() db[1].execute("\ - UPDATE chdata \ + UPDATE epg_ch \ SET \ updatetime=now() , \ status = 1 \ WHERE bctype = %s", (bctype,)) self.close_db(db) - def update_by_bctype_and_chtxt_chdata(self, bctype, chtxt): + def update_by_bctype_and_chtxt_epg_ch(self, bctype, chtxt): db = self.connect_db() db[1].execute("\ - UPDATE chdata \ + UPDATE epg_ch \ SET \ updatetime=now() , \ status = 1\ WHERE bctype = %s AND chtxt = %s", (bctype, chtxt)) self.close_db(db) - def update_status_by_bctype_chdata(self, bctype, status): + def update_status_by_bctype_epg_ch(self, bctype, status): db = self.connect_db() db[1].execute("\ - UPDATE chdata \ + UPDATE epg_ch \ SET \ status=%s \ WHERE bctype = %s", \ (status, bctype)\ ) self.close_db(db) - - def add_procstatus(self,type,title): + def update_chname_by_ontv_epg_ch(self,ontv,chname): + db = self.connect_db() + db[1].execute("\ + UPDATE epg_ch \ + SET \ + chname=%s \ + WHERE ontv = %s", \ + (chname, ontv)\ + ) + self.close_db(db) + def add_auto_proc(self,type,title): db = self.connect_db() db[1].execute('\ - INSERT IGNORE into procstatus \ + INSERT IGNORE into auto_proc \ (type,title) \ values (%s,%s)', \ ( type, title)) ##db.commit() self.close_db(db) - def new_procstatus(self): + def new_auto_proc(self): db = self.connect_db() try: - db[1].execute('drop table procstatus') + db[1].execute('drop table auto_proc') except: "" try: db[1].execute('\ - CREATE TABLE procstatus \ + CREATE TABLE auto_proc \ (\ type VARCHAR(20),\ title VARCHAR(100) PRIMARY KEY,\ @@ -248,31 +258,31 @@ class DB_MySQL: except: "" self.close_db(db) - def add_reclog(self , chtxt="", title="", btime="", etime="", opt="", exp="", longexp="", category=""): + def add_in_timeline_log(self , chtxt="", title="", btime="", etime="", opt="", exp="", longexp="", category=""): db = self.connect_db() db[1].execute('\ - INSERT IGNORE into reclog \ + INSERT IGNORE into in_timeline_log \ (chtxt,title,btime,etime,opt,exp,longexp,category) \ values (%s,%s,%s,%s,%s,%s,%s,%s)', \ ( chtxt, title, btime, etime, opt,exp,longexp,category)) ##db.commit() self.close_db(db) - def del_reclog(self, title="", chtxt="", btime=""): + def del_in_timeline_log(self, title="", chtxt="", btime=""): """ """ db = self.connect_db() db[1].execute("\ - DELETE FROM reclog \ + DELETE FROM in_timeline_log \ WHERE title = %s AND chtxt = %s AND btime = %s", \ (title, chtxt, btime)) #db.commit() self.close_db(db) - def new_reclog(self): + def new_in_timeline_log(self): db = self.connect_db() try: db[1].execute('\ - CREATE TABLE reclog \ + CREATE TABLE in_timeline_log \ (\ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,\ chtxt VARCHAR(20),\ @@ -288,32 +298,32 @@ class DB_MySQL: except: "" self.close_db(db) - def add_rectime(self, type="", chtxt="", title="", btime="", etime="", deltatime="", deltaday="", opt=""): + def add_main_timetable(self, type="", chtxt="", title="", btime="", etime="", deltatime="", deltaday="", opt=""): db = self.connect_db() db[1].execute('\ - INSERT IGNORE into rectime \ + INSERT IGNORE into main_timetable \ (type,chtxt,title,btime,etime,deltatime,deltaday,opt) \ values (%s,%s,%s,%s,%s,%s,%s,%s)', \ (type, chtxt, title, btime, etime, deltatime, deltaday, opt)) ##db.commit() self.close_db(db) - def del_rectime(self, type="", title="", chtxt="", btime=""): + def del_main_timetable(self, type="", title="", chtxt="", btime=""): """ """ db = self.connect_db() db[1].execute("\ - DELETE FROM rectime \ + DELETE FROM main_timetable \ WHERE type = %s AND title = %s AND chtxt = %s AND btime = %s", \ (type, title, chtxt, btime)) #db.commit() self.close_db(db) - def select_all_rectime(self): + def select_all_main_timetable(self): db = self.connect_db() recdata = [] dbr = db[1].execute("\ SELECT type, chtxt, title, btime, etime, deltatime ,deltaday ,opt \ - FROM rectime") + FROM main_timetable") dbl = db[1].fetchall() self.close_db(db) if dbr > 0: @@ -341,13 +351,13 @@ class DB_MySQL: recdata.append(ret) self.close_db(db) return recdata - def select_bytime_rectime(self, dminutes): + def select_bytime_main_timetable(self, dminutes): db = self.connect_db() recdatum = [] #dbr=db[1].execute("SELECT type, chtxt, title, btime, etime, deltatime ,deltaday ,opt FROM rectime WHERE btime < DATE_SUB(now(),INTERVAL "+dminutes+" MINUTE ) AND btime > DATE_ADD(now(),INTERVAL "+dminutes+" MINUTE )") dbr = db[1].execute("SELECT \ type, chtxt, title, btime, etime, deltatime ,deltaday ,opt \ - FROM rectime \ + FROM main_timetable \ WHERE btime BETWEEN DATE_SUB(now(),INTERVAL " + dminutes + " MINUTE ) AND \ DATE_ADD(now(),INTERVAL " + dminutes + " MINUTE )") dbl = db[1].fetchall() @@ -375,19 +385,19 @@ class DB_MySQL: ret['deltaday'] = deltaday recdatum.append(ret) return recdatum - def delete_old_rectime(self, dhour): + def delete_old_main_timetable(self, dhour): db = self.connect_db() db[1].execute("\ - DELETE FROM rectime \ + DELETE FROM main_timetable \ WHERE \ btime < DATE_SUB(now(),INTERVAL " + dhour + " HOUR )") #db.commit() self.close_db(db) - def new_recjbk(self): + def new_in_auto_jbk_key(self): db = self.connect_db() try: db[1].execute("\ - CREATE TABLE recjbk \ + CREATE TABLE in_auto_jbk_key \ (\ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,\ keyword VARCHAR(200),\ @@ -396,31 +406,31 @@ class DB_MySQL: except: "" self.close_db(db) - def add_recjbk(self,key): + def add_in_auto_jbk_key(self,key): db = self.connect_db() db[1].execute('\ - INSERT IGNORE into recjbk \ + INSERT IGNORE into in_auto_jbk_key \ (keyword) \ values (%s)', \ (key,)) ##db.commit() self.close_db(db) - def select_all_recjbk(self): + def select_all_in_auto_jbk_key(self): db = self.connect_db() dbexe = db[1].execute("\ SELECT keyword \ - FROM recjbk \ + FROM in_auto_jbk_key \ ") ret = [] if dbexe > 0: ret = db[1].fetchall() self.close_db(db) return ret - def new_status(self): + def new_in_status(self): db = self.connect_db() try: db[1].execute("\ - CREATE TABLE status \ + CREATE TABLE in_status \ (\ ts2avi TINYINT DEFAULT 0,\ terec TINYINT DEFAULT 0,\ @@ -432,11 +442,11 @@ class DB_MySQL: "" self.close_db(db) - def select_all_status(self): + def select_all_in_status(self): db = self.connect_db() dbexe = db[1].execute("\ SELECT ts2avi,terec,bscsrec,b252ts \ - FROM status \ + FROM in_status \ ") ret = [] dls = [] @@ -452,54 +462,54 @@ class DB_MySQL: ret.append(r) return ret self.close_db(db) - def change_ts2avi_status(self,i): + def change_ts2avi_in_status(self,i): """ statuをiだけ増減する iはint """ db = self.connect_db() db[1].execute("\ - UPDATE status SET ts2avi=ts2avi+%s",i) + UPDATE in_status SET ts2avi=ts2avi+%s",i) self.close_db(db) - def change_terec_status(self,i): + def change_terec_in_status(self,i): """ statuをiだけ増減する iはint """ db = self.connect_db() db[1].execute("\ - UPDATE status SET terec=terec+%s",i) + UPDATE in_status SET terec=terec+%s",i) self.close_db(db) - def change_bscsrec_status(self,i): + def change_bscsrec_in_status(self,i): """ statuをiだけ増減する iはint """ db = self.connect_db() db[1].execute("\ - UPDATE status SET bscsrec=bscsrec+%s",i) + UPDATE in_status SET bscsrec=bscsrec+%s",i) self.close_db(db) - def change_b252ts_status(self,i): + def change_b252ts_in_status(self,i): """ statuをiだけ増減する iはint """ db = self.connect_db() db[1].execute("\ - UPDATE status SET b252ts=b252ts+%s",i) + UPDATE in_status SET b252ts=b252ts+%s",i) self.close_db(db) - def new_tv(self, bctype): + def new_epg_timeline(self, bctype): db = self.connect_db() try: db[1].execute("\ - DELETE FROM tv \ + DELETE FROM epg_timeline \ WHERE bctype = %s", \ (bctype,)) except: "" try: db[1].execute("\ - CREATE TABLE tv \ + CREATE TABLE epg_timeline \ (\ bctype VARCHAR(20),\ channel VARCHAR(100) NOT NULL,\ @@ -515,34 +525,34 @@ class DB_MySQL: "" #db.commit() self.close_db(db) - def add_tv(self, bctype, channel, start, stop, title, desc,longdesc, category): + def add_epg_timeline(self, bctype, channel, start, stop, title, desc,longdesc, category): db = self.connect_db() db[1].execute('\ - INSERT IGNORE INTO tv \ + INSERT IGNORE INTO epg_timeline \ VALUES (%s,%s,%s,%s,%s,%s,%s,%s)', \ (bctype, channel, start, stop, title, desc,longdesc,category)) #db.commit() self.close_db(db) - def add_multi_tv(self, tvlists): + def add_multi_epg_timeline(self, tvlists): """ tvlists is (bctype,channel,start,stop,title,desc,longdesc,category) lists. """ db = self.connect_db() db[1].executemany('\ - INSERT IGNORE INTO tv \ + INSERT IGNORE INTO epg_timeline \ (bctype,channel,start,stop,title,exp,longexp,category) \ values(%s,%s,%s,%s,%s,%s,%s,%s)', \ tvlists) #db.commit() self.close_db(db) - def select_by_time_ngram_tv(self, btime, etime, chtxt): + def select_by_time_ngram_epg_timeline(self, btime, etime, chtxt): db = self.connect_db() dbexe = "\ SELECT \ chdata.chtxt,title,start,stop,exp,longexp,category \ - FROM tv \ + FROM epg_timeline \ INNER JOIN chdata \ - WHERE chdata.ontv=tv.channel \ + WHERE chdata.ontv=epg_timeline.channel \ AND \ start >= %s \ AND \ @@ -555,14 +565,14 @@ class DB_MySQL: retall = db[1].fetchall() self.close_db(db) return retall - def select_by_time_auto_suggest_tv(self,keyword,btime,etime): + def select_by_time_auto_suggest_epg_timeline(self,keyword,btime,etime): db = self.connect_db() dbexe = "\ SELECT \ chdata.chtxt,title,start,stop,exp,longexp,category \ - FROM tv \ + FROM epg_timeline \ INNER JOIN chdata \ - WHERE chdata.ontv=tv.channel \ + WHERE chdata.ontv=epg_timeline.channel \ AND \ start >= %s \ AND \ @@ -581,7 +591,7 @@ class DB_MySQL: retall = db[1].fetchall() self.close_db(db) return retall - def new_ch(self, bctype): + def new_epg_ch(self, bctype): db = self.connect_db() try: db[1].execute("DELETE FROM ch WHERE bctype = %s", (bctype,)) @@ -589,7 +599,7 @@ class DB_MySQL: "" try: db[1].execute('\ - CREATE TABLE ch \ + CREATE TABLE epg_ch \ (\ bctype VARCHAR(20),\ channel VARCHAR(20) NOT NULL,\ @@ -600,22 +610,22 @@ class DB_MySQL: "" #db.commit() self.close_db(db) - def add_ch(self, bctype, channel, display): - db = self.connect_db() - db[1].execute('INSERT IGNORE INTO ch VALUES (%s,%s,%s)', (bctype, channel, display)) + #def add_epg_ch(self, bctype, channel, display): + # db = self.connect_db() + ## db[1].execute('INSERT IGNORE INTO epg_ch VALUES (%s,%s,%s)', (bctype, channel, display)) #db.commit() - self.close_db(db) - def add_multi_ch(self, chlists): - """ - chlists is (bctype,channel,display) lists - """ - db = self.connect_db() - db[1].executemany('INSERT IGNORE INTO ch VALUES (%s,%s,%s)', chlists) - self.close_db(db) - def new_bayeskey(self): + # self.close_db(db) + #def add_multi_ch(self, chlists): + # """ + # chlists is (bctype,channel,display) lists + ## """ + # db = self.connect_db() + # db[1].executemany('INSERT IGNORE INTO ch VALUES (%s,%s,%s)', chlists) + # self.close_db(db) + def new_in_auto_bayes_key(self): db = self.connect_db() try: - db[1].execute('CREATE TABLE bayeskey \ + db[1].execute('CREATE TABLE in_auto_bayes_key \ (\ keychar VARCHAR(10),\ chtxt VARCHAR(20),\ @@ -623,55 +633,55 @@ class DB_MySQL: ratio_all DECIMAL(32,14),\ UNIQUE unibayeskey(keychar,chtxt)\ )') - db[1].execute('CREATE INDEX keycharindex ON bayeskey(keychar)') + db[1].execute('CREATE INDEX keycharindex ON in_auto_bayes_key(keychar)') except: "" self.close_db(db) - def add_bayeskey(self,key,chtxt,ratio_rec,ratio_all): + def add_in_auto_bayes_key(self,key,chtxt,ratio_rec,ratio_all): db = self.connect_db() ratio_rec=str(ratio_rec) ratio_all=str(ratio_all) db[1].execute('\ - INSERT IGNORE INTO bayeskey \ + INSERT IGNORE INTO in_auto_bayes_key \ (keychar,chtxt,ratio_rec,ratio_all) \ values (%s,%s,%s,%s)',\ (key,chtxt,ratio_rec,ratio_all)) self.close_db(db) - def add_num_bayeskey(self,chtxt,add_rec_num,add_all_num): + def add_num_in_auto_bayes_key(self,chtxt,add_rec_num,add_all_num): db = self.connect_db() add_rec_num=str(add_rec_num) add_all_num=str(add_all_num) db[1].execute("\ - UPDATE bayeskey SET ratio_rec=CONVERT(ratio_rec+%s,DECIMAL(32,14)),ratio_all=CONVERT(ratio_all+%s,DECIMAL(32,14)) WHERE keychar=\"NUM\" AND chtxt=%s",\ + UPDATE in_auto_bayes_key SET ratio_rec=CONVERT(ratio_rec+%s,DECIMAL(32,14)),ratio_all=CONVERT(ratio_all+%s,DECIMAL(32,14)) WHERE keychar=\"NUM\" AND chtxt=%s",\ (add_rec_num,add_all_num,chtxt)) self.close_db(db) - def change_bayeskey(self,key,chtxt,new_ratio_rec,new_ratio_all): + def change_in_auto_bayes_key(self,key,chtxt,new_ratio_rec,new_ratio_all): """ """ db = self.connect_db() db[1].execute("\ - UPDATE bayeskey SET ratio_rec=%s,ratio_all=%s WHERE keychar=%s AND chtxt=%s",(str(new_ratio_rec),str(new_ratio_all),key,chtxt)\ + UPDATE in_auto_bayes_key SET ratio_rec=%s,ratio_all=%s WHERE keychar=%s AND chtxt=%s",(str(new_ratio_rec),str(new_ratio_all),key,chtxt)\ ) self.close_db(db) - def change_ratio_all_reduce_bayeskey(self,chtxt,beforenum,newnum): + def change_ratio_all_reduce_in_auto_bayes_key(self,chtxt,beforenum,newnum): beforenum=str(beforenum) newnum=str(newnum) db = self.connect_db() db[1].execute("\ - UPDATE bayeskey SET ratio_all=CONVERT(ratio_all*%s/(%s+%s),DECIMAL(32,14)) WHERE chtxt=%s AND NOT (keychar=\"NUM\")",(beforenum,newnum,beforenum,chtxt)\ + UPDATE in_auto_bayes_key SET ratio_all=CONVERT(ratio_all*%s/(%s+%s),DECIMAL(32,14)) WHERE chtxt=%s AND NOT (keychar=\"NUM\")",(beforenum,newnum,beforenum,chtxt)\ ) self.close_db(db) - def change_ratio_all_bayeskey(self,key,chtxt,beforenum,addnum): + def change_ratio_all_in_auto_bayes_key(self,key,chtxt,beforenum,addnum): db = self.connect_db() beforenumf=beforenum beforenum=str(beforenum) - db[1].execute("INSERT INTO bayeskey (keychar,chtxt,ratio_rec,ratio_all) \ + db[1].execute("INSERT INTO in_auto_bayes_key (keychar,chtxt,ratio_rec,ratio_all) \ VALUES (%s,%s,%s,%s)\ ON DUPLICATE KEY UPDATE \ ratio_all=CONVERT((ratio_all*%s+%s)/%s,DECIMAL(32,14))",(key,chtxt,"0",str(Decimal(addnum)/beforenumf),beforenum,chtxt,key)) self.close_db(db) - def change_multi_ratio_all_bayeskey(self,chtxt,beforenum,list): + def change_multi_ratio_all_in_auto_bayes_key(self,chtxt,beforenum,list): """ list={key:addnum}のリスト """ @@ -680,44 +690,44 @@ class DB_MySQL: db = self.connect_db() for i,j in list.items(): retl=(i,chtxt,"0",str(Decimal(j)/beforenumf),beforenum,str(j),beforenum) - db[1].execute("INSERT INTO bayeskey (keychar,chtxt,ratio_rec,ratio_all) \ + db[1].execute("INSERT INTO in_auto_bayes_key (keychar,chtxt,ratio_rec,ratio_all) \ VALUES (%s,%s,%s,%s)\ ON DUPLICATE KEY UPDATE \ ratio_all=CONVERT((ratio_all*%s+%s)/%s,DECIMAL(32,14))",retl) self.close_db(db) - def change_ratio_rec_reduce_bayeskey(self,chtxt,beforenum,newnum): + def change_ratio_rec_reduce_in_auto_bayes_key(self,chtxt,beforenum,newnum): beforenum=str(beforenum) newnum=str(newnum) db = self.connect_db() db[1].execute("\ - UPDATE bayeskey SET ratio_rec=CONVERT(ratio_rec*%s/(%s+%s),DECIMAL(32,14)) WHERE chtxt=%s AND NOT (keychar=\"NUM\")",(beforenum,newnum,beforenum,chtxt)\ + UPDATE in_auto_bayes_key SET ratio_rec=CONVERT(ratio_rec*%s/(%s+%s),DECIMAL(32,14)) WHERE chtxt=%s AND NOT (keychar=\"NUM\")",(beforenum,newnum,beforenum,chtxt)\ ) self.close_db(db) - def change_ratio_rec_bayeskey(self,key,chtxt,beforenum,addnum): + def change_ratio_rec_in_auto_bayes_key(self,key,chtxt,beforenum,addnum): db = self.connect_db() beforenumf=beforenum beforenum=str(beforenum) - db[1].execute("INSERT INTO bayeskey (keychar,chtxt,ratio_rec,ratio_all) \ + db[1].execute("INSERT INTO in_auto_bayes_key (keychar,chtxt,ratio_rec,ratio_all) \ VALUES (%s,%s,%s,%s)\ ON DUPLICATE KEY UPDATE \ ratio_rec=CONVERT((ratio_rec*%s+%s)/%s,DECIMAL(32,14))",(key,chtxt,str(Decimal(addnum)/beforenumf),"0",beforenum,chtxt,key)) self.close_db(db) - def change_multi_ratio_rec_bayeskey(self,chtxt,beforenum,list):#self,key,chtxt,beforenum,addnum): + def change_multi_ratio_rec_in_auto_bayes_key(self,chtxt,beforenum,list):#self,key,chtxt,beforenum,addnum): beforenumf=beforenum beforenum=str(beforenum) db = self.connect_db() for i,j in list.items(): retl=(i,chtxt,str(Decimal(j)/beforenumf),"0",beforenum,str(j),beforenum) - db[1].execute("INSERT INTO bayeskey (keychar,chtxt,ratio_rec,ratio_all) \ + db[1].execute("INSERT INTO in_auto_bayes_key (keychar,chtxt,ratio_rec,ratio_all) \ VALUES (%s,%s,%s,%s)\ ON DUPLICATE KEY UPDATE \ ratio_rec=CONVERT((ratio_rec*%s+%s)/%s,DECIMAL(32,14))",retl) self.close_db(db) - def select_by_key_bayeskey(self,key,chtxt): + def select_by_key_in_auto_bayes_key(self,key,chtxt): db = self.connect_db() dbexe = db[1].execute("\ SELECT keychar,chtxt,ratio_rec,ratio_all \ - FROM bayeskey \ + FROM in_auto_bayes_key \ WHERE keychar = %s AND chtxt = %s", \ (key,chtxt)) dls = [] diff --git a/rec10/trunk/src/dbviewer.py b/rec10/trunk/src/dbviewer.py deleted file mode 100644 index f726dcb..0000000 --- a/rec10/trunk/src/dbviewer.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/python -# coding: UTF-8 -# Rec10 TS Recording Tools -# Copyright (C) 2009 Yukikaze -import rec10d -import recdb -tasks = recdb.getall() -print "チャンネルデータ" -for bctype, ontv, chtxt, ch, csch, updatetime in rec10d.rec10db.select_all_chdata(): - print {"txt":bctype + "," + ontv + "," + chtxt + "," + ch + "," + csch + "," + updatetime, "ch":ch} -print "録画予約" -for task in tasks: - #value=line.split(",") - if task["type"] == "res":#"res,"+chtxt+","+title+","+btime+","+etime+","+opt - chtxt = task['chtxt'] - title = task['title'] - btime = task['btime'] - etime = task['etime'] - opt = task['opt'] - print "録画予約" + "," + chtxt + "," + title + "," + btime + "," + etime + "," + opt - elif task["type"] == "key":#"key,"+chtxt+","+keyword+","+btime+","+deltatime+","+opt - chtxt = task['chtxt'] - #title=task['title'] - btime = task['btime'] - #etime=task['etime'] - keyword = task['title'] - deltatime = task['deltatime'] - opt = task['opt'] - print "検索予約" + "," + chtxt + "," + keyword + "," + btime + "," + deltatime + "," + opt - elif task["type"] == "keyevery":#"keyevery,"+chtxt+","+keyword+","+btime+","+deltatime+","+opt+","+deltaday - chtxt = task['chtxt'] - #title=task['title'] - btime = task['btime'] - #etime=task['etime'] - keyword = task['title'] - deltatime = task['deltatime'] - opt = task['opt'] - deltaday = task['deltaday'] - print "隔日予約" + "," + chtxt + "," + keyword + "," + btime + "," + deltatime + "," + opt + "," + deltaday - elif task["type"] == "rec":#"rec,"+chtxt+","+title+","+btime+","+etime+","+opt - chtxt = task['chtxt'] - title = task['title'] - print title - btime = task['btime'] - etime = task['etime'] - opt = task['opt'] - print "予約最終" + "," + chtxt + "," + title + "," + btime + "," + etime + "," + opt - diff --git a/rec10/trunk/src/epgdb.py b/rec10/trunk/src/epgdb.py index 07caf03..494ac22 100644 --- a/rec10/trunk/src/epgdb.py +++ b/rec10/trunk/src/epgdb.py @@ -35,12 +35,12 @@ def updatebc(bctype): ts2epg.write(tmppath + bctype + "epgdata.xml", chdb.bctypesearch(bctype)['ch']) xml2db.xml2db(tmppath + bctype + "epgdata.xml", bctype) shutil.copyfile(tmppath + bctype + "epgdata.xml", tmppath + bctype + "epgdata.bak.xml") - rec10d.rec10db.update_by_bctype_chdata(bctype) + rec10d.rec10db.update_by_bctype_epg_ch(bctype) except Exception, inst: print type(inst) print inst xml2db.xml2db(tmppath + bctype + "epgdata.bak.xml", bctype) - rec10d.rec10db.update_status_by_bctype_chdata(bctype, "2") + rec10d.rec10db.update_status_by_bctype_epg_ch(bctype, "2") def updatebc_bak(bctype): """ update epg data by .bak file @@ -55,7 +55,7 @@ def searchtime2(titletxt, timet, deltatime, chtxt): aftertime = aftertime.strftime("%Y%m%d%H%M%S") one = ["", "", "", ""] tempt = 0 - d = rec10d.rec10db.select_by_time_ngram_tv(beforetime, aftertime, chtxt) + d = rec10d.rec10db.select_by_time_ngram_epg_timeline(beforetime, aftertime, chtxt) for chtxtt, title, start, stop ,exp,longexp,category in d: #print chtxtt+":"+title+":"+start+":"+stop p = n_gram.bigram(titletxt, title) @@ -86,7 +86,7 @@ def searchtime_auto(keytxt, timet, deltatime): beforetime = time.strftime("%Y%m%d%H%M%S") aftertime = time + datetime.timedelta(hours=deltatime) aftertime = aftertime.strftime("%Y%m%d%H%M%S") - d = rec10d.rec10db.select_by_time_auto_suggest_tv(keytxt,beforetime, aftertime) + d = rec10d.rec10db.select_by_time_auto_suggest_epg_timeline(keytxt,beforetime, aftertime) for chtxtt, title, start, stop ,exp,longexp,category in d: btime = start btime = btime[0:4] + "-" + btime[4:6] + "-" + btime[6:8] + " " + btime[8:10] + ":" + btime[10:12] + ":00" diff --git a/rec10/trunk/src/rec10d.py b/rec10/trunk/src/rec10d.py index 4066732..f5f4e20 100644 --- a/rec10/trunk/src/rec10d.py +++ b/rec10/trunk/src/rec10d.py @@ -19,7 +19,7 @@ if db == "MySQL": dbpwd = configreader.getdbpath("mysql_passwd") dbport = int(configreader.getdbpath("mysql_port")) rec10db = dbMySQL.DB_MySQL(dbname=dbn, host=dbh, user=dbu, passwd=dbpwd, port=dbport) - rec10db.new_status() + rec10db.new_in_status() else: rec10db = dbSQLite.DB_SQLite(path + "ch.db") if __name__ == "__main__": diff --git a/rec10/trunk/src/recdb.py b/rec10/trunk/src/recdb.py index fb5dd10..3c00e3d 100644 --- a/rec10/trunk/src/recdb.py +++ b/rec10/trunk/src/recdb.py @@ -10,15 +10,12 @@ task names """ global REC_RESERVE global REC_FINAL_RESERVE -global REC_END global REC_ENCODE_GRID global REC_ENCODE_LOCAL global REC_ENCODE_QUE -global REC_MIXING_SOUND global REC_MISS_ENCODE global REC_KEYWORD global REC_KEYWORD_EVERY_SOME_DAYS -global REC_FIN_DECODE global REC_FIN_LOCAL global REC_MISS_DECODE global REC_TS_DECODE_QUE @@ -55,26 +52,23 @@ global REC_AUTO_SUGGEST_AVI2MP4 global REC_AUTO_SUGGEST_MKV2MP4 global REC_BAYES_SUGGEST global REC_AUTO_KEYWORD -REC_RESERVE = "res" -REC_FINAL_RESERVE = "rec" -REC_END = "end" -REC_ENCODE_GRID = "grid" -REC_ENCODE_LOCAL = "local" -REC_ENCODE_QUE = "ts2avi" -REC_MIXING_SOUND = "mixsound" -REC_MISS_ENCODE = "miss" -REC_KEYWORD = "key" -REC_KEYWORD_EVERY_SOME_DAYS = "keyevery" -REC_FIN_DECODE = "tsfin" -REC_FIN_LOCAL = "fin_local" -REC_MISS_DECODE = "tsmiss" -REC_TS_DECODE_QUE = "b252ts" -REC_TS_DECODING = "tsdecoding" -REC_TS_RECORDING = "tsrecording" -REC_CHANGING_CANTAINER = "changingcontainer" -REC_AVI_TO_MKV = "avi2mkv" -REC_AVI_TO_MP4 = "avi2mp4" -REC_MKV_TO_MP4 = "mkv2mp4" +REC_RESERVE = "reserve_flexible" +REC_FINAL_RESERVE = "reserve_fixed" +REC_ENCODE_GRID = "convert_ts_mp4_network" +REC_ENCODE_LOCAL = "convert_ts_mp4_running" +REC_ENCODE_QUE = "convert_ts_mp4" +REC_MISS_ENCODE = "convert_avi_mp4_miss" +REC_KEYWORD = "search_today" +REC_KEYWORD_EVERY_SOME_DAYS = "search_everyday" +REC_FIN_LOCAL = "convert_ts_mp4_finished" +REC_MISS_DECODE = "convert_b25_ts_miss" +REC_TS_DECODE_QUE = "convert_b25_ts" +REC_TS_DECODING = "convert_b25_ts_running" +REC_TS_RECORDING = "reserve_running" +REC_CHANGING_CANTAINER = "convert_mkv_mp4_runnings" +REC_AVI_TO_MKV = "convert_avi_mkv" +REC_AVI_TO_MP4 = "convert_avi_mp4" +REC_MKV_TO_MP4 = "convert_mkv_mp4" REC_MOVE_AFTER_RECORD = "move_rec" REC_MOVE_AFTER_RECORD_FINAL = "move_rec_final" @@ -104,22 +98,22 @@ REC_BAYES_SUGGEST ="bayes_suggest" def recreserv(title, chtxt, btime, etime, opt):#optにはa(アニメ)d(副音声)v(xvid) rec_reckey("res", title, chtxt, btime, etime, opt) def auto_keyreserv(keyword, chtxt, btime, etime, deltatime, opt): - rec10d.rec10db.add_rectime(type=recdb.REC_AUTO_KEYWORD, chtxt=chtxt, title=keyword, btime=btime, etime=etime, deltatime=deltatime, opt=opt) + rec10d.rec10db.add_main_timetable(type=recdb.REC_AUTO_KEYWORD, chtxt=chtxt, title=keyword, btime=btime, etime=etime, deltatime=deltatime, opt=opt) def keyreserv(keyword, chtxt, btime, etime, deltatime, opt): - rec10d.rec10db.add_rectime(type=recdb.REC_KEYWORD, chtxt=chtxt, title=keyword, btime=btime, etime=etime, deltatime=deltatime, opt=opt) + rec10d.rec10db.add_main_timetable(type=recdb.REC_KEYWORD, chtxt=chtxt, title=keyword, btime=btime, etime=etime, deltatime=deltatime, opt=opt) def everyreserv(keyword, chtxt, btime, etime, deltatime, opt, deltaday): - rec10d.rec10db.add_rectime(type=recdb.REC_KEYWORD_EVERY_SOME_DAYS, chtxt=chtxt, title=keyword, btime=btime, etime=etime, deltatime=deltatime, opt=opt, deltaday=deltaday) + rec10d.rec10db.add_main_timetable(type=recdb.REC_KEYWORD_EVERY_SOME_DAYS, chtxt=chtxt, title=keyword, btime=btime, etime=etime, deltatime=deltatime, opt=opt, deltaday=deltaday) def rec_reckey(type, title, chtxt, btime, etime, opt): - rec10d.rec10db.add_rectime(type=type, chtxt=chtxt, title=title, btime=btime, etime=etime, opt=opt) + rec10d.rec10db.add_main_timetable(type=type, chtxt=chtxt, title=title, btime=btime, etime=etime, opt=opt) def del_reckey(type, title, chtxt, btime): - rec10d.rec10db.del_rectime(type=type, title=title, chtxt=chtxt, btime=btime) + rec10d.rec10db.del_main_timetable(type=type, title=title, chtxt=chtxt, btime=btime) def getnow(dhour): dhour = int(dhour) dminutes = 60 * dhour dminutes = str(dminutes) - return rec10d.rec10db.select_bytime_rectime(dminutes) + return rec10d.rec10db.select_bytime_main_timetable(dminutes) def getnow_minutes(dminutes): - return rec10d.rec10db.select_bytime_rectime(dminutes) + return rec10d.rec10db.select_bytime_main_timetable(dminutes) def countRecNow(dhour): d = getnow(dhour) ret = 0 @@ -158,10 +152,10 @@ def delete_old(dhour): """ delete keys except recdb.REC_MISS_ENCODE and recdb.REC_KEYWORD_EVERY_SOME_DAYS before dhour hours from now. """ - rec10d.rec10db.delete_old_rectime(dhour) + rec10d.rec10db.delete_old_main_timetable(dhour) def getall(): - return rec10d.rec10db.select_all_rectime() + return rec10d.rec10db.select_all_main_timetable() def rec_reclog(title,chtxt,btime,etime,opt,exp,longexp,category): - rec10d.rec10db.add_reclog(chtxt,title,btime,etime,opt,exp,longexp,category) + rec10d.rec10db.add_in_timeline_log(chtxt,title,btime,etime,opt,exp,longexp,category) def get_key(): - return rec10d.rec10db.select_all_recjbk() \ No newline at end of file + return rec10d.rec10db.select_all_in_auto_jbk_key() \ No newline at end of file diff --git a/rec10/trunk/src/status.py b/rec10/trunk/src/status.py index ac26c00..8f90bc0 100755 --- a/rec10/trunk/src/status.py +++ b/rec10/trunk/src/status.py @@ -11,21 +11,21 @@ def changeEncoding(i): """ iはint 増減 """ - rec10d.rec10db.change_ts2avi_status(i) + rec10d.rec10db.change_ts2avi_in_status(i) def changeTERecording(i): - rec10d.rec10db.change_terec_status(i) + rec10d.rec10db.change_terec_in_status(i) def changeBSCSRecording(i): - rec10d.rec10db.change_bscsrec_status(i) + rec10d.rec10db.change_bscsrec_in_status(i) def changeB25Decoding(i): - rec10d.rec10db.change_b252ts_status(i) + rec10d.rec10db.change_b252ts_in_status(i) def getEncoding(): """ エンコードしている数を帰すint型 """ - return int(rec10d.rec10db.select_all_status()[0][0]) + return int(rec10d.rec10db.select_all_in_status()[0][0]) def getTERecording(): - return int(rec10d.rec10db.select_all_status()[0][1]) + return int(rec10d.rec10db.select_all_in_status()[0][1]) def getBSCSRecording(): - return int(rec10d.rec10db.select_all_status()[0][2]) + return int(rec10d.rec10db.select_all_in_status()[0][2]) def getB25Decoding(): - return int(rec10d.rec10db.select_all_status()[0][3]) + return int(rec10d.rec10db.select_all_in_status()[0][3]) diff --git a/rec10/trunk/src/timerec.py b/rec10/trunk/src/timerec.py index 6d16f08..9a49a71 100644 --- a/rec10/trunk/src/timerec.py +++ b/rec10/trunk/src/timerec.py @@ -71,7 +71,7 @@ def task(): print bctype + "//ing:" + str(status.getBSCSRecording()) + ":task:" + str(recdb.countRecNow_minutes_BSCS("10")) if recnum < 2: print update - rec10d.rec10db.update_status_by_bctype_chdata(bctype, "0") + rec10d.rec10db.update_status_by_bctype_epg_ch(bctype, "0") epgdb.updatebc(bctype) update = chdb.update() i = i + 1 @@ -332,7 +332,7 @@ def type_reserve(typetxt,chtxt,title,bt,et,opt): dt = dtt.days * 24 * 60 * 60 + dtt.seconds if (dt < 58 * 60 and dt > 20 * 60): bctypet = chdb.chtxtsearch(chtxt)['bctype'] - chdatat = rec10d.rec10db.select_by_bctype_chdata(bctypet) + chdatat = rec10d.rec10db.select_by_bctype_epg_ch(bctypet) dt1 = datetime.datetime.strptime(chdatat[0][5], "%Y-%m-%d %H:%M:%S")-datetime.datetime.now() dt1 = dt1.days * 24 * 60 * 60 + dt1.seconds if dt1 < 60 * 60: @@ -363,8 +363,8 @@ def type_reserve(typetxt,chtxt,title,bt,et,opt): else: print "nothing match" else: - if rec10d.rec10db.select_by_bctype_chdata(bctypet)[0][6] != "0": - rec10d.rec10db.update_status_by_bctype_chdata(bctypet, "3") + if rec10d.rec10db.select_by_bctype_epg_ch(bctypet)[0][6] != "0": + rec10d.rec10db.update_status_by_bctype_epg_ch(bctypet, "3") sys.exit() elif dt <= 20 * 60: try: diff --git a/rec10/trunk/src/xml2db.py b/rec10/trunk/src/xml2db.py index f7683f8..31a19c6 100644 --- a/rec10/trunk/src/xml2db.py +++ b/rec10/trunk/src/xml2db.py @@ -31,12 +31,11 @@ def xml2db(xmlpath, bctypetemp):#bctypeは放送種別で'TE'(地デジ)BS,CSが parseDocument(p, xmlpath) def writemultitvDB(tvlists): global bctype - rec10d.rec10db.new_tv(bctype) - rec10d.rec10db.add_multi_tv(tvlists) + rec10d.rec10db.new_epg_timeline(bctype) + rec10d.rec10db.add_multi_epg_timeline(tvlists) def writemultichDB(chlists): - global bctype - rec10d.rec10db.new_ch(bctype) - rec10d.rec10db.add_multi_ch(chlists) + for bctype,ontv,dn in chlists.items(): + rec10d.rec10db.update_chname_by_ontv_epg_ch(ontv, dn) def parseDocument(p, xmlfile): f = open(xmlfile, 'r') p.ParseFile(f)