Update of /cvsroot/freevo/freevo/src/tv/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29208/src/tv/plugins

Modified Files:
        generic_record.py ivtv_record.py 
Log Message:
Add RECORD_START/STOP events along with VCR_PRE/POST_REC commands.


Index: ivtv_record.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/tv/plugins/ivtv_record.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** ivtv_record.py      7 Jun 2004 16:46:00 -0000       1.22
--- ivtv_record.py      10 Jun 2004 02:32:17 -0000      1.23
***************
*** 11,14 ****
--- 11,17 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.23  2004/06/10 02:32:17  rshortt
+ # Add RECORD_START/STOP events along with VCR_PRE/POST_REC commands.
+ #
  # Revision 1.22  2004/06/07 16:46:00  rshortt
  # Didn't mean to add partial support for multiple recording plugins yet.
***************
*** 92,95 ****
--- 95,101 ----
  import childapp 
  import plugin 
+ import rc
+ 
+ from event import Event
  
  from tv.channels import FreevoChannels
***************
*** 123,128 ****
  
      def Record(self, rec_prog):
- 
-         self.thread.save_flag.wait()
          self.thread.mode = 'record'
          self.thread.prog = rec_prog
--- 129,132 ----
***************
*** 131,135 ****
          if DEBUG: print('Recorder::Record: %s' % rec_prog)
          
-         
      def Stop(self):
          self.thread.mode = 'stop'
--- 135,138 ----
***************
*** 145,153 ****
          self.mode = 'idle'
          self.mode_flag = threading.Event()
!         self.save_flag = threading.Event()
!         self.save_flag.set()
!         self.prog  = ''
          self.app = None
  
      def run(self):
          while 1:
--- 148,155 ----
          self.mode = 'idle'
          self.mode_flag = threading.Event()
!         self.prog = None
          self.app = None
  
+ 
      def run(self):
          while 1:
***************
*** 158,161 ****
--- 160,169 ----
                  
              elif self.mode == 'record':
+                 self.prog.filename = '%s/%s.mpeg' % \
+                                             (config.TV_RECORD_DIR, 
+                                              string.replace(self.prog.filename,
+                                                             ' ', '_'))
+ 
+                 rc.post_event(Event('RECORD_START', arg=self.prog))
                  if DEBUG: print 'Record_Thread::run: started recording'
  
***************
*** 163,173 ****
                  if DEBUG: print 'CHAN: %s' % fc.getChannel()
  
-                 tv_lock_file = config.FREEVO_CACHEDIR + '/record'
-                 open(tv_lock_file, 'w').close()
- 
-                 video_save_file = '%s/%s.mpeg' % (config.TV_RECORD_DIR, 
-                                              string.replace(self.prog.filename,
-                                                             ' ', '_'))
-                 
                  (v_norm, v_input, v_clist, v_dev) = config.TV_SETTINGS.split()
  
--- 171,174 ----
***************
*** 191,195 ****
  
                  v_in  = open(v_dev, 'r')
!                 v_out = open(video_save_file, 'w')
  
                  while time.time() < stop:
--- 192,196 ----
  
                  v_in  = open(v_dev, 'r')
!                 v_out = open(self.prog.filename, 'w')
  
                  while time.time() < stop:
***************
*** 199,203 ****
                          break
  
-                 self.save_flag.clear()
                  v_in.close()
                  v_out.close()
--- 200,203 ----
***************
*** 205,217 ****
                  v = None
  
!                 os.remove(tv_lock_file)
  
                  if DEBUG: print('Record_Thread::run: finished recording')
  
-                 self.mode = 'idle'
-                 self.save_flag.set()
-                 from  util.videothumb import snapshot
-                 snapshot(video_save_file)
              else:
                  self.mode = 'idle'
              time.sleep(0.5)
--- 205,215 ----
                  v = None
  
!                 self.mode = 'idle'
  
+                 rc.post_event(Event('RECORD_STOP', arg=self.prog))
                  if DEBUG: print('Record_Thread::run: finished recording')
  
              else:
                  self.mode = 'idle'
+ 
              time.sleep(0.5)

