[Jahshaka-cvs] jah/jahtools/jbatch jbatch_tk.py,1.3,1.4
Status: Beta
Brought to you by:
jahshaka
From: Charles Y. <lil...@us...> - 2007-03-19 09:16:21
|
Update of /cvsroot/jahshaka/jah/jahtools/jbatch In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv31412 Modified Files: jbatch_tk.py Log Message: + Simple jcapture/dv integration Index: jbatch_tk.py =================================================================== RCS file: /cvsroot/jahshaka/jah/jahtools/jbatch/jbatch_tk.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- jbatch_tk.py 19 Mar 2007 08:15:57 -0000 1.3 +++ jbatch_tk.py 19 Mar 2007 09:16:15 -0000 1.4 @@ -14,6 +14,8 @@ import time import os import threading +import urlparse +import urllib def usage( ): print "jbatch_tk [ <media> ]*" @@ -36,6 +38,8 @@ self.request = 0 self.visualise = None self.visualise_force = 0 + self.jcapture_mode = False + self.jcapture_server = "" master.title( "jbatch" ) @@ -106,7 +110,14 @@ if self.request >= len( self.ops ): self.request = 0 if self.request < len( self.ops ): + self.jcapture_mode = self.ops[ self.request ].startswith( "http://" ) and self.ops[ self.request ].endswith( "/jah.dv" ) + if self.jcapture_mode: + self.jcapture_server = urlparse.urlsplit( self.ops[ self.request ] )[ 1 ] + self.speed = 1 + self.pause( ) self.rpn.push( self.ops[ self.request ] ) + if self.jcapture_mode: + self.rpn.push_args( [ "audio_index=-1" ] ) else: self.rpn.push_args( [ "test:" ] ) self.input = self.rpn.pop( ) @@ -120,10 +131,13 @@ self.rpn.push_input( self.visualise ) self.rpn.push_args( [ "colourspace=yuv420p", "width=320", "height=240", "force=%d" % self.visualise_force ] ) self.rpn.push_args( [ "filter:conform" ] ) + if self.jcapture_mode: self.rpn.push_args( [ "audio=0" ] ) + self.rpn.push( "filter:deinterlace" ) self.input = self.rpn.pop( ) self.b_scale.config( from_ = 0, to = self.input.get_frames( ) ) self.b_scale.set( 0 ) self.play( self.input ) + self.jcapture_mode = False else: self.list.delete( self.request ) self.ops.pop( self.request ) @@ -144,22 +158,38 @@ self.list.insert( Tkinter.END, name ) def rew( self, event ): - self.speed = -25 + if not self.jcapture_mode: + self.speed = -25 + else: + self.stream = urllib.urlopen( "http://" + self.jcapture_server + "/jah/rewind" ) + self.stream.read( ) def start( self, event = None ): - self.speed = 1 - self.v_pause.set( "||" ) + if not self.jcapture_mode: + self.speed = 1 + self.v_pause.set( "||" ) + else: + self.stream = urllib.urlopen( "http://" + self.jcapture_server + "/jah/play" ) + self.stream.read( ) def pause( self, event = None ): - if self.speed != 0: - self.speed = 0 - self.v_pause.set( ">" ) + if not self.jcapture_mode: + if self.speed != 0: + self.speed = 0 + self.v_pause.set( ">" ) + else: + self.speed = 1 + self.v_pause.set( "||" ) else: - self.speed = 1 - self.v_pause.set( "||" ) + self.stream = urllib.urlopen( "http://" + self.jcapture_server + "/jah/pause" ) + self.stream.read( ) def ffwd( self, event ): - self.speed = 25 + if not self.jcapture_mode: + self.speed = 25 + else: + self.stream = urllib.urlopen( "http://" + self.jcapture_server + "/jah/ff" ) + self.stream.read( ) def play( self, input ): frame = input.fetch( ) @@ -206,13 +236,13 @@ common.preview.video_store.properties( ).get_property( "box" ).set( self.box.get( ) ) def seek( self, event ): - if event.y > int( 0.9 * self.height ): + if not self.jcapture_mode and event.y > int( 0.9 * self.height ): position = ( float( event.x ) / float( self.width ) ) * float( self.input.get_frames( ) ) self.input.seek( int( position ), False ) self.start( ) def scrub( self, event ): - if self.b_scale_pressed: + if not self.jcapture_mode and self.b_scale_pressed: self.input.seek( int( event ), False ) self.start( ) |