From 3bdddf97d364a463e9e59d5b8639595199f038e9 Mon Sep 17 00:00:00 2001 From: gn64_jp Date: Wed, 14 Apr 2010 06:07:16 +0000 Subject: [PATCH] add new classify function. git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@559 4e526526-5e11-4fc0-8910-f8fd03428081 --- rec10/trunk/src/auto_move.py | 50 +++++++++++++++++++++++++------------------- rec10/trunk/src/classify.py | 3 +++ 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/rec10/trunk/src/auto_move.py b/rec10/trunk/src/auto_move.py index f04e422..be8df04 100644 --- a/rec10/trunk/src/auto_move.py +++ b/rec10/trunk/src/auto_move.py @@ -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 diff --git a/rec10/trunk/src/classify.py b/rec10/trunk/src/classify.py index 192d60e..80335af 100644 --- a/rec10/trunk/src/classify.py +++ b/rec10/trunk/src/classify.py @@ -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を設定してください。") -- 2.11.0