rec10 git
Revision | 64699e9bff29d55dcb8e5279f8da9d5fbca432aa (tree) |
---|---|
Zeit | 2013-11-13 12:50:37 |
Autor | gn64_jp <gn64@rec1...> |
Commiter | gn64_jp |
classify : fix DB id undefined.
@@ -91,7 +91,15 @@ if __name__ == "__main__": | ||
91 | 91 | if sf!="": |
92 | 92 | frompath = os.path.join(recpath, t + ".mp4") |
93 | 93 | topath = os.path.join(sf, auto_move.getMoveDestpath(t, recpath,sf,".mp4")+".mp4") |
94 | - rec10d.rec10db.add_auto_classify(frompath, topath) | |
94 | + rec10d.rec10db.add_auto_classify(t,frompath, topath) | |
95 | + dbl=rec10d.rec10db.select_move_auto_classify() | |
96 | + if len(dbl)>0: | |
97 | + for dbt in dbl: | |
98 | + title= dbt[1] | |
99 | + #frompath = dbt[1] | |
100 | + #topath = dbt[2] | |
101 | + #t=os.path.splitext(os.path.split(frompath)[1])[0] | |
102 | + auto_move.execMove(t, recpath, recordedpath,".mp4",1) | |
95 | 103 | elif opts.delete:##-Dの場合 |
96 | 104 | sa=auto_move.searchFile(recpath, recordedpath,".mkv") |
97 | 105 | for t in sa: |
@@ -1241,6 +1241,7 @@ vim ") | ||
1241 | 1241 | CREATE TABLE auto_classify \ |
1242 | 1242 | (\ |
1243 | 1243 | id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,\ |
1244 | + title VARCHAR(1024),\ | |
1244 | 1245 | frompath VARCHAR(1024),\ |
1245 | 1246 | topath VARCHAR(1024),\ |
1246 | 1247 | do BOOLEAN\ |
@@ -1248,13 +1249,13 @@ vim ") | ||
1248 | 1249 | except Exception, inst: |
1249 | 1250 | if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)): |
1250 | 1251 | recdblist.addCommonlogEX("Error", "new_auto_classify (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200) |
1251 | - def add_auto_classify(self, frompath="", topath=""): | |
1252 | + def add_auto_classify(self,title="", frompath="", topath=""): | |
1252 | 1253 | db = self.connect_db() |
1253 | 1254 | db[1].execute('\ |
1254 | 1255 | INSERT IGNORE into auto_classify \ |
1255 | - (frompath,topath,do) \ | |
1256 | - values (%s,%s,0)', \ | |
1257 | - (frompath, topath)) | |
1256 | + (title,frompath,topath,do) \ | |
1257 | + values (%s,%s,%s,0)', \ | |
1258 | + (title,frompath, topath)) | |
1258 | 1259 | self.close_db(db) |
1259 | 1260 | def delete_old_auto_classify(self, frompath): |
1260 | 1261 | db = self.connect_db() |
@@ -1263,6 +1264,20 @@ vim ") | ||
1263 | 1264 | WHERE \ |
1264 | 1265 | frompath == %s", (frompath)) |
1265 | 1266 | self.close_db(db) |
1267 | + def select_move_auto_classify(self): | |
1268 | + db = self.connect_db() | |
1269 | + dbexe = db[1].execute("\ | |
1270 | + SELECT id,title,frompath,topath \ | |
1271 | + FROM auto_classify \ | |
1272 | + WHERE do = 1") | |
1273 | + dls = [] | |
1274 | + if dbexe > 0: | |
1275 | + dls = db[1].fetchall() | |
1276 | + self.close_db(db) | |
1277 | + if len(dls)>0: | |
1278 | + return dls[0] | |
1279 | + else: | |
1280 | + return dls | |
1266 | 1281 | def update_db_to93(self): |
1267 | 1282 | db = self.connect_db() |
1268 | 1283 | self.drop_in_settings() |