3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009-2010 Yukikaze
14 tmppath = configreader.getpath("tmp")+"/"
15 tssplitterp = configreader.getpath("tssplitter")
18 for i in xrange(12,99):
19 recdblist.printuft8ex(u"チャンネルスキャン:地上デジタル CH "+str(i), 200, 200)
21 addCh(str(i),u"te"+str(i),str(i))
23 recdblist.printuft8ex(u"チャンネルスキャン:BSデジタル "+str(i), 200, 200)
24 for i in xrange(100,240):
25 recdblist.printuft8ex(u"チャンネルスキャン:BSデジタル CH "+str(i), 200, 200)
27 addCh(str(i),u"bs","BS")
29 #http://www5e.biglobe.ne.jp/~kazu_f/digital-sat/trapon-nsat110.html
33 addCh("CS2","cs1","CS")
35 addCh("CS8","cs1","CS")
37 addCh("CS10","cs1","CS")
40 addCh("CS4","cs2","CS")
42 addCh("CS6","cs2","CS")
44 addCh("CS12","cs2","CS")
46 addCh("CS14","cs2","CS")
48 addCh("CS16","cs2","CS")
50 addCh("CS18","cs2","CS")
52 addCh("CS20","cs2","CS")
54 addCh("CS22","cs2","CS")
56 addCh("CS24","cs2","CS")
58 tv2ts.tv2b25ts(os.path.join(tmppath,"ch_"+str(ch)+".ts"), ch, "1")
59 if os.path.exists(os.path.join(tmppath,"ch_"+str(ch)+".ts")):
60 os.remove(os.path.join(tmppath,"ch_"+str(ch)+".ts"))
64 def addCh(ch,bctype,chtxthead):
65 prglist=getChProgNum(ch)
67 #print [bctype,chtxthead+"_"+lstr, ch, lstr]
69 rec10d.rec10db.add_epg_ch(bctype,chtxthead+"_"+lstr, ch, lstr, u"2010-01-01 00:00:00")
70 except Exception, inst:
71 recdblist.Commonlogex("Warning", "addCh (scan_ch.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
73 pout=os.path.join(tmppath,"ch_"+str(ch)+".ts")
74 tv2ts.tv2tsmix(pout, ch, "10")
75 retl=getTsProgNum(pout)
78 def getTsProgNum(tspath):
80 pout=os.path.join(tmppath,"chscan.txt")
81 doexe = tssplitterp + " -ch \""+ pin + "\" \""+ pout + "\""
82 doexe = "nice -n 18 " + doexe
83 os.environ['LANG']="ja_JP.UTF-8"
84 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8','ignore')
93 ret.append(str(int(l)))
96 recdblist.addlog(pin, doexe, u"TsSplitログ-コマンド")
97 recdblist.addlog(pin, txt, u"TsSplitログ-詳細")