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())
def openDroppedFiles(self, widget, context, x, y, selection_data, info, time): ## Opens a file after a drag and drop. # Split all the files that were input. uris = selection_data.data.strip().split() # Clear the current queue. queue.clear() # Add all the items to the queue. for uri in uris: path = urllib.url2pathname(urlparse.urlparse(uri)[2]) queue.append(path) # Play the first file by calling the next function. self.playNext(atf=False) # Finish the drag. context.finish(True, False, time)