-#!/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, chtxt, ch, csch):#すべて文字列
- rec10d.rec10db.add_epg_ch(bctype,chtxt, ch, csch, u"2010-01-01 00:00:00")
-def addCHlist(cl):
- if len(cl)>0:
- for c in cl:
- chAdd(c[0],c[1],c[2],c[3])
-def newCHdata(bs,cs):
- rec10d.rec10db.new_epg_ch()
- addCHlist(getCHlist(os.path.join(path,"chlist.xml")))
- if bs==1:
- #bs放送の設定 全国共通のはず
- addCHlist(getCHlist(os.path.join(path,"chlist_bs.xml")))
- if cs==1:
- #CS放送(スカパーe2)主に基本パックに入ってるものを中心に
- addCHlist(getCHlist(os.path.join(path,"chlist_cs.xml")))
-def newAllCHdata():
- bs=0
- cs=0
- try:
- bs=int(configreader.getEnvSetting("bs"))
- cs=int(configreader.getEnvSetting("cs"))
- except:
- ""
- newCHdata(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__":
- newAllCHdata()
\ No newline at end of file
+#!/usr/bin/python\r
+# coding: UTF-8\r
+# Rec10 TS Recording Tools\r
+# Copyright (C) 2009-2010 Yukikaze\r
+import os.path\r
+import configreader\r
+import xml.dom.minidom\r
+\r
+import rec10d\r
+\r
+path = str(os.path.dirname(os.path.abspath(__file__))) + "/"\r
+\r
+def chAdd(bctype, chtxt, ch, csch):#すべて文字列\r
+ rec10d.rec10db.add_epg_ch(bctype,chtxt, ch, csch, u"2010-01-01 00:00:00")\r
+def addCHlist(cl):\r
+ if len(cl)>0:\r
+ for c in cl:\r
+ chAdd(c[0],c[1],c[2],c[3])\r
+def newChdata(bs,cs):\r
+ rec10d.rec10db.new_epg_ch()\r
+ addCHlist(getCHlist(os.path.join(path,"chlist.xml")))\r
+ if bs==1:\r
+ #bs放送の設定 全国共通のはず\r
+ addCHlist(getCHlist(os.path.join(path,"chlist_bs.xml")))\r
+ if cs==1:\r
+ #CS放送(スカパーe2)主に基本パックに入ってるものを中心に\r
+ chlistadd(getChList(os.path.join(path,"chlist_cs.xml")))\r
+def newChdataAll():\r
+ bs=0\r
+ cs=0\r
+ try:\r
+ bs=int(configreader.getConfEnv("bs"))\r
+ cs=int(configreader.getConfEnv("cs"))\r
+ except:\r
+ ""\r
+ newChdata(bs,cs)\r
+def getChList(xmlpath):\r
+ dom=xml.dom.minidom.parse(file(xmlpath))\r
+ chlist=[]\r
+ for ch in dom.getElementsByTagName('channel'):\r
+ bctype=ch.getAttribute("bctype")\r
+ chd=ch.getAttribute("ch")\r
+ csch=ch.getAttribute("csch")\r
+ chtxt=ch.getAttribute("chtxt")\r
+ ontv=ch.getAttribute("ontvcode")\r
+ chlist.append([bctype,ontv,chtxt,chd,csch])\r
+ return chlist\r
+if __name__ == "__main__":\r
+ newChdataAll()\r