3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009-2010 Yukikaze
15 recordedpath=unicode(configreader.getpath("recorded"),'utf-8')
16 recpath=unicode(configreader.getpath("recpath"),'utf-8')
18 if __name__ == "__main__":
19 usage="usage: %prog read -h"
21 parser=optparse.OptionParser(usage=usage,version=version)
22 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)")
23 parser.add_option("-A","--Auto",action="store_true",dest="auto",default=False,help="auto classifying mode(not a test)")
24 parser.add_option("-e","--exec",action="store",type="string",dest="etitle",default="",metavar="TITLE",help="exec move(not a test)")
25 parser.add_option("-l","--list",action="store_true",dest="list",default=False,help="File listing mode(test for -A)")
26 parser.add_option("-t","--tssearch",action="store_true",dest="tssearch",default=False,help="Ts move auto search")
27 parser.add_option("-T","--Tsmove",action="store_true",dest="tsmove",default=False,help="Ts auto move.")
28 (opts,args)=parser.parse_args(sys.argv)
30 ltitle=unicode(opts.ltitle,'utf-8')
31 sf=guess.searchFolder(ltitle, recordedpath)
33 recdblist.printutf8(os.path.join(sf, auto_move.get_move_dest_path(ltitle,recpath,sf,".mkv")+".mkv"))
35 recdblist.printutf8(os.path.join(sf, auto_move.get_move_dest_path(ltitle,recpath,sf,".mp4")+".mp4"))
37 sa=auto_move.search_file(recpath, recordedpath, ".mkv")
39 recdblist.printutf8(u"自動推測実行中-MKV")
40 sf=guess.searchFolder(t,recordedpath)
42 recdblist.printutf8(u"移動先")
43 recdblist.printutf8(t+" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".mkv")+".mkv"))
44 recdblist.printutf8(u"実行中")
45 auto_move.execMove(t, recpath, recordedpath,".mkv",1)
47 recdblist.printutf8(t+" can't find matching folder")
48 sa=auto_move.search_file(recpath, recordedpath, ".mp4")
50 recdblist.printutf8(u"自動推測実行中-MP4")
51 sf=guess.searchFolder(t,recordedpath)
53 recdblist.printutf8(u"移動先")
54 recdblist.printutf8(t+" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".mp4")+".mp4"))
55 recdblist.printutf8(u"実行中")
56 auto_move.execMove(t, recpath, recordedpath,".mp4",1)
58 recdblist.printutf8(t+" can't find matching folder")
60 sa=auto_move.search_file(recpath, recordedpath,".mkv")
62 sf=guess.searchFolder(t,recordedpath)
64 recdblist.printutf8(t+u" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".mkv")+".mkv"))
65 sa=auto_move.search_file(recpath, recordedpath,".mp4")
67 sf=guess.searchFolder(t,recordedpath)
69 recdblist.printutf8(t+u" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".mp4")+".mp4"))
71 if os.path.exists(os.path.join(recpath, etitle+".mkv")):
72 auto_move.execMove(etitle,recpath, recordedpath,".mkv",1)
73 elif os.path.exists(os.path.join(recpath, etitle+".mp4")):
74 auto_move.execMove(etitle,recpath, recordedpath,".mp4",1)
78 tsmovepath=unicode(configreader.getpath("ts_movepath"),'utf-8')
82 sa=auto_move.search_file(recpath, tsmovepath,".ts")
84 sf=guess.searchFolder(t,tsmovepath,700)
86 recdblist.printutf8(t+u" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".ts")+".ts"))
87 sa=auto_move.search_file(recpath, tsmovepath,".ts")
89 recdblist.printutf8(u"ts_movepathが設定されていません。/etc/rec10.confを設定してください。")
93 tsmovepath=unicode(configreader.getpath("ts_movepath"),'utf-8')
97 sa=auto_move.search_file(recpath, tsmovepath,".ts")
99 sf=guess.searchFolder(t,tsmovepath,700)
101 recdblist.printutf8(u"移動先")
102 recdblist.printutf8(t+" : "+os.path.join(sf, auto_move.get_move_dest_path(t, recpath,sf,".ts")+".ts"))
103 recdblist.printutf8(u"実行中")
104 auto_move.execMove(t, recpath, tsmovepath,".ts",0)
105 sa=auto_move.search_file(recpath, tsmovepath,".ts")
107 recdblist.printutf8(u"ts_movepathが設定されていません。/etc/rec10.confを設定してください。")