Пример #1
0
    def __init__(self, name, plugin_id, filepath=None, debug=False):
        '''Initialize a plugin object for an XBMC addon.'''
        self._name = name
        self._filepath = filepath
        self._plugin_id = plugin_id

        # Keeps track of url routes
        self._routes = []
        self._view_functions = {}

        args = self.parse_commandline(sys.argv)

        self._plugin = xbmcaddon.Addon(id=self._plugin_id)
        if self._mode in debug_modes:
            self._plugin._setup(os.path.dirname(self._filepath))

        self._argv0, self._argv1, self._argv2 = args
        self.handle = int(self._argv1)

        self.qs_args = parse_qs(self._argv2.lstrip('?'))

        self.scheme, self.netloc, self.path = urlparse(self._argv0)

        self._cache_path = xbmc.translatePath(
            'special://profile/addon_data/%s/.cache' % self._plugin_id)
Пример #2
0
    def _fake_run(self, url):
        '''Manually sets some vars on the current instance. Used instead of
        calling __init__ on an instance.'''
        # Manually forge some properties since we aren't reinitializing our plugin.
        # no partition in python 2.4
        #self._argv0, _, self._argv2 = url.partition('?')
        parts = url.split('?', 1)
        self._argv0 = parts[0]
        if len(parts) == 2:
            self._argv2 = parts[1]
        else:
            self._argv2 = ''

        self.qs_args = parse_qs(self._argv2.lstrip('?'))
        self.scheme, self.netloc, self.path = urlparse(self._argv0)

        # Now run the actual selection's view
        return self.dispatch(self.path)
Пример #3
0
    def _fake_run(self, url):
        '''Manually sets some vars on the current instance. Used instead of
        calling __init__ on an instance.'''
        # Manually forge some properties since we aren't reinitializing our plugin.
        # no partition in python 2.4
        #self._argv0, _, self._argv2 = url.partition('?')
        parts = url.split('?', 1)
        self._argv0 = parts[0]
        if len(parts) == 2:
            self._argv2 = parts[1]
        else:
            self._argv2 = ''

        self.qs_args = parse_qs(self._argv2.lstrip('?'))
        self.scheme, self.netloc, self.path = urlparse(self._argv0)

        # Now run the actual selection's view
        return self.dispatch(self.path)
Пример #4
0
    def __init__(self, name, plugin_id, filepath=None, debug=False):
        '''Initialize a plugin object for an XBMC addon.'''
        self._name = name
        self._filepath = filepath
        self._plugin_id = plugin_id

        # Keeps track of url routes
        self._routes = []
        self._view_functions = {}

        args = self.parse_commandline(sys.argv)

        self._plugin = xbmcaddon.Addon(id=self._plugin_id)
        if self._mode in debug_modes:
            self._plugin._setup(os.path.dirname(self._filepath))

        self._argv0, self._argv1, self._argv2 = args
        self.handle = int(self._argv1)

        self.qs_args = parse_qs(self._argv2.lstrip('?'))

        self.scheme, self.netloc, self.path = urlparse(self._argv0)

        self._cache_path = xbmc.translatePath('special://profile/addon_data/%s/.cache' % self._plugin_id)