Update of /cvsroot/freevo/freevo/src/helpers
In directory sc8-pr-cvs1:/tmp/cvs-serv10871/src/helpers

Modified Files:
        recordserver.py 
Log Message:
Adding support for the padding of recordings with X minutes before and
after the show.  Thanks to Eirik Meland for the initial patch.


Index: recordserver.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/helpers/recordserver.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** recordserver.py     20 Oct 2003 01:41:55 -0000      1.17
--- recordserver.py     24 Nov 2003 01:59:59 -0000      1.18
***************
*** 7,10 ****
--- 7,14 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.18  2003/11/24 01:59:59  rshortt
+ # Adding support for the padding of recordings with X minutes before and
+ # after the show.  Thanks to Eirik Meland for the initial patch.
+ #
  # Revision 1.17  2003/10/20 01:41:55  rshortt
  # Moving tv_util from src/tv/ to src/util/.
***************
*** 231,235 ****
              recording = FALSE
  
!         if prog.start <= now and prog.stop >= now and recording:
              plugin.getbyname('RECORD').Stop()
         
--- 235,240 ----
              recording = FALSE
  
!         # if prog.start <= now and prog.stop >= now and recording:
!         if recording:
              plugin.getbyname('RECORD').Stop()
         
***************
*** 316,322 ****
          rec_prog = None
          cleaned = None
!         scheduledRecordings = self.getScheduledRecordings()
  
!         progs = scheduledRecordings.getProgramList()
  
          now = time.time()
--- 321,339 ----
          rec_prog = None
          cleaned = None
!         delay_recording = FALSE
!         total_padding = 0
  
!         sr = self.getScheduledRecordings()
!         progs = sr.getProgramList()
! 
!         currently_recording = None
!         for prog in progs.values():
!             try:
!                 recording = prog.isRecording
!             except:
!                 recording = FALSE
! 
!             if recording:
!                 currently_recording = prog
  
          now = time.time()
***************
*** 329,353 ****
                  recording = FALSE
  
!             if prog.start <= now and prog.stop >= now and recording == FALSE:
                  # just add to the 'we want to record this' list
                  # then end the loop, and figure out which has priority,
                  # remember to take into account the full length of the shows
                  # and how much they overlap, or chop one short
-                 # yeah thats a good idea but make sure its not like 5 mins
  
!                 duration = int(prog.stop - now - 10)
                  if duration < 10:
                      return FALSE
  
!                 if DEBUG: log.debug('going to record: %s' % prog)
!                 prog.isRecording = TRUE
!                 prog.rec_duration = duration
!                 prog.filename = tv_util.getProgFilename(prog)
!                 rec_prog = prog
  
  
          for prog in progs.values():
              # If the program is over remove the entry.
!             if prog.stop < now:
                  if DEBUG: log.debug('found a program to clean')
                  cleaned = TRUE
--- 346,405 ----
                  recording = FALSE
  
!             if (prog.start - config.RECORD_PADDING) <= now \
!                    and (prog.stop + config.RECORD_PADDING) >= now \
!                    and recording == FALSE:
                  # just add to the 'we want to record this' list
                  # then end the loop, and figure out which has priority,
                  # remember to take into account the full length of the shows
                  # and how much they overlap, or chop one short
  
!                 duration = int((prog.stop + config.RECORD_PADDING ) - now - 10)
                  if duration < 10:
                      return FALSE
  
!                 if currently_recording:
!                     # Hey, something is already recording!
!                     if prog.start - 10 <= now:
!                         # our new recording should start no later than now!
!                         sr.removeProgram(currently_recording, 
!                                          tv_util.getKey(currently_recording))
!                         plugin.getbyname('RECORD').Stop()
!                         time.sleep(5)
!                         log.debug('CALLED RECORD STOP 1')
!                     else:
!                         # at this moment we must be in the pre-record padding
!                         if currently_recording.stop - 10 <= now:
!                             # The only reason we are still recording is because of
!                             # the post-record padding.
!                             # Therefore we have overlapping paddings but not
!                             # real stop / start times.
!                             overlap = (currently_recording.stop + \
!                                        config.RECORD_PADDING) - \
!                                       (prog.start - config.RECORD_PADDING)
!                             if overlap <= (config.RECORD_PADDING/2):
!                                 sr.removeProgram(currently_recording, 
!                                                  tv_util.getKey(currently_recording))
!                                 plugin.getbyname('RECORD').Stop()
!                                 time.sleep(5)
!                                 log.debug('CALLED RECORD STOP 2')
!                             else: 
!                                 delay_recording = TRUE
!                         else: 
!                             delay_recording = TRUE
!                              
!                         
!                 if delay_recording:
!                     if DEBUG: log.debug('delaying: %s' % prog)
!                 else:
!                     if DEBUG: log.debug('going to record: %s' % prog)
!                     prog.isRecording = TRUE
!                     prog.rec_duration = duration
!                     prog.filename = tv_util.getProgFilename(prog)
!                     rec_prog = prog
  
  
          for prog in progs.values():
              # If the program is over remove the entry.
!             if ( prog.stop + config.RECORD_PADDING) < now:
                  if DEBUG: log.debug('found a program to clean')
                  cleaned = TRUE
***************
*** 355,360 ****
  
          if rec_prog or cleaned:
!             scheduledRecordings.setProgramList(progs)
!             self.saveScheduledRecordings(scheduledRecordings)
              return rec_prog
  
--- 407,412 ----
  
          if rec_prog or cleaned:
!             sr.setProgramList(progs)
!             self.saveScheduledRecordings(sr)
              return rec_prog
  




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to