platypush/plugins/media/omxplayer/__init__.py
def play(self, resource=None, subtitles=None, *args, **kwargs):
        """
        Play or resume playing a resource.

        :param resource: Resource to play. Supported types:

            * Local files (format: ``file://<path>/<file>``)
            * Remote videos (format: ``https://<url>/<resource>``)
            * YouTube videos (format: ``https://www.youtube.com/watch?v=<id>``)
            * Torrents (format: Magnet links, Torrent URLs or local Torrent files)

        :param subtitles: Subtitles file
        """
        if not resource:
            if not self._player:
                self.logger.warning('No OMXPlayer instances running')
            else:
                self._player.play()

            return self.status()
        else:
            self._play_started.clear()

        self._post_event(MediaPlayRequestEvent, resource=resource)

        if subtitles:
            args += ('--subtitles', subtitles)

        resource = self._get_resource(resource)
        if self._player:
            try:
                self._player.stop()
                self._player = None
            except Exception as e:
                self.logger.exception(e)
                self.logger.warning('Unable to stop a previously running instance ' +
                                    'of OMXPlayer, trying to play anyway')

        from dbus import DBusException

        try:
            from omxplayer import OMXPlayer
            self._player = OMXPlayer(resource, args=self.args)
        except DBusException as e:
            self.logger.warning('DBus connection failed: you will probably not ' +
                                'be able to control the media')
            self.logger.exception(e)

        self._post_event(MediaPlayEvent, resource=resource)
        self._init_player_handlers()
        if not self._play_started.wait(timeout=self.timeout):
            self.logger.warning(f'The player has not sent a play started event within {self.timeout}')
        return self.status()

        Play or resume playing a resource.

        :param resource: Resource to play. Supported types:

            * Local files (format: ``file://<path>/<file>``)
            * Remote videos (format: ``https://<url>/<resource>``)
            * YouTube videos (format: ``https://www.youtube.com/watch?v=<id>``)
            * Torrents (format: Magnet links, Torrent URLs or local Torrent files)

        :param subtitles: Subtitles file
        
Play or resume playing a resource.
Play or resume playing a resource .
def play(self, resource=None, subtitles=None, *args, **kwargs):
        if not resource:
            if not self._player:
                self.logger.warning('No OMXPlayer instances running')
            else:
                self._player.play()
            return self.status()
        else:
            self._play_started.clear()
        self._post_event(MediaPlayRequestEvent, resource=resource)
        if subtitles:
            args += ('--subtitles', subtitles)
        resource = self._get_resource(resource)
        if self._player:
            try:
                self._player.stop()
                self._player = None
            except Exception as e:
                self.logger.exception(e)
                self.logger.warning('Unable to stop a previously running instance ' +
                                    'of OMXPlayer, trying to play anyway')
        from dbus import DBusException
        try:
            from omxplayer import OMXPlayer
            self._player = OMXPlayer(resource, args=self.args)
        except DBusException as e:
            self.logger.warning('DBus connection failed: you will probably not ' +
                                'be able to control the media')
            self.logger.exception(e)
        self._post_event(MediaPlayEvent, resource=resource)
        self._init_player_handlers()
        if not self._play_started.wait(timeout=self.timeout):
            self.logger.warning(f'The player has not sent a play started event within {self.timeout}')
        return self.status()
def play ( self , resource = None , subtitles = None , * args , ** kwargs ) : if not resource : if not self . _player : self . logger . warning ( 'No OMXPlayer instances running' ) else : self . _player . play ( ) return self . status ( ) else : self . _play_started . clear ( ) self . _post_event ( MediaPlayRequestEvent , resource = resource ) if subtitles : args += ( '--subtitles' , subtitles ) resource = self . _get_resource ( resource ) if self . _player : try : self . _player . stop ( ) self . _player = None except Exception as e : self . logger . exception ( e ) self . logger . warning ( 'Unable to stop a previously running instance ' + 'of OMXPlayer, trying to play anyway' ) from dbus import DBusException try : from omxplayer import OMXPlayer self . _player = OMXPlayer ( resource , args = self . args ) except DBusException as e : self . logger . warning ( 'DBus connection failed: you will probably not ' + 'be able to control the media' ) self . logger . exception ( e ) self . _post_event ( MediaPlayEvent , resource = resource ) self . _init_player_handlers ( ) if not self . _play_started . wait ( timeout = self . timeout ) : self . logger . warning ( f'The player has not sent a play started event within {self.timeout}' ) return self . status ( )
Play or resume playing a resource.
Play or resume playing a resource .
"""
        Play or resume playing a resource.

        :param resource: Resource to play. Supported types:

            * Local files (format: ``file://<path>/<file>``)
            * Remote videos (format: ``https://<url>/<resource>``)
            * YouTube videos (format: ``https://www.youtube.com/watch?v=<id>``)
            * Torrents (format: Magnet links, Torrent URLs or local Torrent files)

        :param subtitles: Subtitles file
        """
self
resource
Resource to play.
Resource to play .
subtitles
None