当前位置: 首页>>代码示例>>Python>>正文


Python xbmcaddon.Addon方法代码示例

本文整理汇总了Python中xbmcaddon.Addon方法的典型用法代码示例。如果您正苦于以下问题:Python xbmcaddon.Addon方法的具体用法?Python xbmcaddon.Addon怎么用?Python xbmcaddon.Addon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xbmcaddon的用法示例。


在下文中一共展示了xbmcaddon.Addon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _install_inputstream

# 需要导入模块: import xbmcaddon [as 别名]
# 或者: from xbmcaddon import Addon [as 别名]
def _install_inputstream(self):
        """Install inputstream addon."""
        from xbmc import executebuiltin
        from xbmcaddon import Addon
        try:
            # See if there's an installed repo that has it
            executebuiltin('InstallAddon({})'.format(self.inputstream_addon), wait=True)

            # Check if InputStream add-on exists!
            Addon('{}'.format(self.inputstream_addon))

            log(0, 'InputStream add-on installed from repo.')
            return True
        except RuntimeError:
            log(3, 'InputStream add-on not installed.')
            return False 
开发者ID:emilsvennesson,项目名称:script.module.inputstreamhelper,代码行数:18,代码来源:__init__.py

示例2: settings

# 需要导入模块: import xbmcaddon [as 别名]
# 或者: from xbmcaddon import Addon [as 别名]
def settings(setting, value=None):

    ''' Get or add add-on settings.
        getSetting returns unicode object.
    '''
    addon = xbmcaddon.Addon(addon_id())

    if value is not None:
        if setting.endswith('.bool'):

            setting = setting.replace('.bool', "")
            value = "true" if value else "false"

        addon.setSetting(setting, value)
    else:
        result = addon.getSetting(setting.replace('.bool', ""))

        if result and setting.endswith('.bool'):
            result = result in ("true", "1")

        return result 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:23,代码来源:utils.py

示例3: _add_editcontrol

# 需要导入模块: import xbmcaddon [as 别名]
# 或者: from xbmcaddon import Addon [as 别名]
def _add_editcontrol(self, x, y, height, width, password=0):

        media = os.path.join(xbmcaddon.Addon(addon_id()).getAddonInfo('path'), 'resources', 'skins', 'default', 'media')
        control = xbmcgui.ControlEdit(0, 0, 0, 0,
                                      label="User",
                                      font="font13",
                                      textColor="FF52b54b",
                                      disabledColor="FF888888",
                                      focusTexture="-",
                                      noFocusTexture="-",
                                      isPassword=password)
        control.setPosition(x, y)
        control.setHeight(height)
        control.setWidth(width)

        self.addControl(control)

        return control 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:20,代码来源:loginmanual.py

示例4: _add_editcontrol

# 需要导入模块: import xbmcaddon [as 别名]
# 或者: from xbmcaddon import Addon [as 别名]
def _add_editcontrol(self, x, y, height, width, password=0):

        media = os.path.join(xbmcaddon.Addon(addon_id()).getAddonInfo('path'), 'resources', 'skins', 'default', 'media')
        control = xbmcgui.ControlEdit(0, 0, 0, 0,
                                      label="User",
                                      font="font13",
                                      textColor="FF52b54b",
                                      disabledColor="FF888888",
                                      focusTexture="-",
                                      noFocusTexture="-",
                                      isPassword=password)
        control.setPosition(x, y)
        control.setHeight(height)
        control.setWidth(width)

        self.addControl(control)
        return control 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:19,代码来源:loginconnect.py

示例5: _add_editcontrol

# 需要导入模块: import xbmcaddon [as 别名]
# 或者: from xbmcaddon import Addon [as 别名]
def _add_editcontrol(self, x, y, height, width):

        media = os.path.join(xbmcaddon.Addon(addon_id()).getAddonInfo('path'), 'resources', 'skins', 'default', 'media')
        control = xbmcgui.ControlEdit(0, 0, 0, 0,
                                      label="User",
                                      font="font13",
                                      textColor="FF52b54b",
                                      disabledColor="FF888888",
                                      focusTexture="-",
                                      noFocusTexture="-")
        control.setPosition(x, y)
        control.setHeight(height)
        control.setWidth(width)

        self.addControl(control)
        return control 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:18,代码来源:servermanual.py

示例6: action_menu

# 需要导入模块: import xbmcaddon [as 别名]
# 或者: from xbmcaddon import Addon [as 别名]
def action_menu(self):

        selected = self._selected_option.decode('utf-8')

        if selected == OPTIONS['Refresh']:
            self.server['api'].refresh_item(self.item['Id'])

        elif selected == OPTIONS['AddFav']:
            self.server['api'].favorite(self.item['Id'], True)

        elif selected == OPTIONS['RemoveFav']:
            self.server['api'].favorite(self.item['Id'], False)

        elif selected == OPTIONS['Addon']:
            xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')

        elif selected == OPTIONS['Delete']:
            self.delete_item() 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:20,代码来源:context.py

