OSDN Git Service

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