Update of /cvsroot/freevo/freevo/lib/pyepg
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22271

Modified Files:
        guide.py 
Log Message:
remove overlapping

Index: guide.py
===================================================================
RCS file: /cvsroot/freevo/freevo/lib/pyepg/guide.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** guide.py    13 Dec 2004 01:42:10 -0000      1.18
--- guide.py    28 Dec 2004 17:03:48 -0000      1.19
***************
*** 195,201 ****
          now = time.time()
          title = self.__escape_value(title)
!         subtitle = self.__escape_value(subtitle)
!         description = self.__escape_value(description)
!         episode = self.__escape_value(episode)
  
          old_prog = None
--- 195,201 ----
          now = time.time()
          title = self.__escape_value(title)
!         subtitle = self.__escape_value(subtitle).strip(' \t-_')
!         description = self.__escape_value(description).strip(' \t-_')
!         episode = self.__escape_value(episode).strip(' \t-_')
  
          old_prog = None
***************
*** 204,228 ****
  
          query = 'select * from programs where channel_id="%s" ' % channel_id 
+\
!                 'and start=%s' % start
          rows = self.sql_execute(query)
!         if len(rows) > 1:
!             # With the current schema this should NOT be possible.  If we stay
!             # with it this may be removed.
!             #
!             # Bad. We should only have one program for each chanid:start
!             # Lets end this right here.
              for row in rows:
                  del_list.append(row.id)
              self.sql_remove_programs(del_list)
  
!         elif len(rows) == 1:
              old_prog = rows[0]
- 
-         else:
-             # we got no results
-             pass
- 
- 
-         if old_prog:
              if Unicode(old_prog['title']) == Unicode(title):
                  # program timeslot is unchanged, see if there's anything
--- 204,224 ----
  
          query = 'select * from programs where channel_id="%s" ' % channel_id 
+\
!                 '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:
+                 log.info('delete %s:' % row['title'])
                  del_list.append(row.id)
              self.sql_remove_programs(del_list)
  
!         query = 'select * from programs where channel_id="%s" ' % channel_id 
+\
!                 'and start=%s' % start
!         rows = self.sql_execute(query)
!         if len(rows) == 1:
              old_prog = rows[0]
              if Unicode(old_prog['title']) == Unicode(title):
                  # program timeslot is unchanged, see if there's anything
***************
*** 288,294 ****
              self.sql_execute(query)
              self.sql_commit()
!         except IntegrityError:
              log.error('Program for (%s, %s) exists:' % \
                        (String(channel_id), start))
              query = 'select * from programs where channel_id="%s" and 
start=%s'
              rows = self.sql_execute(query % (channel_id, start))
--- 284,291 ----
              self.sql_execute(query)
              self.sql_commit()
!         except Exception, e:
              log.error('Program for (%s, %s) exists:' % \
                        (String(channel_id), start))
+             log.exception('trace:')
              query = 'select * from programs where channel_id="%s" and 
start=%s'
              rows = self.sql_execute(query % (channel_id, start))
***************
*** 296,300 ****
              for row in rows:
                  log.error('    %s' % row)
-             log.exception('trace:')
  
  
--- 293,296 ----



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to