示例7: deleteDB

# 需要导入模块: import xbmcaddon [as 别名]
# 或者: from xbmcaddon import Addon [as 别名]
def deleteDB():
    try:
        xbmc.log("[script.tvguide.fullscreen] Deleting database...", xbmc.LOGDEBUG)
        dbPath = xbmc.translatePath(xbmcaddon.Addon(id = 'script.tvguide.fullscreen').getAddonInfo('profile'))
        dbPath = os.path.join(dbPath, 'source.db')

        delete_file(dbPath)

        passed = not os.path.exists(dbPath)

        if passed:
            xbmc.log("[script.tvguide.fullscreen] Deleting database...PASSED", xbmc.LOGDEBUG)
        else:
            xbmc.log("[script.tvguide.fullscreen] Deleting database...FAILED", xbmc.LOGDEBUG)

        return passed

    except Exception, e:
        xbmc.log('[script.tvguide.fullscreen] Deleting database...EXCEPTION', xbmc.LOGDEBUG)
        return False 
开发者ID:primaeval,项目名称:script.tvguide.fullscreen,代码行数:22,代码来源:ResetDatabase.py

示例8: __init__

# 需要导入模块: import xbmcaddon [as 别名]
# 或者: from xbmcaddon import Addon [as 别名]
def __init__(self):
        # Class initialisation.  Fails with a RuntimeError exception if VPN Manager add-on is not available, or too old
        self.filtered_addons = []
        self.filtered_windows = []
        self.primary_vpns = []
        self.last_updated = 0
        self.refreshLists()
        self.default = self.getConnected()
        xbmc.log("VPN Mgr API : Default is " + self.default, level=xbmc.LOGDEBUG)
        self.timeout = 30
        if not xbmc.getCondVisibility("System.HasAddon(service.vpn.manager)"):
            xbmc.log("VPN Mgr API : VPN Manager is not installed, cannot use filtering", level=xbmc.LOGERROR)
            raise RuntimeError("VPN Manager is not installed")
        else:
            v = int((xbmcaddon.Addon("service.vpn.manager").getAddonInfo("version").strip()).replace(".",""))
            if v < 310:
                raise RuntimeError("VPN Manager " + str(v) + " installed, but needs to be v3.1.0 or later") 
开发者ID:primaeval,项目名称:script.tvguide.fullscreen,代码行数:19,代码来源:vpnapi.py

示例9: openSettings

# 需要导入模块: import xbmcaddon [as 别名]
# 或者: from xbmcaddon import Addon [as 别名]
def openSettings(query=None, id=addonInfo('id')):
    idle()
    execute('Addon.OpenSettings({0})'.format(id))

    if query is not None:

        try:

            c, f = query.split('.')
            if float(addon('xbmc.addon').getAddonInfo('version')[:4]) > 17.6:
                execute('SetFocus(-{0})'.format(100 - int(c)))
                if int(f):
                    execute('SetFocus(-{0})'.format(80 - int(f)))
            else:
                execute('SetFocus({0})'.format(100 + int(c)))
                if int(f):
                    execute('SetFocus({0})'.format(200 + int(f)))

        except Exception:
            pass


# Alternative method 
开发者ID:bugatsinho,项目名称:bugatsinho.github.io,代码行数:25,代码来源:control.py

示例10: openSettings

# 需要导入模块: import xbmcaddon [as 别名]
# 或者: from xbmcaddon import Addon [as 别名]
def openSettings(query=None, id=addonInfo('id')):

    try:

        idle()
        execute('Addon.OpenSettings({0})'.format(id))
        if query is None:
            raise Exception()
        c, f = query.split('.')
        execute('SetFocus(%i)' % (int(c) + 100))
        execute('SetFocus(%i)' % (int(f) + 200))

    except:

        return


# Alternative method 
开发者ID:bugatsinho,项目名称:bugatsinho.github.io,代码行数:20,代码来源:control.py

示例11: clear

# 需要导入模块: import xbmcaddon [as 别名]
# 或者: from xbmcaddon import Addon [as 别名]
def clear(table=None):
    try:
        execute('Dialog.Close(busydialog)')

        if table == None: table = ['rel_list', 'rel_lib']
        elif not type(table) == list: table = [table]

        yes = dialog.yesno(heading=xbmcaddon.Addon().getAddonInfo('name'), line1=xbmcaddon.Addon().getLocalizedString(30401).encode('utf-8'))
        if not yes: return

        dbcon = database.connect(os.path.join(dataPath, 'cache.db'))
        dbcur = dbcon.cursor()

        for t in table:
            try:
                dbcur.execute("DROP TABLE IF EXISTS %s" % t)
                dbcur.execute("VACUUM")
                dbcon.commit()
            except:
                pass

        dialog.notification(heading=xbmcaddon.Addon().getAddonInfo('name'), message=xbmcaddon.Addon().getLocalizedString(30402).encode('utf-8'), time=2000, sound=False)
    except:
        pass 
