Author: tack
Date: Mon Oct 17 18:40:40 2005
New Revision: 876
Modified:
trunk/WIP/epg2/src/server.py
trunk/WIP/epg2/src/source_xmltv.py
Log:
libxml2 content is natively utf-8 so use .decode("utf-8") instead of
str_to_unicode(); fix bug where get_num_programs() returned old value
after an update.
Modified: trunk/WIP/epg2/src/server.py
==============================================================================
--- trunk/WIP/epg2/src/server.py (original)
+++ trunk/WIP/epg2/src/server.py Mon Oct 17 18:40:40 2005
@@ -84,6 +84,7 @@
if cur == total:
self._db.commit()
+ self._load()
self.signals["updated"].emit()
self.signals["update_progress"].disconnect(self._update_progress)
print "\nProcessed in %.02f seconds." %
(time.time()-update_start_time)
Modified: trunk/WIP/epg2/src/source_xmltv.py
==============================================================================
--- trunk/WIP/epg2/src/source_xmltv.py (original)
+++ trunk/WIP/epg2/src/source_xmltv.py Mon Oct 17 18:40:40 2005
@@ -1,5 +1,4 @@
import libxml2, sys, time, os, calendar
-from kaa.base.utils import str_to_unicode
import kaa.notifier
def timestr2secs_utc(timestr):
@@ -56,7 +55,7 @@
def parse_channel(info):
- channel_id = str_to_unicode(info.node.prop("id"))
+ channel_id = info.node.prop("id").decode("utf-8")
channel = station = name = None
child = info.node.children
@@ -69,9 +68,9 @@
if not channel and child.content.isdigit():
channel = int(child.content)
elif not station and child.content.isalpha():
- station = str_to_unicode(child.content)
+ station = child.content.decode("utf-8")
elif channel and station and not name:
- name = str_to_unicode(child.content)
+ name = child.content.decode("utf-8")
child = child.get_next()
id = info.epg._add_channel_to_db(channel_id, channel, station, name)
@@ -79,7 +78,7 @@
def parse_programme(info):
- channel_id = str_to_unicode(info.node.prop("channel"))
+ channel_id = info.node.prop("channel").decode("utf-8")
if channel_id not in info.channel_id_to_db_id:
log.warning("Program exists for unknown channel '%s'" % channel_id)
return
@@ -89,9 +88,9 @@
child = info.node.children
while child:
if child.name == "title":
- title = str_to_unicode(child.content)
+ title = child.content.decode("utf-8")
elif child.name == "desc":
- desc = str_to_unicode(child.content)
+ desc = child.content.decode("utf-8")
elif child.name == "date":
fmt = "%Y%m%d"
if len(child.content) == 4:
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog