3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009-2010 Yukikaze
15 tmppath = configreader.getpath("tmp")+"/"
16 tssplitterp = configreader.getpath("tssplitter")
19 for i in xrange(12,99):
20 recdblist.printuft8ex(u"チャンネルスキャン:地上デジタル CH "+str(i), 200, 200)
22 addCh(str(i),u"te"+str(i),str(i))
24 recdblist.printuft8ex(u"チャンネルスキャン:BSデジタル "+str(i), 200, 200)
25 for i in xrange(100,240):
26 recdblist.printuft8ex(u"チャンネルスキャン:BSデジタル CH "+str(i), 200, 200)
28 addCh(str(i),u"bs","BS")
30 #http://www5e.biglobe.ne.jp/~kazu_f/digital-sat/trapon-nsat110.html
34 addCh("CS2","cs1","CS")
36 addCh("CS8","cs1","CS")
38 addCh("CS10","cs1","CS")
41 addCh("CS4","cs2","CS")
43 addCh("CS6","cs2","CS")
45 addCh("CS12","cs2","CS")
47 addCh("CS14","cs2","CS")
49 addCh("CS16","cs2","CS")
51 addCh("CS18","cs2","CS")
53 addCh("CS20","cs2","CS")
55 addCh("CS22","cs2","CS")
57 addCh("CS24","cs2","CS")
59 tv2ts.tv2b25ts(os.path.join(tmppath,"ch_"+str(ch)+".ts"), ch, "1")
60 if os.path.exists(os.path.join(tmppath,"ch_"+str(ch)+".ts")):
61 os.remove(os.path.join(tmppath,"ch_"+str(ch)+".ts"))
65 def addCh(ch,bctype,chtxthead):
66 prglist=getChProgNum(ch)
68 #print [bctype,chtxthead+"_"+lstr, ch, lstr]
72 rec10d.rec10db.add_epg_ch(bctype,chtxthead+"_"+lstr, ch, lstr, u"2010-01-01 00:00:00")
74 rec10d.rec10db.add_epg_ch(bctype,chtxthead+"_"+lstr, ch, lstr, u"2010-01-01 00:00:00")
75 except Exception, inst:
76 recdblist.Commonlogex("Warning", "addCh (scan_ch.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
78 pout=os.path.join(tmppath,"ch_"+str(ch)+".ts")
79 tv2ts.tv2tsmix(pout, ch, "10")
80 retl=getTsProgNum(pout)
83 def getTsProgNum(tspath):
85 pout=os.path.join(tmppath,"chscan.txt")
86 doexe = tssplitterp + " -ch \""+ pin + "\" \""+ pout + "\""
87 doexe = "nice -n 18 " + doexe
88 os.environ['LANG']="ja_JP.UTF-8"
89 txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8','ignore')
98 ret.append(str(int(l)))
101 recdblist.addlog(pin, doexe, u"TsSplitログ-コマンド")
102 recdblist.addlog(pin, txt, u"TsSplitログ-詳細")