OSDN Git Service

add tsid channel information for complete BS support.
[rec10/rec10-git.git] / rec10 / trunk / src / auto_test.py
1 #!/usr/bin/python\r
2 # coding: UTF-8\r
3 # Rec10 TS Recording Tools\r
4 # Copyright (C) 2009-2011 Yukikaze\r
5 import os\r
6 import os.path\r
7 import time\r
8 import optparse\r
9 import sys\r
10 import datetime\r
11 \r
12 import configreader\r
13 import chdb\r
14 import tv2mp4\r
15 import tv2ts\r
16 def testAllCHEncode(option,stime):\r
17     chl=chdb.getAllCH()\r
18     print chl\r
19     path= configreader.getConfPath("test")\r
20     tpath=os.path.join(path, "encode_test")\r
21     if not os.path.exists(tpath):\r
22         os.mkdir(tpath)\r
23     dnowt=datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")+"_"+option+""\r
24     tpatht=os.path.join(tpath,dnowt)\r
25     if not os.path.exists(tpatht):\r
26         os.mkdir(tpatht)\r
27     if len(chl)>0:\r
28         for t in chl:\r
29             print t\r
30             pathname=os.path.join(tpatht,t['chtxt'])\r
31             print pathname\r
32             tv2ts.tv2ts(pathname+".ts",t['ch'],t['csch'], stime,t['tsid'])\r
33             tv2mp4.ts2mp4(pathname+".ts", pathname+".mp4", option)\r
34             time.sleep(2)\r
35 if __name__ == "__main__":\r
36     usage="usage: "\r
37     version="%prog 0.9.7"\r
38     parser=optparse.OptionParser(usage=usage,version=version)\r
39     parser.add_option("-e","--Encode",action="store",type="string",dest="encode_option",default="",metavar="TITLE",help="encode test(option)")\r
40     (opts,args)=parser.parse_args(sys.argv)\r
41     if opts.encode_option != "":##-sの場合\r
42         print "test_all_ch_encode"\r
43         testAllCHEncode(opts.encode_option, "10")\r