Beispiel #1
0
	def onPlayerMessage(self, bus, message):
		t = message.type
		if (t == gst.MESSAGE_EOS):
			if (self.wTree.get_object("mnuiRepeatOne").get_active()):
				player.seek(0)
			else:
				if (self.wTree.get_object("mnuiRepeatAll").get_active()):
					queue.append(player.uri)
				# At the end of a stream, play next item from queue.
				# Or stop if the queue is empty.
				if (queue.length() > 0):
					self.playNext(atf=False)
				elif (self.wTree.get_object("mnuiQuitOnStop").get_active()):
					# Quit of the 'quit on stop' option is enabled.
					self.quit()
				else:
					# Otherwise, just stop.
					player.stop()
		
		elif (t == gst.MESSAGE_ERROR):
			# On an error, empty the currently playing file (also stops it).
			self.playFile(None)
			# Show an error about the failure.
			msg = message.parse_error()
			signals.emit('error', str(msg[0]) + '\n\n' + str(msg[1]), _('Error!'))
		elif (t == gst.MESSAGE_STATE_CHANGED and message.src == player.player):
			self.onPlayerStateChange(message)
		elif (t == gst.MESSAGE_TAG):
			# Tags!!
			self.setPlayingTitle(message.parse_tag())
Beispiel #2
0
	def restartTrack(self, widget=None):
		## Restarts the currently playing track.
		# Just seek to 0.
		player.seek(0)
		# Update the progrss bar.
		gobject.idle_add(self.progressUpdate)
		# Make sure the player is playing (ie. if it was paused etc)
		player.play()
Beispiel #3
0
	def buttonToggled(self, widget, track):
		## When a button is toggled.
		if (player.getAudioTrack() != track):
			# If the current track differs to the selected one.
			# Get the current time, change the track, seek to 0 to activate
			# the new track, then seek back to the original position.
			# (Just changing the track didn't work)
			t = player.getPlayed()
			player.setAudioTrack(track)
			player.seek(0)
			player.seek(t)