def playFile(self, file, stop=True): ## Plays the file 'file' (Could also be a URI). # Stop the player if requested. (Required for playbin2 and # changing streams midway through another). if stop: player.stop() if (file == None): # If no file is to be played, set the URI to None, and the file to "" file = "" # Set the now playing label to the file to be played. self.nowPlyLbl.set_label(os.path.basename(urllib.url2pathname(file))) if (os.path.exists(file) or '://' in file): # If it's not already a uri, make it one. # Also escape any # characters in the filename file = useful.filenameToUri(file).replace('#', '%23') # Set the URI to the file's one. player.setURI(file) # Try to set the subtitle track if requested. if cfg.getBool('video/autosub'): subtitles.trySubs(file) # Add the file to recently opened files. gtk.recent_manager_get_default().add_item(file) # Start the player, if it isn't already running. if (not player.isPlaying()): player.play() elif (file != ""): # If none of the above, a bad filename was passed. print _("Something's stuffed up, no such file: %s") % (file) self.playFile(None)
def secondTimer(self): # A function that's called once a second while playing. if (not self.seeking): self.progressUpdate() #TODO: fonts with subtitles. #print player.player.emit('get-text-pad', 0).get_property('active-pad') #.set_property('font-desc', 'Sans 30') # Causes it to go again if it's playing, but stop if it's not. return player.isPlaying()
def minuteTimer(self): ## A timer that runs every minute while playing. # Disable ScreenSaver (if option is enabled). if (cfg.getBool("misc/disablescreensaver") and player.player.get_property('n-video') > 0): # Inhibit hte screensaver, technically we only have to do this once. ## FIXME: Only do this once useful.suspendScr() return player.isPlaying()