• R/O
  • HTTP
  • SSH
  • HTTPS

rec10-git: Commit

rec10 git


Commit MetaInfo

Revision64699e9bff29d55dcb8e5279f8da9d5fbca432aa (tree)
Zeit2013-11-13 12:50:37
Autorgn64_jp <gn64@rec1...>
Commitergn64_jp

Log Message

classify : fix DB id undefined.

Ändern Zusammenfassung

Diff

--- a/rec10/classify.py
+++ b/rec10/classify.py
@@ -91,7 +91,15 @@ if __name__ == "__main__":
9191 if sf!="":
9292 frompath = os.path.join(recpath, t + ".mp4")
9393 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)
95103 elif opts.delete:##-Dの場合
96104 sa=auto_move.searchFile(recpath, recordedpath,".mkv")
97105 for t in sa:
--- a/rec10/dbMySQL.py
+++ b/rec10/dbMySQL.py
@@ -1241,6 +1241,7 @@ vim ")
12411241 CREATE TABLE auto_classify \
12421242 (\
12431243 id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,\
1244+ title VARCHAR(1024),\
12441245 frompath VARCHAR(1024),\
12451246 topath VARCHAR(1024),\
12461247 do BOOLEAN\
@@ -1248,13 +1249,13 @@ vim ")
12481249 except Exception, inst:
12491250 if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
12501251 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=""):
12521253 db = self.connect_db()
12531254 db[1].execute('\
12541255 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))
12581259 self.close_db(db)
12591260 def delete_old_auto_classify(self, frompath):
12601261 db = self.connect_db()
@@ -1263,6 +1264,20 @@ vim ")
12631264 WHERE \
12641265 frompath == %s", (frompath))
12651266 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
12661281 def update_db_to93(self):
12671282 db = self.connect_db()
12681283 self.drop_in_settings()
Show on old repository browser