OSDN Git Service

fix LANG.
[rec10/rec10-git.git] / rec10 / trunk / src / xml2db_dom.py
index 27a03fc..fd41840 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/python\r
 # coding: UTF-8\r
 # Rec10 TS Recording Tools\r
-# Copyright (C) 2009-2010 Yukikaze\r
+# Copyright (C) 2009-2011 Yukikaze\r
 \r
 import xml.dom.minidom\r
 import datetime\r
@@ -38,6 +38,12 @@ def writeMultiTVDB(bctype,tvlists):
 def writeMultiCHDB(chlists):\r
     for chtxt,dn in chlists:\r
         rec10d.rec10db.update_chname_by_chtxt_epg_ch(chtxt,dn)\r
+def writeMultiLogoDB(logolists):\r
+    #[type,sv,pngdata]\r
+    for type,sv,pngdata in logolists:\r
+        chtxt=chdb.searchCHFromCsch(sv)['chtxt']\r
+        if len(chtxt)>0:\r
+            rec10d.rec10db.change_logodata_epg_ch(chtxt,type,pngdata)\r
 def xml2db_dom(xmlpath, bctype):#bctypeは放送種別で'TE'(地デジ)BS,CSがある。地デジの場合は te数字 が入る\r
     dtb=datetime.datetime.now()\r
     dom=xml.dom.minidom.parse(file(xmlpath))\r
@@ -60,7 +66,7 @@ def xml2db_dom(xmlpath, bctype):#bctypeは放送種別で'TE'(地デジ)BS,CSが
         title=addTitle_Subtitle(rHisch,1,title,desc)\r
         tch=chdb.searchCHFromChtxt(channel)\r
         if tch!=None:\r
-            if tch.get('bctype',"")==bctype:\r
+            if tch.get('bctype',"")==bctype and not tch['visible']==0:\r
                 bt=bayes.get(tch['chtxt'],["","",0])\r
                 bt2=[bt[0]+title+" ",bt[1]+desc+" "+longdesc+" ",bt[2]+1]\r
                 bayes[tch['chtxt']]=bt2\r
@@ -108,6 +114,21 @@ def xml2db_dom(xmlpath, bctype):#bctypeは放送種別で'TE'(地デジ)BS,CSが
     dtb=datetime.datetime.now()-dtb\r
     recdblist.printutf8(bctype + u" epg取り出し終了")\r
     recdblist.printutf8(str(dtb.days * 24 * 60 * 60 + dtb.seconds)+u"seconds taken for updating bayes-auto DB .")\r
+def xml2db_dom_logo(xmlpath, bctype):#bctypeは放送種別で'TE'(地デジ)BS,CSがある。地デジの場合は te数字 が入る\r
+    dtb=datetime.datetime.now()\r
+    dom=xml.dom.minidom.parse(file(xmlpath))\r
+    logolist=[]\r
+    for logo in dom.getElementsByTagName('logo'):\r
+        type=int(logo.getAttribute("type"))\r
+        sv=logo.getAttribute("sv")\r
+        pngdata=logo.childNodes[0].data\r
+        logolist.append([type,sv,pngdata])\r
+    dom.unlink()\r
+    if len(logolist) > 0:\r
+        writeMultiLogoDB(logolist)\r
+    dtb=datetime.datetime.now()-dtb\r
+    recdblist.printutf8(bctype + u" epg取り出し終了")\r
+    recdblist.printutf8(str(dtb.days * 24 * 60 * 60 + dtb.seconds)+u"seconds taken for updating logo DB .")\r
 def addTitle_Subtitle(recompiled,num,title,exp):\r
     try:\r
         tST=recompiled.match(exp)\r