OSDN Git Service

861719bbb27ccc97d3c7a385fc53b62209e9113e
[rec10/rec10-git.git] / rec10 / trunk / src / chdata.py
1 #!/usr/bin/python\r
2 # coding: UTF-8\r
3 # Rec10 TS Recording Tools\r
4 # Copyright (C) 2009-2011 Yukikaze\r
5 import os.path\r
6 import configreader\r
7 import xml.dom.minidom\r
8 import scan_ch\r
9 import datetime\r
10 \r
11 import rec10d\r
12 \r
13 path = str(os.path.dirname(os.path.abspath(__file__))) + "/"\r
14 \r
15 def chAdd(bctype, chtxt, ch, csch):#すべて文字列\r
16     tnow=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")\r
17     rec10d.rec10db.add_epg_ch(bctype,chtxt, ch, csch, u"2010-01-01 00:00:00",u"2010-01-01 00:00:00",tnow)\r
18 def addCHlist(cl):\r
19     if len(cl)>0:\r
20         for c in cl:\r
21             chAdd(c[0],c[1],c[2],c[3])\r
22 def getChList(xmlpath):\r
23     dom=xml.dom.minidom.parse(file(xmlpath))\r
24     chlist=[]\r
25     for ch in dom.getElementsByTagName('channel'):\r
26         bctype=ch.getAttribute("bctype")\r
27         chd=ch.getAttribute("ch")\r
28         csch=ch.getAttribute("csch")\r
29         chtxt=ch.getAttribute("chtxt")\r
30         ontv=ch.getAttribute("ontvcode")\r
31         chlist.append([bctype,ontv,chtxt,chd,csch])\r
32     return chlist\r
33 def deleteChListALL():\r
34     rec10d.rec10db.new_epg_ch()\r
35 if __name__ == "__main__":\r
36     deleteChListALL()\r
37     scan_ch.searchCh()\r