X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;ds=sidebyside;f=rec10%2Ftrunk%2Fsrc%2Fchdata.py;h=861719bbb27ccc97d3c7a385fc53b62209e9113e;hb=975a6c548b6b2c399741a3fbde870c5aa6e7ab0f;hp=8532baa96cd8c13c9b1b098dcfd78e53e687dbb1;hpb=00ba637c464e158b59876a2861c3ce5f1324cef8;p=rec10%2Frec10-git.git diff --git a/rec10/trunk/src/chdata.py b/rec10/trunk/src/chdata.py index 8532baa..861719b 100644 --- a/rec10/trunk/src/chdata.py +++ b/rec10/trunk/src/chdata.py @@ -1,49 +1,37 @@ -#!/usr/bin/python -# coding: UTF-8 -# Rec10 TS Recording Tools -# Copyright (C) 2009-2010 Yukikaze -import os.path -import configreader -import xml.dom.minidom - -import rec10d - -path = str(os.path.dirname(os.path.abspath(__file__))) + "/" - -def chadd(bctype, ontv, chtxt, ch, csch):#すべて文字列 - rec10d.rec10db.add_epg_ch(bctype, ontv, chtxt, ch, csch, u"2010-01-01 00:00:00") -def chlistadd(cl): - if len(cl)>0: - for c in cl: - chadd(c[0],c[1],c[2],c[3],c[4]) -def new_chdata(bs,cs): - rec10d.rec10db.new_epg_ch() - chlistadd(getChList(os.path.join(path,"chlist.xml"))) - if bs==1: - #bs放送の設定 全国共通のはず - chlistadd(getChList(os.path.join(path,"chlist_bs.xml"))) - if cs==1: - #CS放送(スカパーe2)主に基本パックには言ってるものを中心に - chlistadd(getChList(os.path.join(path,"chlist_cs.xml"))) -def new_chdata_all(): - bs=0 - cs=0 - try: - bs=int(configreader.getenv("bs")) - cs=int(configreader.getenv("cs")) - except: - "" - new_chdata(bs,cs) -def getChList(xmlpath): - dom=xml.dom.minidom.parse(file(xmlpath)) - chlist=[] - for ch in dom.getElementsByTagName('channel'): - bctype=ch.getAttribute("bctype") - chd=ch.getAttribute("ch") - csch=ch.getAttribute("csch") - chtxt=ch.getAttribute("chtxt") - ontv=ch.getAttribute("ontvcode") - chlist.append([bctype,ontv,chtxt,chd,csch]) - return chlist -if __name__ == "__main__": - new_chdata_all() \ No newline at end of file +#!/usr/bin/python +# coding: UTF-8 +# Rec10 TS Recording Tools +# Copyright (C) 2009-2011 Yukikaze +import os.path +import configreader +import xml.dom.minidom +import scan_ch +import datetime + +import rec10d + +path = str(os.path.dirname(os.path.abspath(__file__))) + "/" + +def chAdd(bctype, chtxt, ch, csch):#すべて文字列 + tnow=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + rec10d.rec10db.add_epg_ch(bctype,chtxt, ch, csch, u"2010-01-01 00:00:00",u"2010-01-01 00:00:00",tnow) +def addCHlist(cl): + if len(cl)>0: + for c in cl: + chAdd(c[0],c[1],c[2],c[3]) +def getChList(xmlpath): + dom=xml.dom.minidom.parse(file(xmlpath)) + chlist=[] + for ch in dom.getElementsByTagName('channel'): + bctype=ch.getAttribute("bctype") + chd=ch.getAttribute("ch") + csch=ch.getAttribute("csch") + chtxt=ch.getAttribute("chtxt") + ontv=ch.getAttribute("ontvcode") + chlist.append([bctype,ontv,chtxt,chd,csch]) + return chlist +def deleteChListALL(): + rec10d.rec10db.new_epg_ch() +if __name__ == "__main__": + deleteChListALL() + scan_ch.searchCh()