OSDN Git Service

add new classify function.
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Wed, 14 Apr 2010 06:07:16 +0000 (06:07 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Wed, 14 Apr 2010 06:07:16 +0000 (06:07 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@559 4e526526-5e11-4fc0-8910-f8fd03428081

rec10/trunk/src/auto_move.py
rec10/trunk/src/classify.py

index f04e422..be8df04 100644 (file)
@@ -57,15 +57,19 @@ def get_move_dest_path(title,temppath,recpath,ext):
     dstpath=os.path.join(recpath,title+ext)
     srcpath=os.path.join(temppath,title+ext)
     if os.path.exists(dstpath):
-        gmtime=time.gmtime(os.path.getmtime(srcpath))
-        iff=""
-        try:
-            iff=u"("+configreader.getenv("iff")+u")_"
-            if iff==u"()_":
-                iff = u""
-        except:
+        if not os.path.getsize(dstpath) == os.path.getsize(srcpath):
+            gmtime=time.gmtime(os.path.getmtime(srcpath))
             iff=""
-        title=title+u"_"+iff+time.strftime("%Y-%m-%dT%H-%M-%S",gmtime)
+            try:
+                iff=u"("+configreader.getenv("iff")+u")_"
+                if iff==u"()_":
+                    iff = u""
+            except:
+                iff=""
+            title=title+u"_"+iff+time.strftime("%Y-%m-%dT%H-%M-%S",gmtime)
+        else:
+            recdblist.printutf8(u"同サイズのファイルが存在します")
+
     return title
 def get_delpath(temppath,title):
     delpath=[os.path.join(temppath,title+".ts")]
@@ -101,16 +105,20 @@ def execMove(title,temppath,recpath,ext,autodel):
     sf=guess.searchFolder(title, recpath)
     if sf!="":
         destpath=os.path.join(sf,get_move_dest_path(title, temppath, sf, ext)+ext)
-        recdblist.printutf8("moving now..")
-        recdblist.printutf8(srcpath+" : "+destpath)
-        print srcpath
-        shutil.copy(srcpath, destpath)
-        #shutil.copy(srcpath, destpath)
-        if autodel==1:
-            delpath=get_delpath(temppath, title)
-            for dp in delpath:
-                try:
-                    os.remove(dp)
-                    ""
-                except:
-                    ""
\ No newline at end of file
+        if os.path.exists(destpath):
+            if os.path.getsize(destpath) == os.path.getsize(srcpath):
+                recdblist.printutf8(u"同名同サイズのファイルが存在します。")
+        else:
+            recdblist.printutf8("moving now..")
+            recdblist.printutf8(srcpath+" : "+destpath)
+            print srcpath
+            shutil.copy(srcpath, destpath)
+            #shutil.copy(srcpath, destpath)
+            if autodel==1:
+                delpath=get_delpath(temppath, title)
+                for dp in delpath:
+                    try:
+                        os.remove(dp)
+                        ""
+                    except:
+                        ""
\ No newline at end of file
index 192d60e..80335af 100644 (file)
@@ -31,8 +31,10 @@ if __name__ == "__main__":
         sf=guess.searchFolder(ltitle, recordedpath)
         print "###MKV###"
         recdblist.printutf8(os.path.join(sf, auto_move.get_move_dest_path(ltitle,recpath,sf,".mkv")+".mkv"))
+        print "\n"
         print "###MP4###"
         recdblist.printutf8(os.path.join(sf, auto_move.get_move_dest_path(ltitle,recpath,sf,".mp4")+".mp4"))
+        print "\n"
     elif opts.auto:
         sa=auto_move.search_file(recpath, recordedpath, ".mkv")
         for t in sa:
@@ -84,6 +86,7 @@ if __name__ == "__main__":
                 sf=guess.searchFolder(t,tsmovepath,700)
                 if sf!="":
                     recdblist.printutf8(t+u" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".ts")+".ts"))
+                    print "\n"
             sa=auto_move.search_file(recpath, tsmovepath,".ts")
         else:
             recdblist.printutf8(u"ts_movepathが設定されていません。/etc/rec10.confを設定してください。")