OSDN Git Service

implement 0.9.10
[rec10/rec10-git.git] / rec10 / trunk / src / ts2epg.py
index 409a509..cdf65ff 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 # coding: UTF-8
 # Rec10 TS Recording Tools
-# Copyright (C) 2009 Yukikaze
+# Copyright (C) 2009-2010 Yukikaze
 #import sys # モジュール属性 argv を取得するため
 import os
 import re
@@ -10,33 +10,38 @@ import time
 import chdb
 import configreader
 import tv2ts
+import recdblist
 
 def write(pout, ch):
     """
     tsを取得してepgの入ったxmlとして書き出す
     """
-    print "ts2epg処理"
-    bctype = chdb.chsearch(ch)['bctype']
-    print ch + ":" + bctype
-    timet = "10"
-    if re.search(u'cs', bctype):
+    timet = "90"
+    if re.search(u'CS', ch):
+        timet = "180"
+    elif len(ch)>2:
+        timet = "240"
+    writeTime(pout, ch ,timet)
+def writeTime(pout, ch ,times):
+    """
+    指定された時間分tsを取得してepgの入ったxmlとして書き出す
+    """
+    recdblist.addCommonlogEX(u"通常","write_time(ts2epg.py)",u"Ts-EPG XML書き出し処理開始" ,u"CH:"+ch,log_level=500)
+    timet = times
+    if re.search(u'CS', ch):
         mode = "/CS"
-        timet = "10"
-    elif re.search(u'bs', bctype):
+    elif len(ch)>2:
         mode = "/BS"
-        timet = "10"
     else:
-        mode = chdb.bctypesearch(u'te' + ch)['ontv']
-    epgdump = configreader.getpath("epgdump")
+        mode = str(chdb.searchFromBctype(u'te' + ch)['ch'])
+    epgdump=configreader.getPathSetting("epgdump")
     if os.access(pout + ".ts", os.F_OK):
         os.remove(pout + ".ts")
     time.sleep(10)
-    print type(ch)
-    print ch
     tv2ts.tv2tsmix(pout + ".ts", ch, timet)
     exe = "export LANG=ja_JP.UTF-8 && nice -n 15 " + epgdump + " " + mode + " " + pout + ".ts " + pout
-    print exe
+    recdblist.printutf8(exe)
+    recdblist.addCommonlogEX(u"通常", "write_time(ts2epg.py)", exe,"",log_level=500)
     os.system(exe)
     time.sleep(10)
-