Changeset - 539de47b68cc
[Not reviewed]
default
0 2 0
Drew Perttula - 14 years ago 2011-06-20 20:18:34
drewp@bigasterisk.com
asco: fix the EOS catcher instead of the broken duration-.2 hack
Ignore-this: 76db6d1c0eea79e6db88f95984059105
2 files changed with 16 insertions and 8 deletions:
0 comments (0 inline, 0 general)
bin/ascoltami2
Show inline comments
 
@@ -33,6 +33,8 @@ class App:
 
        self.player.pause()
 
        self.player.seek(0)
 

	
 
        # stop here for now- no go-button behavior
 
        return
 
        try:
 
            nextSong = self.playlist.nextSong(song)
 
        except NoSuchSong: # we're at the end of the playlist
light9/ascoltami/player.py
Show inline comments
 
@@ -32,10 +32,14 @@ class Player(object):
 
        bus.add_signal_watch()
 

	
 
        def on_any(bus, msg):
 
            print bus, msg
 
        #bus.connect('message', on_any)
 
            print bus, msg, msg.type
 
            if msg.type == gst.MESSAGE_EOS:
 
                if self.onEOS is not None:
 
                    self.onEOS(self.getSong())
 
        bus.connect('message', on_any)
 

	
 
        def onStreamStatus(bus, message):
 
            print "streamstatus", bus, message
 
            (statusType, _elem) = message.parse_stream_status()
 
            if statusType == gst.STREAM_STATUS_TYPE_ENTER:
 
                self.setupAutostop()
 
@@ -52,12 +56,14 @@ class Player(object):
 
            if self.lastWatchTime < self.autoStopTime < t:
 
                log.info("autostop")
 
                self.pause()
 
            if not self.onEOS:
 
                if self.isPlaying() and t >= self.duration() - .2:
 
                    # i don't expect to hit dur exactly with this
 
                    # polling. What would be better would be to watch for
 
                    # the EOS signal and react to that
 
                    self.onEOS(self.getSong())
 

	
 
                # new EOS logic above should be better
 
            ## if not self.onEOS:
 
            ##     if self.isPlaying() and t >= self.duration() - .2:
 
            ##         # i don't expect to hit dur exactly with this
 
            ##         # polling. What would be better would be to watch for
 
            ##         # the EOS signal and react to that
 
            ##         self.onEOS(self.getSong())
 

	
 
            self.lastWatchTime = t
 
        except:
0 comments (0 inline, 0 general)