OSDN Git Service

add logo search.
[rec10/rec10-git.git] / rec10 / trunk / src / chdata.py
index fb7f56c..861719b 100644 (file)
@@ -1,53 +1,37 @@
-#!/usr/bin/python
-# coding: UTF-8
-# Rec10 TS Recording Tools
-# Copyright (C) 2009-2010 Yukikaze
-import os.path
-import xml.dom.minidom
-
-import rec10d
-
-path = str(os.path.dirname(os.path.abspath(__file__))) + "/"
-
-def chadd(bctype, ontv, chtxt, ch, csch):#すべて文字列
-    """
-    ChannelDBに指定したデータを追加する
-    bctype:放送種別,bs/cs/te10などが入る。
-    番組表データがbs,csは一括でとれるためbs,cs内で区別はなし
-    te(地上波)は各チャンネルごとに設定する必要があるためteに
-    チャンネルの数字を足したものにする
-    """
-    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():
-    new_chdata(1,1)
-    #チャンネルの設定
-    #chadd(u'放送種別',u'ontvコード(ontvのサイトなどで調べられる)',u'略称(何でもよい)',u'チャンネル(物理チャンネル)',u'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(1,1)
\ No newline at end of file
+#!/usr/bin/python\r
+# coding: UTF-8\r
+# Rec10 TS Recording Tools\r
+# Copyright (C) 2009-2011 Yukikaze\r
+import os.path\r
+import configreader\r
+import xml.dom.minidom\r
+import scan_ch\r
+import datetime\r
+\r
+import rec10d\r
+\r
+path = str(os.path.dirname(os.path.abspath(__file__))) + "/"\r
+\r
+def chAdd(bctype, chtxt, ch, csch):#すべて文字列\r
+    tnow=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")\r
+    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
+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 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
+def deleteChListALL():\r
+    rec10d.rec10db.new_epg_ch()\r
+if __name__ == "__main__":\r
+    deleteChListALL()\r
+    scan_ch.searchCh()\r