OSDN Git Service

implement encode tester.
[rec10/rec10-git.git] / rec10 / trunk / src / auto_test.py
diff --git a/rec10/trunk/src/auto_test.py b/rec10/trunk/src/auto_test.py
new file mode 100644 (file)
index 0000000..78ddcca
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/python
+# coding: UTF-8
+# Rec10 TS Recording Tools
+# Copyright (C) 2009-2010 Yukikaze
+import os
+import os.path
+import time
+
+import configreader
+import chdb
+import tv2mp4
+import tv2ts
+def test_all_ch_encode(option,time):
+    chl=chdb.getall()
+    print chl
+    path= configreader.getpath("test")
+    tpath=os.path.join(path, "encode_test")
+    if not os.path.exists(tpath):
+        os.mkdir(tpath)
+    dnowt=datetime.datetime.now().strftime("%Y-%m-%d_%H:%M:%S")+"("+option+")"
+    tpatht=os.path.join(tpath,dnowt)
+    if not os.path.exists(tpatht):
+        os.mkdir(tpatht)
+    if len(chl)>0:
+        for t in chl:
+            print t
+            pathname=os.path.join(tpatht,t['chtxt'])
+            print pathname
+            tv2ts.tv2ts(pathname+".ts",t['ch'],t['csch'], time)
+            tv2mp4.ts2mp4(pathname+".ts", pathname+".mp4", option)
+            time.sleep(2)
+if __name__ == "__main__":
+    usage="usage: "
+    version="%prog 0.9.7"
+    parser=optparse.OptionParser(usage=usage,version=version)
+    parser.add_option("-e","--Encode",action="store",type="string",dest="encode_option",default="",metavar="TITLE",help="encode test(option)")
+    (opts,args)=parser.parse_args(sys.argv)
+    if opts.encode_option != "":##-sの場合
+        test_all_ch_encode(opts.encode_option, 10)
\ No newline at end of file