Dischi, I'm having some problems leading back to these changes. It has
to do with accessing the query result as an attribute vs a dict key.
When I wrote these parts I initially used them all as attributes but
immediately ran into problems with some of them (they just did not work,
no error either). I then changed them all to be dict style and things
worked fine. I remembered this when I saw this changelog come through
but only now got to update and try it out... no go for me, BTW I'm still
using sqlite 1.
I picked up on this after updating and checking the webserver's tv
guide. All hits to proginfo.py were not giving viewable results, and
even logging prog.description did not produce results. I logged some
info on prog.description and it was a "bound method
PgResultSetConcreteClass.description".
I had to edit channel.py in kaa to resulve it:
Index: epg/src/channel.py
===================================================================
RCS file: /cvsroot/freevo/kaa/epg/src/channel.py,v
retrieving revision 1.4
diff -u -r1.4 channel.py
--- epg/src/channel.py 17 Jul 2005 12:42:16 -0000 1.4
+++ epg/src/channel.py 11 Aug 2005 14:54:32 -0000
@@ -115,7 +115,7 @@
notifier_counter = 0
for p in self.__epg.sql_get_programs(self.id, start, stop):
i = Program(p.id, p.title, p.start, p.stop, p.episode,
p.subtitle,
- p.description, channel=self)
+ p['description'], channel=self)
new_progs.append(i)
notifier_counter = (notifier_counter + 1) % 500
if not notifier_counter:
More comments below... what do you think?
Dirk Meyer wrote:
Update of /cvsroot/freevo/kaa/epg/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29229
Modified Files:
channel.py guide.py
Log Message:
speed up search for sqlite2
Index: channel.py
===================================================================
RCS file: /cvsroot/freevo/kaa/epg/src/channel.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** channel.py 7 Jul 2005 09:39:06 -0000 1.3
--- channel.py 17 Jul 2005 12:42:16 -0000 1.4
***************
*** 116,120 ****
for p in self.__epg.sql_get_programs(self.id, start, stop):
i = Program(p.id, p.title, p.start, p.stop, p.episode, p.subtitle,
! p['description'], channel=self)
new_progs.append(i)
notifier_counter = (notifier_counter + 1) % 500
--- 116,120 ----
for p in self.__epg.sql_get_programs(self.id, start, stop):
i = Program(p.id, p.title, p.start, p.stop, p.episode, p.subtitle,
! p.description, channel=self)
new_progs.append(i)
notifier_counter = (notifier_counter + 1) % 500
Index: guide.py
===================================================================
RCS file: /cvsroot/freevo/kaa/epg/src/guide.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** guide.py 17 Jul 2005 09:44:20 -0000 1.3
--- guide.py 17 Jul 2005 12:42:16 -0000 1.4
***************
...
And maybe this (.title):
*** 354,364 ****
'and start>%s and start<%s' % (start, stop)
rows = self.sql_execute(query)
! if len(rows) and (len(rows) > 1 or rows[0]['start'] != start or \
! rows[0]['stop'] != stop):
log.info('changed program time table:')
# The time table changed. Old programs overlapp new once
# Better remove everything here
for row in rows:
! title = row['title'].encode('latin-1', 'replace')
log.info('delete %s:' % title)
self.sql_remove_program(row.id)
--- 345,355 ----
'and start>%s and start<%s' % (start, stop)
rows = self.sql_execute(query)
! if len(rows) and (len(rows) > 1 or rows[0].start != start or \
! rows[0].stop != stop):
log.info('changed program time table:')
# The time table changed. Old programs overlapp new once
# Better remove everything here
for row in rows:
! title = row.title.encode('latin-1', 'replace')
log.info('delete %s:' % title)
self.sql_remove_program(row.id)
***************
Also:
*** 371,386 ****
# An old program is found, check attributes.
old = rows[0]
! if old['title'] == title:
# program timeslot is unchanged, see if there's anything
# that we should update
! if old['subtitle'] != subtitle:
query = 'update programs set subtitle="%s" where id=%d'
self.sql_execute(query % (subtitle, old.id))
self.sql_commit()
! if old['description'] != description:
query = 'update programs set description="%s" where id=%d'
self.sql_execute(query % (description, old.id))
self.sql_commit()
! if old['episode'] != episode:
query = 'update programs set episode="%s" where id=%d'
self.sql_execute(query % (episode, old.id))
--- 362,377 ----
# An old program is found, check attributes.
old = rows[0]
! if old.title == title:
# program timeslot is unchanged, see if there's anything
# that we should update
! if old.subtitle != subtitle:
query = 'update programs set subtitle="%s" where id=%d'
self.sql_execute(query % (subtitle, old.id))
self.sql_commit()
! if old.description != description:
query = 'update programs set description="%s" where id=%d'
self.sql_execute(query % (description, old.id))
self.sql_commit()
! if old.episode != episode:
query = 'update programs set episode="%s" where id=%d'
self.sql_execute(query % (episode, old.id))
***************
And:
*** 392,396 ****
# this is probably a schedule change, remove the old one
# TODO: check for shifting times and program overlaps
! self.sql_remove_program(old['id'])
#
--- 383,387 ----
# this is probably a schedule change, remove the old one
# TODO: check for shifting times and program overlaps
! self.sql_remove_program(old.id)
#
--
-------------------------------------------------------
Rob Shortt | http://tvcentric.com | Freevo
[EMAIL PROTECTED] | http://freevo.sf.net | Free your TV
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Freevo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-devel