OSDN Git Service

implement new classify system.
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Wed, 14 Apr 2010 10:38:11 +0000 (10:38 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Wed, 14 Apr 2010 10:38:11 +0000 (10:38 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@563 4e526526-5e11-4fc0-8910-f8fd03428081

rec10/trunk/src/classify.py
rec10/trunk/src/guess.py

index 80335af..722d837 100644 (file)
@@ -26,7 +26,7 @@ if __name__ == "__main__":
     parser.add_option("-t","--tssearch",action="store_true",dest="tssearch",default=False,help="Ts move auto search")
     parser.add_option("-T","--Tsmove",action="store_true",dest="tsmove",default=False,help="Ts auto move.")
     (opts,args)=parser.parse_args(sys.argv)
-    if opts.ltitle!="":
+    if opts.ltitle!="":##-sの場合
         ltitle=unicode(opts.ltitle,'utf-8')
         sf=guess.searchFolder(ltitle, recordedpath)
         print "###MKV###"
@@ -35,7 +35,7 @@ if __name__ == "__main__":
         print "###MP4###"
         recdblist.printutf8(os.path.join(sf, auto_move.get_move_dest_path(ltitle,recpath,sf,".mp4")+".mp4"))
         print "\n"
-    elif opts.auto:
+    elif opts.auto:##-A の場合
         sa=auto_move.search_file(recpath, recordedpath, ".mkv")
         for t in sa:
             recdblist.printutf8(u"自動推測実行中-MKV")
@@ -58,7 +58,7 @@ if __name__ == "__main__":
                 auto_move.execMove(t, recpath, recordedpath,".mp4",1)
             else:
                 recdblist.printutf8(t+" can't find matching folder")
-    elif opts.list:
+    elif opts.list:##-lの場合
         sa=auto_move.search_file(recpath, recordedpath,".mkv")
         for t in sa:
             sf=guess.searchFolder(t,recordedpath)
@@ -74,7 +74,7 @@ if __name__ == "__main__":
             auto_move.execMove(etitle,recpath, recordedpath,".mkv",1)
         elif os.path.exists(os.path.join(recpath, etitle+".mp4")):
             auto_move.execMove(etitle,recpath, recordedpath,".mp4",1)
-    elif opts.tssearch:
+    elif opts.tssearch:## -tの場合
         tsmovepath=""
         try:
             tsmovepath=unicode(configreader.getpath("ts_movepath"),'utf-8')
@@ -90,7 +90,7 @@ if __name__ == "__main__":
             sa=auto_move.search_file(recpath, tsmovepath,".ts")
         else:
             recdblist.printutf8(u"ts_movepathが設定されていません。/etc/rec10.confを設定してください。")
-    elif opts.tsmove:
+    elif opts.tsmove:##-Tの場合
         tsmovepath=""
         try:
             tsmovepath=unicode(configreader.getpath("ts_movepath"),'utf-8')
index 07993a2..0fd8b73 100644 (file)
@@ -11,6 +11,7 @@ import datetime
 import n_gram
 import recdblist
 import zenhan
+import auto_move
 
 def detName(title,path):
     tt=detNameType(title, path)
@@ -201,7 +202,9 @@ def searchFolder(title,path,threshold=500):
         else:
             cmpp=os.path.basename(dirp)
             appp=os.path.dirname(dirp)
-        p=n_gram.trigram(title,cmpp)
+        ntitle=auto_move.getTitle(title)
+        ncmpp=auto_move.getTitle(cmpp)
+        p=n_gram.trigram(ntitle,ncmpp)
         if p>0:
             ngram.append((p,appp))
     ngram=list(set(ngram))