OSDN Git Service

make this to retry recording/epgts_getting.
[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 configreader
8 import tv2ts
9 import re
10 import chdb
11
12
13 def write(pout,ch):
14     """
15     tsを取得してepgの入ったxmlとして書き出す
16     """
17     print "ts2epg処理"
18     bctype=chdb.chsearch(ch)['bctype']
19     print ch+":"+bctype
20     time="120"
21     if re.search('cs',bctype):
22         mode="/CS"
23         time="300"
24     elif re.search('bs',bctype):
25         mode="/BS"
26         time="300"
27     else :
28         mode=chdb.bctypesearch('te'+ch)['ontv']
29     tsepg2xml=configreader.getpath("tsepg2xml")
30     time.sleep(5)
31     tv2ts.tv2tsmix(pout+".ts",ch,"180")
32     if not os.access(pout+".ts", os.F_OK):
33         time.sleep(10)
34         tv2ts.tv2tsmix(pout+".ts",ch,"180")
35     exe="export LANG=ja_JP.UTF-8 && /usr/bin/nice -n 19 wine "+tsepg2xml+" "+mode+" "+pout+".ts >"+pout
36     print exe
37     os.system(exe)
38
39         
40