chname VARCHAR(100),\
updatetime DATETIME,\
status TINYINT,\
- isshow TINYINT\
+ isshow TINYINT DEFAULT 1\
)')
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
r[4] = r[4].strftime("%Y-%m-%d %H:%M:%S")
ret.append(r)
return ret
+ def change_isshow_epg_ch(self,chtxt,isshow):
+ db = self.connect_db()
+ db[1].execute("\
+ UPDATE epg_ch SET isshow=%s WHERE chtxt=%s",(chtxt,isshow))
+ self.close_db(db)
def set_new_status(self,dhour):
db = self.connect_db()
dbexe = db[1].execute("UPDATE epg_ch \
+import chdb\r
#!/usr/bin/python\r
# coding: UTF-8\r
# Rec10 TS Recording Tools\r
else:\r
return 0\r
def addCh(ch,bctype,chtxthead):\r
- prglist=getChProgNum(ch)\r
- for lstr in prglist:\r
+ prglist=getChProgNum(ch)##[prglist,logt]\r
+ for lstr in prglist[0]:\r
#print [bctype,chtxthead+"_"+lstr, ch, lstr]\r
try:\r
if ch.find("bs")>-1:\r
rec10d.rec10db.add_epg_ch(bctype,chtxthead+"_"+lstr, ch, lstr, u"2010-01-01 00:00:00")\r
except Exception, inst:\r
recdblist.addCommonlogEX("Warning", "addCh (scan_ch.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)\r
+ checkB25Purchased(ch, prglist[1])\r
def getChProgNum(ch):\r
pout=os.path.join(tmppath,"ch_"+str(ch)+".ts")\r
- tv2ts.tv2tsmix(pout, ch, "10")\r
+ logt=tv2ts.tv2tsmix(pout, ch, "10")\r
retl=getTsProgNum(ch,pout)\r
os.remove(pout)\r
- return retl\r
+ return [retl,logt]\r
def getTsProgNum(ch,tspath):\r
pin=tspath\r
pout=os.path.join(tmppath,"chscan.txt")\r
except:\r
""\r
return ret\r
+def getB25UnparchasedList(logtxt):\r
+ warning = 0\r
+ ret=[]\r
+ for strt in logtxt.split("\n"):\r
+ if strt.find("unpurchased ECM")>-1:\r
+ warning=1\r
+ if strt.find("total TS packet")>-1 and warning>0:\r
+ warning=0\r
+ if strt.find("channel")>-1 and warning>0:\r
+ ret.append(strt.replace("channel:","").replace("\n","").replace(" ",""))\r
+def checkB25Purchased(ch,logtxt):\r
+ print ch\r
+ print len(logtxt)\r
+ chlists=chdb.searchCHFromCh(ch)\r
+ print chlists\r
+ upl=getB25UnparchasedList(logtxt)\r
+ print "upl:"\r
+ print upl\r
+ for chl in chlists:\r
+ if upl.count(chl['csch'])>0:\r
+ chdb.changeCHShow(chl['chtxt'],"0")\r
+\r
import status
import recdblist
mypath = str(os.path.dirname(os.path.abspath(__file__))) + "/"
-def tv2tsmix(pout, ch, time):
+def tv2tsmix(pout, ch, time,getlog=0):
tv2b25ts(pout + ".b25", ch, time)
b252tsmix(pout + ".b25", pout)
#if os.access(pout, os.F_OK):
txt = unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8')
recdblist.addLog(pin, doexe, u"b25ログ-コマンド")
recdblist.addLog(pin, txt, u"b25ログ-詳細")
+ return txt
def tsmix2ts(pin, pout, csch):#csch=0ならcsの処理をしない
doexe = configreader.getConfPath("tssplitter") + " \""+ pin + "\" \""+ pout + "\" " + str(csch)
doexe = "nice -n 18 " + doexe