OSDN Git Service

classify : fix DB.
[rec10/rec10-git.git] / rec10 / classify.py
index c8525ec..1b82830 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 # coding: UTF-8
 # Rec10 TS Recording Tools
-# Copyright (C) 2009-2011 Yukikaze
+# Copyright (C) 2009-2013 Yukikaze,long.inus
 
 import os
 import os.path
@@ -18,7 +18,7 @@ recpath=unicode(configreader.getConfPath("recpath"),'utf-8')
 
 if __name__ == "__main__":
     usage="usage: %prog read -h"
-    version="%prog 0.9.4"
+    version="%prog 0.9.10"
     parser=optparse.OptionParser(usage=usage,version=version)
     parser.add_option("-s","--search",action="store",type="string",dest="ltitle",default="",metavar="TITLE",help="test to search where the title should be contained(test for -e)")
     parser.add_option("-A","--Auto",action="store_true",dest="auto",default=False,help="auto classifying mode(not a test)")
@@ -85,13 +85,22 @@ if __name__ == "__main__":
                 recdblist.printutf8(u"×不明:"+t,verbose_level=100)
     elif opts.rec10:##-r の場合
         # mkv無視します
+        dbl=rec10d.rec10db.select_move_auto_classify()
+        if len(dbl)>0:
+            for dbt in dbl:
+                title= dbt[1]
+                #frompath = dbt[1]
+                #topath = dbt[2]
+                #t=os.path.splitext(os.path.split(frompath)[1])[0]
+                auto_move.execMove(t, recpath, recordedpath,".mp4",1)
+        rec10d.rec10db.delete_refresh_auto_classify()
         sa=auto_move.searchFile(recpath, recordedpath, ".mp4")
         for t in sa:
             sf=guess.searchFolder(t,recordedpath,200)
             if sf!="":
                 frompath = os.path.join(recpath, t + ".mp4")
                 topath = os.path.join(sf, auto_move.getMoveDestpath(t, recpath,sf,".mp4")+".mp4")
-                rec10d.rec10db.add_auto_classify(frompath, topath)
+                rec10d.rec10db.add_auto_classify(t,frompath, topath) 
     elif opts.delete:##-Dの場合
         sa=auto_move.searchFile(recpath, recordedpath,".mkv")
         for t in sa: