OSDN Git Service

implement ch scan system.(alpha)
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Sun, 7 Nov 2010 12:23:00 +0000 (12:23 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Sun, 7 Nov 2010 12:23:00 +0000 (12:23 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@746 4e526526-5e11-4fc0-8910-f8fd03428081

rec10/trunk/src/dbMySQL.py

index ba5c090..7768129 100644 (file)
@@ -54,7 +54,8 @@ class DB_MySQL:
             UNIQUE uni (type,chtxt,title,btime,deltaday)\
             )')
         except Exception, inst:
-            recdblist.Commonlogex("Error", "init (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=800)
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("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()
@@ -79,8 +80,10 @@ class DB_MySQL:
         db = self.connect_db()
         try:
             db[1].execute('drop table epg_ch')
-        except:
-            ""
+        except Exception, inst:
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("Error", "new_epg_ch drop (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+
         try:
             db[1].execute('\
             CREATE TABLE epg_ch \
@@ -94,8 +97,10 @@ class DB_MySQL:
             status TINYINT,\
             isshow TINYINT\
             )')
-        except:
-            ""
+        except Exception, inst:
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("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 = self.connect_db()
@@ -254,8 +259,10 @@ class DB_MySQL:
         db = self.connect_db()
         try:
             db[1].execute('drop table auto_proc_tmp')
-        except:
-            ""
+        except Exception, inst:
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("Error", "new_auto_proc_tmp drop (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+
         try:
             db[1].execute('\
             CREATE TABLE auto_proc_tmp \
@@ -265,22 +272,28 @@ class DB_MySQL:
             chtxt VARCHAR(30),\
             UNIQUE unibayeskey(title)\
             )')
-        except:
-            ""
+        except Exception, inst:
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("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 = self.connect_db()
         try:
             db[1].execute('INSERT INTO auto_proc SELECT * FROM auto_proc_tmp')
-        except:
-            ""
+        except Exception, inst:
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("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 = self.connect_db()
         try:
             db[1].execute('drop table auto_proc')
-        except:
-            ""
+        except Exception, inst:
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("Error", "new_auto_proc drop (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
+
         try:
             db[1].execute('\
             CREATE TABLE auto_proc \
@@ -290,8 +303,10 @@ class DB_MySQL:
             chtxt VARCHAR(30),\
             UNIQUE unibayeskey(title)\
             )')
-        except:
-            ""
+        except Exception, inst:
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("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 = self.connect_db()
@@ -305,8 +320,9 @@ class DB_MySQL:
         db = self.connect_db()
         try:
             db[1].execute('drop table in_settings')
-        except:
-            ""
+        except Exception, inst:
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("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()
@@ -320,8 +336,10 @@ class DB_MySQL:
             auto_del_tmp TINYINT\
             )')
             db[1].execute("INSERT IGNORE into in_settings VALUE (0,0,\"H\",1)")
-        except:
-            ""
+        except Exception, inst:
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("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):
         db = self.connect_db()
@@ -379,8 +397,10 @@ class DB_MySQL:
             category VARCHAR(100),\
             UNIQUE uni (chtxt,title,btime,category)\
             )')
-        except:
-            ""
+        except Exception, inst:
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("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):
         db = self.connect_db()
@@ -678,8 +698,9 @@ class DB_MySQL:
             opt VARCHAR(20),\
             UNIQUE unijbk (keyword)\
             )")
-        except:
-            ""
+        except Exception, inst:
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("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()
@@ -705,8 +726,9 @@ class DB_MySQL:
         db = self.connect_db()
         try:
             db[1].execute('drop table in_status')
-        except:
-            ""
+        except Exception, inst:
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("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()
@@ -723,7 +745,8 @@ class DB_MySQL:
             )")
             db[1].execute("INSERT IGNORE into in_status VALUE (0,0,0,0,0,0)")
         except Exception, inst:
-            recdblist.Commonlogex("Error", "new_in_status (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=800)
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("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()
@@ -758,8 +781,9 @@ class DB_MySQL:
             for dl in dls:
                 r = list(dl)
                 version=int(str(r[0]))
-        except:
-            ""
+        except Exception, inst:
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("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()
@@ -841,7 +865,8 @@ class DB_MySQL:
             WHERE bctype = %s", \
                           (bctype,))
         except Exception, inst:
-            recdblist.Commonlogex("Error", "new_epg_timeline (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=800)
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("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 \
@@ -856,8 +881,9 @@ class DB_MySQL:
             category VARCHAR(100),\
             UNIQUE unitv(bctype,channel,start,stop,title)\
             )")
-        except:
-            ""
+        except Exception, inst:
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("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):
@@ -937,8 +963,9 @@ class DB_MySQL:
             UNIQUE unibayeskey(keychar,chtxt)\
             )')
             db[1].execute('CREATE INDEX keycharindex ON in_auto_bayes_key(keychar)')
-        except:
-            ""
+        except Exception, inst:
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("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):
@@ -998,8 +1025,9 @@ class DB_MySQL:
                 VALUES (%s,%s,%s,%s)\
                 ON DUPLICATE KEY UPDATE \
                 ratio_all=CONVERT((ratio_all*%s+%s)/%s,DECIMAL(32,14))",retl)
-            except:
-                ""
+            except Exception, inst:
+                if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or 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)
         self.close_db(db)
     def change_ratio_rec_reduce_in_auto_bayes_key(self,chtxt,beforenum,newnum):
         beforenum=str(beforenum)
@@ -1029,8 +1057,9 @@ class DB_MySQL:
                 VALUES (%s,%s,%s,%s)\
                 ON DUPLICATE KEY UPDATE \
                 ratio_rec=CONVERT((ratio_rec*%s+%s)/%s,DECIMAL(32,14))",retl)
-            except:
-                ""
+            except Exception, inst:
+                if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or 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)
         self.close_db(db)
     def select_by_key_in_auto_bayes_key(self,key,chtxt):
         db = self.connect_db()
@@ -1060,8 +1089,9 @@ class DB_MySQL:
             etime DATETIME,\
             UNIQUE uni (chtxt,title,btime,etime)\
             )')
-        except:
-            ""
+        except Exception, inst:
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("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('\
@@ -1092,8 +1122,9 @@ class DB_MySQL:
             point INT,\
             UNIQUE uni (chtxt,title,btime,etime)\
             )')
-        except:
-            ""
+        except Exception, inst:
+            if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+                recdblist.Commonlogex("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('\