Index: generic_record.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/tv/plugins/generic_record.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** generic_record.py   7 Jun 2004 16:45:54 -0000       1.18
--- generic_record.py   10 Jun 2004 02:32:17 -0000      1.19
***************
*** 11,14 ****
--- 11,17 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.19  2004/06/10 02:32:17  rshortt
+ # Add RECORD_START/STOP events along with VCR_PRE/POST_REC commands.
+ #
  # Revision 1.18  2004/06/07 16:45:54  rshortt
  # Didn't mean to add partial support for multiple recording plugins yet.
***************
*** 119,126 ****
          frequency = self.fc.chanSet(str(rec_prog.tunerid), 'record plugin')
  
          cl_options = { 'channel'  : rec_prog.tunerid,
                         'frequency' : frequency,
!                        'filename' : config.TV_RECORD_DIR + '/' + rec_prog.filename,
!                        'base_filename' : rec_prog.filename,
                         'title' : rec_prog.title,
                         'sub-title' : rec_prog.sub_title,
--- 122,131 ----
          frequency = self.fc.chanSet(str(rec_prog.tunerid), 'record plugin')
  
+         rec_prog.filename = config.TV_RECORD_DIR + '/' + rec_prog.filename
+ 
          cl_options = { 'channel'  : rec_prog.tunerid,
                         'frequency' : frequency,
!                        'filename' : rec_prog.filename,
!                        'base_filename' : os.path.basename(rec_prog.filename),
                         'title' : rec_prog.title,
                         'sub-title' : rec_prog.sub_title,
***************
*** 130,133 ****
--- 135,139 ----
  
          self.thread.mode = 'record'
+         self.thread.prog = rec_prog
          self.thread.command = self.rec_command
          self.thread.mode_flag.set()
***************
*** 179,182 ****
--- 185,189 ----
          self.mode_flag = threading.Event()
          self.command  = ''
+         self.prog = None
          self.app = None
  
***************
*** 189,208 ****
                  
              elif self.mode == 'record':
                  if DEBUG: print('Record_Thread::run: cmd=%s' % self.command)
  
-                 tv_lock_file = config.FREEVO_CACHEDIR + '/record'
-                 open(tv_lock_file, 'w').close()
-               
-               # should prolly be replaced with new pre recording command
-               # The FreeBSD bsdbt848 driver does not support the adevice
-               # setting, so we must switch the mixer to the correct record
-               # source before starting mencoder. I'm not sure how to do
-               # this with Python, so just call the mixer command directly.
-                 if os.uname()[0] == 'FreeBSD':
-                     os.system('mixer =rec line rec 100 > /dev/null 2>&1')
- 
-                 if hasattr(config, "VCR_PRE_REC") and config.VCR_PRE_REC:
-                   os.system(config.VCR_PRE_REC)
- 
                  self.app = RecordApp(self.command)
                  
--- 196,202 ----
                  
              elif self.mode == 'record':
+                 rc.post_event(Event('RECORD_START', arg=self.prog))
                  if DEBUG: print('Record_Thread::run: cmd=%s' % self.command)
  
                  self.app = RecordApp(self.command)
                  
***************
*** 213,234 ****
  
                  rc.post_event(Event(OS_EVENT_KILL, (self.app.child.pid, 15)))
- 
                  self.app.kill()
  
-                 if hasattr(config, "VCR_POST_REC") and config.VCR_POST_REC:
-                   os.system(config.VCR_POST_REC)
- 
-                 os.remove(tv_lock_file)
- 
-                 # XXX Move this into recordserver after
-                 # XXX Rob puts the event support in.
-                 #
-                 # Can't test this, someone with generic record please
-                 # try it
-                 #
-                 # from  util.videothumb import snapshot
-                 # snapshot(rec_prog.filename)
- 
                  self.mode = 'idle'
                  
              else:
--- 207,216 ----
  
                  rc.post_event(Event(OS_EVENT_KILL, (self.app.child.pid, 15)))
                  self.app.kill()
  
                  self.mode = 'idle'
+ 
+                 rc.post_event(Event('RECORD_STOP', arg=self.prog))
+                 if DEBUG: print('Record_Thread::run: finished recording')
                  
              else:



-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite!  GUADEC: The world's #1 Open Source Desktop Event.
GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to