开发者ID:bugatsinho,项目名称:bugatsinho.github.io,代码行数:26,代码来源:cache.py

示例12: openSettings

# 需要导入模块: import xbmcaddon [as 别名]
# 或者: from xbmcaddon import Addon [as 别名]
def openSettings(query=None, id=addonInfo('id')):

    try:

        idle()
        execute('Addon.OpenSettings({0})'.format(id))
        if query is None:
            raise Exception()
        c, f = query.split('.')
        execute('SetFocus(%i)' % (int(c) + 100))
        execute('SetFocus(%i)' % (int(f) + 200))

    except BaseException:

        return


# Alternative method 
开发者ID:bugatsinho,项目名称:bugatsinho.github.io,代码行数:20,代码来源:control.py

示例13: _set_isa_addon_settings

# 需要导入模块: import xbmcaddon [as 别名]
# 或者: from xbmcaddon import Addon [as 别名]
def _set_isa_addon_settings(is_4k_capable, hdcp_override):
    """Method for self-configuring of InputStream Adaptive add-on"""
    try:
        is_helper = inputstreamhelper.Helper('mpd')
        if not is_helper.check_inputstream():
            show_ok_dialog(get_local_string(30154), get_local_string(30046))
            return
    except Exception as exc:  # pylint: disable=broad-except
        # Captures all types of ISH internal errors
        import traceback
        error(g.py2_decode(traceback.format_exc(), 'latin-1'))
        raise InputStreamHelperError(str(exc))

    isa_addon = Addon('inputstream.adaptive')
    isa_addon.setSettingBool('HDCPOVERRIDE', hdcp_override)
    if isa_addon.getSettingInt('STREAMSELECTION') == 1:
        # Stream selection must never be set to 'Manual' or cause problems with the streams
        isa_addon.setSettingInt('STREAMSELECTION', 0)
    # 'Ignore display' should only be set when Kodi display resolution is not 4K
    isa_addon.setSettingBool('IGNOREDISPLAY', is_4k_capable and (getScreenWidth() != 3840 or getScreenHeight() != 2160)) 
开发者ID:CastagnaIT,项目名称:plugin.video.netflix,代码行数:22,代码来源:config_wizard.py

示例14: copySystemdFiles

# 需要导入模块: import xbmcaddon [as 别名]
# 或者: from xbmcaddon import Addon [as 别名]
def copySystemdFiles():
    # Delete any existing openvpn.service and copy openvpn service file to config directory
    service_source = getAddonPath(True, "openvpn.service")
    service_dest = getSystemdPath("system.d/openvpn.service")
    debugTrace("Copying openvpn.service " + service_source + " to " + service_dest)
    if not fakeSystemd():
        if xbmcvfs.exists(service_dest): xbmcvfs.delete(service_dest)
        xbmcvfs.copy(service_source, service_dest)
        if not xbmcvfs.exists(service_dest): raise IOError('Failed to copy service ' + service_source + " to " + service_dest)
    
    # Delete any existing openvpn.config and copy first VPN to openvpn.config
    config_source = sudo_setting = xbmcaddon.Addon(getID()).getSetting("1_vpn_validated")
    if service_source == "": errorTrace("vpnplatform.py", "Nothing has been validated")
    config_dest = getSystemdPath("openvpn.config")
    debugTrace("Copying openvpn.config " + config_source + " to " + config_dest)
    if not fakeSystemd():
        if xbmcvfs.exists(config_dest): xbmcvfs.delete(config_dest)
        xbmcvfs.copy(config_source, config_dest)
        if not xbmcvfs.exists(config_dest): raise IOError('Failed to copy service ovpn ' + config_source + " to " + config_dest) 
开发者ID:Zomboided,项目名称:service.vpn.manager,代码行数:21,代码来源:vpnplatform.py

示例15: checkVPNInstall

# 需要导入模块: import xbmcaddon [as 别名]
# 或者: from xbmcaddon import Addon [as 别名]
def checkVPNInstall(addon):
    # Check that openvpn plugin exists (this was an issue with OE6), there's
    # another check below that validates that the command actually works
    if not fakeConnection():
        p = getPlatform()
        dialog_msg = ""
        if p == platforms.RPI:
            command_path = getAddonPath(False, "network.openvpn/bin/openvpn")
            if xbmcvfs.exists(command_path):
                # Check the version that's installed
                vpn_addon = xbmcaddon.Addon("network.openvpn")
                version =  vpn_addon.getAddonInfo("version")
                version = version.replace(".", "")
                if int(version) >= 600: return True
            dialog_msg = "OpenVPN executable not available.  Install the openvpn plugin, version 6.0.1 or greater from the OpenELEC unofficial repo."
            # Display error message
            xbmcgui.Dialog().ok(addon.getAddonInfo("name"), dialog_msg)
    return True 
开发者ID:Zomboided,项目名称:service.vpn.manager,代码行数:20,代码来源:vpnplatform.py


注:本文中的xbmcaddon.Addon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。