OSDN Git Service

fix bug,
[rec10/rec10-git.git] / rec10 / trunk / src / ts2epg.py
1 #!/usr/bin/python
2 # coding: UTF-8
3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009 Yukikaze
5 #import sys # モジュール属性 argv を取得するため
6 import os
7 import re
8 import time
9
10 import chdb
11 import configreader
12 import tv2ts
13
14 def write(pout, ch):
15     """
16     tsを取得してepgの入ったxmlとして書き出す
17     """
18     print u"ts2epg処理"
19     bctype = chdb.chsearch(ch)['bctype']
20     print ch + ":" + bctype
21     timet = "90"
22     if re.search(u'cs', bctype):
23         mode = "/CS"
24         timet = "180"
25     elif re.search(u'bs', bctype):
26         mode = "/BS"
27         timet = "240"
28     else:
29         mode = chdb.bctypesearch(u'te' + ch)['ontv']
30     epgdump = configreader.getpath("epgdump")
31     if os.access(pout + ".ts", os.F_OK):
32         os.remove(pout + ".ts")
33     time.sleep(10)
34     tv2ts.tv2tsmix(pout + ".ts", ch, timet)
35     exe = "export LANG=ja_JP.UTF-8 && nice -n 15 " + epgdump + " " + mode + " " + pout + ".ts " + pout
36     print exe
37     os.system(exe)
38     time.sleep(10)
39         
40