X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=rec10%2FdbMySQL.py;h=7c862e04a74cdd33fd442eec17c27bcb5e963e64;hb=a8fa0e37d40e59fbdb495db0731290681d13c300;hp=f2c4a88e1048a9493de87ac551a8fc9b3be8f369;hpb=89b884b045b9befed18536a2a7d44bc1e29359ed;p=rec10%2Frec10-git.git diff --git a/rec10/dbMySQL.py b/rec10/dbMySQL.py index f2c4a88..7c862e0 100644 --- a/rec10/dbMySQL.py +++ b/rec10/dbMySQL.py @@ -1,7 +1,7 @@ #!/usr/bin/python # coding: UTF-8 # Rec10 TS Recording Tools -# Copyright (C) 2009-2012 Yukikaze +# Copyright (C) 2009-2013 Yukikaze import MySQLdb import recdblist import warnings @@ -66,6 +66,7 @@ class DB_MySQL: self.new_in_settings() self.new_auto_timeline_bayes() self.new_auto_timeline_keyword() + self.new_auto_classify() def connect_db(self): """ dbへの接続 @@ -1239,21 +1240,30 @@ vim ") db[1].execute('\ CREATE TABLE auto_classify \ (\ + id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,\ + title VARCHAR(1024),\ frompath VARCHAR(1024),\ topath VARCHAR(1024),\ - do BOOLEAN\ + do BOOLEAN,\ + UNIQUE key (title),\ )') except Exception, inst: if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)): recdblist.addCommonlogEX("Error", "new_auto_classify (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200) - def add_auto_classify(self, frompath="", topath=""): + def add_auto_classify(self,title="", frompath="", topath=""): db = self.connect_db() db[1].execute('\ INSERT IGNORE into auto_classify \ - (frompath,topath,do) \ - values (%s,%s,0)', \ - (frompath, topath)) + (title,frompath,topath,do) \ + values (%s,%s,%s,0)', \ + (title,frompath, topath)) self.close_db(db) + def delete_refresh_auto_classify(self): + db = self.connect_db() + db[1].execute("\ + DROP TABLE auto_classify") + self.close_db(db) + self.new_auto_classify() def delete_old_auto_classify(self, frompath): db = self.connect_db() db[1].execute("\ @@ -1261,6 +1271,20 @@ vim ") WHERE \ frompath == %s", (frompath)) self.close_db(db) + def select_move_auto_classify(self): + db = self.connect_db() + dbexe = db[1].execute("\ + SELECT id,title,frompath,topath \ + FROM auto_classify \ + WHERE do = 1") + dls = [] + if dbexe > 0: + dls = db[1].fetchall() + self.close_db(db) + if len(dls)>0: + return dls[0] + else: + return dls def update_db_to93(self): db = self.connect_db() self.drop_in_settings() @@ -1364,4 +1388,13 @@ vim ") self.change_installed_in_status(1) self.change_version_in_status("102") #self.change_installed_in_status()#チャンネルスキャンをさせる + def update_db_102to103(sekf): + self.drop_in_settings() + self.new_in_settings() + self.new_epg_ch() + self.new_auto_classify() + self.close_db(db) + self.change_installed_in_status(1) + self.change_version_in_status("103") + #self.change_installed_in_status()#チャンネルスキャンをさせる