Update of /cvsroot/freevo/kaa/epg/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32661
Modified Files:
guide.py
Log Message:
use new sqlite interface
Index: guide.py
===================================================================
RCS file: /cvsroot/freevo/kaa/epg/src/guide.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** guide.py 21 Aug 2005 11:08:14 -0000 1.5
--- guide.py 21 Aug 2005 13:58:03 -0000 1.6
***************
*** 41,44 ****
--- 41,45 ----
from channel import Channel
from program import Program
+ from schema import *
# get logging object
***************
*** 86,90 ****
Close the database connection.
"""
- self.db.commit()
self.db.close()
--- 87,90 ----
***************
*** 229,238 ****
result = []
! for p in self.db.execute(query, True):
# id, channel_id, start, stop, title, episode, subtitle, \
# description, rating, original_airdate
if self.channel_dict.has_key(p[1]):
! result.append(Program(p[0], p[4], p[2], p[3], p[5], p[6],
! p[7], self.channel_dict[p[1]]))
return result
--- 229,239 ----
result = []
! for p in self.db.execute(query):
# id, channel_id, start, stop, title, episode, subtitle, \
# description, rating, original_airdate
if self.channel_dict.has_key(p[1]):
! result.append(Program(p[ID], p[TITLE], p[START], p[STOP],
p[EPISODE],
! p[SUBTITLE], p[DESCRIPTION],
! self.channel_dict[p[CHANNEL_ID]]))
return result
***************
*** 307,311 ****
rows = self.db.execute(query)
for row in rows:
! id_list.append(row[0])
return id_list
--- 308,312 ----
rows = self.db.execute(query)
for row in rows:
! id_list.append(row[ID])
return id_list
***************
*** 333,344 ****
"and start>%s and start<%s" % (start, stop)
rows = self.db.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:
! log.info('delete %s:' % row.title.encode('latin-1',
'replace'))
! self.sql_remove_program(row.id)
# Get program at the given time
--- 334,345 ----
"and start>%s and start<%s" % (start, stop)
rows = self.db.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:
! log.info('delete %s:' % row[TITLE].encode('latin-1',
'replace'))
! self.sql_remove_program(row[ID])
# Get program at the given time
***************
*** 349,369 ****
# An old program is found, check attributes.
old = rows[0]
! if type(old.title) != unicode or type(title) != unicode:
! log.error(type(old.title), type(title))
!
! 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.db.execute(query % (subtitle.replace("'", "''"),
old.id))
self.db.commit()
! if old.description != description:
query = "update programs set description='%s' where id=%d"
! self.db.execute(query % (description.replace("'", "''"),
old.id))
self.db.commit()
! if old.episode != episode:
query = "update programs set episode='%s' where id=%d"
! self.db.execute(query % (episode.replace("'", "''"),
old.id))
self.db.commit()
return
--- 350,368 ----
# 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.db.execute(query % (subtitle.replace("'", "''"),
old[ID]))
self.db.commit()
! if old[DESCRIPTION] != description:
query = "update programs set description='%s' where id=%d"
! self.db.execute(query % (description.replace("'", "''"),
old[ID]))
self.db.commit()
! if old[EPISODE] != episode:
query = "update programs set episode='%s' where id=%d"
! self.db.execute(query % (episode.replace("'", "''"),
old[ID]))
self.db.commit()
return
***************
*** 373,377 ****
# this is probably a schedule change, remove the old one
# TODO: check for shifting times and program overlaps
! self.sql_remove_program(old.id)
#
--- 372,376 ----
# this is probably a schedule change, remove the old one
# TODO: check for shifting times and program overlaps
! self.sql_remove_program(old[ID])
#
-------------------------------------------------------
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-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog