コード例 #1
0
 def getDatapath(self):
     if self.getKodiVersion() > 18:
         return mvutils.py2_decode(
             xbmcvfs.translatePath(
                 self._addonClass.getAddonInfo('profile')))
     else:
         return mvutils.py2_decode(
             xbmc.translatePath(self._addonClass.getAddonInfo('profile')))
コード例 #2
0
 def load(self):
     """ Loads the settings of the addon """
     # pylint: disable=attribute-defined-outside-init
     addon = xbmcaddon.Addon()
     self.datapath = mvutils.py2_decode(
         xbmc.translatePath(
             addon.getAddonInfo('profile')))  ### TODO .decode('utf-8')
     self.firstrun = addon.getSetting('firstrun') == 'true'
     # general
     self.preferhd = addon.getSetting('quality') == 'true'
     self.autosub = addon.getSetting('autosub') == 'true'
     self.nofuture = addon.getSetting('nofuture') == 'true'
     self.minlength = int(float(addon.getSetting('minlength'))) * 60
     self.groupshows = addon.getSetting('groupshows') == 'true'
     self.maxresults = int(addon.getSetting('maxresults'))
     self.maxage = int(addon.getSetting('maxage')) * 86400
     self.recentmode = int(addon.getSetting('recentmode'))
     self.filmSortMethod = int(addon.getSetting('filmuisortmethod'))
     self.updateCheckInterval = int(addon.getSetting('updateCheckInterval'))
     # database
     self.type = int(addon.getSetting('dbtype'))
     self.host = addon.getSetting('dbhost')
     self.port = int(addon.getSetting('dbport'))
     self.user = addon.getSetting('dbuser')
     self.password = addon.getSetting('dbpass')
     self.database = addon.getSetting('dbdata')
     self.updnative = addon.getSetting('updnative') == 'true'
     self.updmode = int(addon.getSetting('updmode'))
     self.caching = addon.getSetting('caching') == 'true'
     self.updinterval = int(float(addon.getSetting('updinterval'))) * 3600
     # download
     self.downloadpathep = mvutils.py2_decode(
         addon.getSetting('downloadpathep'))
     #TODO self.downloadpathep = unicode(self.downloadpathep, 'utf-8')
     self.downloadpathmv = mvutils.py2_decode(
         addon.getSetting('downloadpathmv'))
     #TODO self.downloadpathmv = unicode(self.downloadpathmv, 'utf-8')
     self.moviefolders = addon.getSetting('moviefolders') == 'true'
     self.movienamewithshow = addon.getSetting(
         'movienamewithshow') == 'true'
     self.reviewname = addon.getSetting('reviewname') == 'true'
     self.downloadsrt = addon.getSetting('downloadsrt') == 'true'
     self.makenfo = int(addon.getSetting('makenfo'))
     ##
     self.contentType = ''
     if addon.getSetting('contentType') == '1':
         self.contentType = 'videos'
     elif addon.getSetting('contentType') == '2':
         self.contentType = 'movies'
     elif addon.getSetting('contentType') == '3':
         self.contentType = 'episodes'
     elif addon.getSetting('contentType') == '4':
         self.contentType = 'tvshows'
     # update stuff from 0.4.3
     if not self.downloadpathep:
         self.downloadpathep = addon.getSetting('downloadpath')
         if self.downloadpathep:
             addon.setSetting('downloadpathep', self.downloadpathep)
コード例 #3
0
 def __init__(self):
     self.addon = xbmcaddon.Addon()
     self.addon_id = self.addon.getAddonInfo('id')
     self.icon = self.addon.getAddonInfo('icon')
     self.fanart = self.addon.getAddonInfo('fanart')
     self.version = self.addon.getAddonInfo('version')
     self.path = mvutils.py2_decode(self.addon.getAddonInfo('path')) ##TODO self.unicodePath = unicode(self.path, 'utf-8')
     self.datapath = mvutils.py2_decode(xbmc.translatePath(self.addon.getAddonInfo('profile'))) ### TODO.decode('utf-8')
     self.language = self.addon.getLocalizedString
     KodiLogger.__init__(self, self.addon_id, self.version)
コード例 #4
0
 def __init__(self):
     self.addon = xbmcaddon.Addon()
     self.addon_id = self.addon.getAddonInfo('id')
     self.icon = self.addon.getAddonInfo('icon')
     self.fanart = self.addon.getAddonInfo('fanart')
     self.version = self.addon.getAddonInfo('version')
     self.path = mvutils.py2_decode(self.addon.getAddonInfo('path'))
     ##
     if self.getKodiVersion() > 18:
         self.datapath = mvutils.py2_decode(xbmcvfs.translatePath(self.addon.getAddonInfo('profile')))
     else:
         self.datapath = mvutils.py2_decode(xbmc.translatePath(self.addon.getAddonInfo('profile')))
     ##
     self.language = self.addon.getLocalizedString
     KodiLogger.__init__(self, self.addon_id, self.version)
コード例 #5
0
 def __init__(self):
     self.addon = appContext.ADDONCLASS
     self.addon_id = self.addon.getAddonInfo('id')
     self.icon = self.addon.getAddonInfo('icon')
     self.fanart = self.addon.getAddonInfo('fanart')
     self.version = self.addon.getAddonInfo('version')
     self.path = mvutils.py2_decode(self.addon.getAddonInfo('path'))
     #
     if self.getKodiVersion() > 18:
         self.datapath = mvutils.py2_decode(xbmcvfs.translatePath(self.addon.getAddonInfo('profile')))
     else:
         self.datapath = mvutils.py2_decode(xbmc.translatePath(self.addon.getAddonInfo('profile')))
     #
     self.language = self.addon.getLocalizedString
     self.kodiVersion = -1
コード例 #6
0
    def get_entered_text(self, deftext=None, heading=None, hidden=False):
        """
        Asks the user to enter a text. The method returnes a tuple with
        the text and the confirmation status: `( "Entered Text", True, )`

        Args:
            deftext(str|int, optional): Default text in the text entry box.
                Can be a string or a numerical id to a localized text. This
                text will be returned if the user selects `Cancel`

            heading(str|int, optional): Heading text of the text entry UI.
                Can be a string or a numerical id to a localized text.

            hidden(bool, optional): If `True` the entered text is not
                desplayed. Placeholders are used for every char. Default
                is `False`
        """
        heading = self.language(heading) if isinstance(
            heading, int) else heading if heading is not None else ''
        deftext = self.language(deftext) if isinstance(
            deftext, int) else deftext if deftext is not None else ''
        keyboard = xbmc.Keyboard(deftext, heading, 1 if hidden else 0)
        keyboard.doModal()
        if keyboard.isConfirmed():
            enteredText = keyboard.getText()
            enteredText = mvutils.py2_decode(enteredText)
            return (
                enteredText,
                True,
            )
        return (
            deftext,
            False,
        )
コード例 #7
0
    def get_setting(self, setting_id):
        """
        Read a setting value

        Args:
            setting_id(int): id number of the setting
        """
        argument = self.addon.getSetting(setting_id)
        argument = mvutils.py2_decode(argument)
        return argument
コード例 #8
0
    def get_addon_info(self, info_id):
        """
        Returns the value of an addon property as a string.

        Args:
            info_id(str): id of the property that the module needs to access.
        """
        argument = self.addon.getAddonInfo(info_id)
        argument = mvutils.py2_decode(argument)
        return argument
コード例 #9
0
    def get_arg(self, argname, default):
        """
        Get one specific parameter passed to the plugin

        Args:
            argname(str): the name of the parameter

            default(str): the value to return if no such
                parameter was specified
        """
        try:
            argument = self.args[argname][0]
            argument = mvutils.py2_decode(argument)
            return argument
        except TypeError:
            return default
        except KeyError:
            return default
コード例 #10
0
 def getDownloadPathMovie(self):
     return mvutils.py2_decode(self._addonClass.getSetting('downloadpathmv'))
コード例 #11
0
 def getDownloadPathEpisode(self):
     return mvutils.py2_decode(self._addonClass.getSetting('downloadpathep'))