OSDN Git Service

classify.py : add a mode that stores data in rec10 db.
[rec10/rec10-git.git] / rec10 / classify.py
index a496f1b..c8525ec 100644 (file)
@@ -12,6 +12,7 @@ import configreader
 import recdblist
 import auto_move
 import guess
+import rec10d
 recordedpath=unicode(configreader.getConfPath("recorded"),'utf-8')
 recpath=unicode(configreader.getConfPath("recpath"),'utf-8')
 
@@ -28,6 +29,7 @@ if __name__ == "__main__":
     parser.add_option("-T","--Tsmove",action="store_true",dest="tsmove",default=False,help="Ts auto move.")
     parser.add_option("-S","--SeriesNum",action="store",type="string",dest="seriespath",default="",metavar="TITLE",help="Search Series Number in the path.")
     parser.add_option("-m","--manual",action="store_true",dest="manual",default=False,help="manual classifying mode asking for y/n(not a test)")
+    parser.add_option("-r","--rec10",action="store_true",dest="rec10",default=False,help="save moving plan in SQL table")
     #parser.add_option("-f","--filenumlist",action="store_true",dest="filenumlist",default=False,help="Guess Program Number.")
 
     (opts,args)=parser.parse_args(sys.argv)
@@ -81,6 +83,15 @@ if __name__ == "__main__":
                     recdblist.printutf8(u"FIXME:not implemented",verbose_level=100)
             else:
                 recdblist.printutf8(u"×不明:"+t,verbose_level=100)
+    elif opts.rec10:##-r の場合
+        # mkv無視します
+        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)
     elif opts.delete:##-Dの場合
         sa=auto_move.searchFile(recpath, recordedpath,".mkv")
         for t in sa: