def playback_episode( self, channel, episode): self.history_mark_played( episode.url) filename=episode.local_filename() if gpodder.interface == gpodder.MAEMO and not self.config.maemo_allow_custom_player: # Use the built-in Nokia Mediaplayer here filename=filename.encode('utf-8') osso_rpc=osso.Rpc(self.osso_c) service='com.nokia.mediaplayer' path='/com/nokia/mediaplayer' osso_rpc.rpc_run(service, path, service, 'mime_open', ('file://'+filename,)) return (True, service) # Determine the file type and set the player accordingly. file_type=util.file_type_by_extension(util.file_extension_from_url(episode.url)) if file_type == 'video': player=self.config.videoplayer elif file_type == 'audio': player=self.config.player else: log('Non-audio or video file type, using xdg-open for %s', filename, sender=self) player='xdg-open' command_line=shlex.split(util.format_desktop_command(player, filename).encode('utf-8')) log( 'Command line: [ %s ]', ', '.join( [ '"%s"' % p for p in command_line ]), sender=self) try: subprocess.Popen( command_line) except: return ( False, command_line[0] ) return ( True, command_line[0] )
def error_handler(filename, err): logger.error('Exception in D-Bus call: %s', str(err)) # Fallback: use the command line client for command in util.format_desktop_command('panucci', \ [filename]): logger.info('Executing: %s', repr(command)) subprocess.Popen(command)
self.show_message(message, title=_('Flattr status'), important=not success) groups[player].append(filename) # Open episodes with system default player if 'default' in groups: for filename in groups['default']: logger.debug('Opening with system default: %s', filename) util.gui_open(filename) del groups['default'] # For each type now, go and create play commands for group in groups: for command in util.format_desktop_command( group, groups[group], resume_position ): logger.debug('Executing: %s', repr(command)) subprocess.Popen(command) # Persist episode status changes to the database self.root.db.commit() # Flush updated episode status self.root.mygpo_client.flush() @Slot(str) def setEpisodeFilter(self, pattern): self.root.episodeProxyModel.setFilterFixedString(pattern)
def open_files(self, filenames): for cmd in util.format_desktop_command(self.command, filenames): subprocess.Popen(cmd)
def open_files(self, filenames): for cmd in util.format_desktop_command(self.command, filenames): util.Popen(cmd, close_fds=True)