OSDN Git Service

e222d6e7d74aa5f548c56da2cc0e900c0644cb7f
[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-2010 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 import recdblist
14
15 def write(pout, ch):
16     """
17     tsを取得してepgの入ったxmlとして書き出す
18     """
19     timet = "90"
20     if re.search(u'CS', ch):
21         timet = "180"
22     elif len(ch)>2:
23         timet = "240"
24     writeTime(pout, ch ,timet)
25 def writeTime(pout, ch ,times):
26     """
27     指定された時間分tsを取得してepgの入ったxmlとして書き出す
28     """
29     recdblist.addCommonlogEX(u"通常","write_time(ts2epg.py)",u"Ts-EPG XML書き出し処理開始" ,u"CH:"+ch,log_level=500)
30     timet = times
31     if re.search(u'CS', ch):
32         mode = "/CS"
33     elif len(ch)>2:
34         mode = "/BS"
35     else:
36         mode = str(chdb.bctypesearch(u'te' + ch)['ch'])
37     epgsearchFromBctypegreader.getPathSetting("epgdump")
38     if os.access(pout + ".ts", os.F_OK):
39         os.remove(pout + ".ts")
40     time.sleep(10)
41     tv2ts.tv2tsmix(pout + ".ts", ch, timet)
42     exe = "export LANG=ja_JP.UTF-8 && nice -n 15 " + epgdump + " " + mode + " " + pout + ".ts " + pout
43     recdblist.printutf8(exe)
44     recdblist.addCommonlogEX(u"通常", "write_time(ts2epg.py)", exe,"",log_level=500)
45     os.system(exe)
46     time.sleep(10)
47