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


Python ADDON.getAddonInfo方法代码示例

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


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

示例1: get_pulsar_binary

# 需要导入模块: from pulsar.addon import ADDON [as 别名]
# 或者: from pulsar.addon.ADDON import getAddonInfo [as 别名]
def get_pulsar_binary():
    binary = "pulsar" + (PLATFORM["os"] == "windows" and ".exe" or "")

    platform = PLATFORM.copy()
    if platform["os"] == "darwin": # 64 bits anyway on Darwin
        platform["arch"] = "x64"
    elif platform["os"] == "windows": # 32 bits anyway on Windows
        platform["arch"] = "x86"

    binary_dir = os.path.join(ADDON.getAddonInfo("path"), "resources", "bin", "%(os)s_%(arch)s" % platform)
    if platform["os"] == "android":
        app_id = android_get_current_appid()
        xbmc_data_path = os.path.join("/data", "data", app_id)
        if os.path.exists(xbmc_data_path) and uid == os.stat(xbmc_data_path).st_uid:
            binary_dir = os.path.join(xbmc_data_path, "files", ADDON_ID)
    else:
        dest_binary_dir = os.path.join(xbmc.translatePath(ADDON.getAddonInfo("profile")), "bin", "%(os)s_%(arch)s" % platform)

    binary_path = os.path.join(binary_dir, binary)
    dest_binary_path = os.path.join(dest_binary_dir, binary)

    # Testing for size to see if update is needed. This is a poor test indeed, but it's sufficient.
    if not os.path.exists(dest_binary_path) or os.path.getsize(dest_binary_path) != os.path.getsize(binary_path):
        log.info("pulsar daemon is outdated, updating...")
        import shutil
        try:
            os.makedirs(dest_binary_dir)
        except OSError:
            pass
        shutil.rmtree(dest_binary_dir)
        shutil.copytree(binary_dir, dest_binary_dir)

    return dest_binary_dir, ensure_exec_perms(dest_binary_path)
开发者ID:hungrybeetle,项目名称:plugin.video.pulsar,代码行数:35,代码来源:daemon.py

示例2: get_pulsar_binary

# 需要导入模块: from pulsar.addon import ADDON [as 别名]
# 或者: from pulsar.addon.ADDON import getAddonInfo [as 别名]
def get_pulsar_binary():
    binary = "pulsar" + (PLATFORM["os"] == "windows" and ".exe" or "")

    platform = PLATFORM.copy()
    if platform["os"] == "darwin": # 64 bits anyway on Darwin
        platform["arch"] = "x64"
    elif platform["os"] == "windows": # 32 bits anyway on Windows
        platform["arch"] = "x86"

    binary_dir = os.path.join(ADDON.getAddonInfo("path"), "resources", "bin", "%(os)s_%(arch)s" % platform)
    if platform["os"] == "android":
        app_id = android_get_current_appid()
        xbmc_data_path = os.path.join("/data", "data", app_id)
        dest_binary_dir = os.path.join(xbmc_data_path, "files", ADDON_ID, "bin", "%(os)s_%(arch)s" % platform)
    else:
        dest_binary_dir = os.path.join(xbmc.translatePath(ADDON.getAddonInfo("profile")), "bin", "%(os)s_%(arch)s" % platform)

    binary_path = os.path.join(binary_dir, binary)
    dest_binary_path = os.path.join(dest_binary_dir, binary)

    if not os.path.exists(dest_binary_path) or get_pulsard_checksum(dest_binary_path) != get_pulsard_checksum(binary_path):
        log.info("Updating pulsar daemon...")
        import shutil
        try:
            os.makedirs(dest_binary_dir)
        except OSError:
            pass
        try:
            shutil.rmtree(dest_binary_dir)
        except:
            pass
        shutil.copytree(binary_dir, dest_binary_dir)

    return dest_binary_dir, ensure_exec_perms(dest_binary_path)
开发者ID:FREEZX,项目名称:plugin.video.pulsar,代码行数:36,代码来源:daemon.py

示例3: get_pulsar_binary

# 需要导入模块: from pulsar.addon import ADDON [as 别名]
# 或者: from pulsar.addon.ADDON import getAddonInfo [as 别名]
def get_pulsar_binary():
    binary = "pulsar" + (PLATFORM["os"] == "windows" and ".exe" or "")

    platform = PLATFORM.copy()
    if platform["os"] == "darwin": # 64 bits anyway on Darwin
        platform["arch"] = "x64"
    elif platform["os"] == "windows": # 32 bits anyway on Windows
        platform["arch"] = "x86"

    binary_dir = os.path.join(ADDON.getAddonInfo("path"), "resources", "bin", "%(os)s_%(arch)s" % platform)
    if platform["os"] == "android":
        binary_dir = binary_dir.replace("/storage/emulated/0", "/storage/emulated/legacy")
        app_id = android_get_current_appid()
        xbmc_data_path = os.path.join("/data", "data", app_id)
        dest_binary_dir = os.path.join(xbmc_data_path, "files", ADDON_ID, "bin", "%(os)s_%(arch)s" % platform)
    else:
        dest_binary_dir = os.path.join(xbmc.translatePath(ADDON.getAddonInfo("profile")), "bin", "%(os)s_%(arch)s" % platform)

    try:
        binary_dir = binary_dir.decode("latin1")
        dest_binary_dir = dest_binary_dir.decode("latin1")
    except UnicodeEncodeError:
        log.info("Unable to decode: binary_dir=%s dest_binary_dir=%s" % (repr(binary_dir), repr(dest_binary_dir)))

    binary_path = os.path.join(binary_dir, binary)
    dest_binary_path = os.path.join(dest_binary_dir, binary)

    if not os.path.exists(dest_binary_path) or get_pulsard_checksum(dest_binary_path) != get_pulsard_checksum(binary_path):
        log.info("Updating pulsar daemon...")
        try:
            os.makedirs(dest_binary_dir)
        except OSError:
            pass
        try:
            shutil.rmtree(dest_binary_dir)
        except:
            pass
        shutil.copytree(binary_dir, dest_binary_dir)

    # Clean stale files in the directory, as this can cause headaches on
    # Android when they are unreachable
    dest_files = set(os.listdir(dest_binary_dir))
    orig_files = set(os.listdir(binary_dir))
    log.info("Deleting stale files %s" % (dest_files - orig_files))
    for file_ in (dest_files - orig_files):
        path = os.path.join(dest_binary_dir, file_)
        if os.path.isdir(path):
            shutil.rmtree(path)
        else:
            os.remove(path)

    return dest_binary_dir, ensure_exec_perms(dest_binary_path)
开发者ID:JacobZy,项目名称:plugin.video.pulsar,代码行数:54,代码来源:daemon.py

示例4: GetAddonInfo

# 需要导入模块: from pulsar.addon import ADDON [as 别名]
# 或者: from pulsar.addon.ADDON import getAddonInfo [as 别名]
 def GetAddonInfo(self):
     info = {}
     for key in ("author", "changelog", "description", "disclaimer",
                 "fanart", "icon", "id", "name", "path", "profile", "stars",
                 "summary", "type", "version"):
         info[key] = ADDON.getAddonInfo(key)
     return info
开发者ID:assli100,项目名称:kodi-openelec,代码行数:9,代码来源:rpc.py

示例5: run

# 需要导入模块: from pulsar.addon import ADDON [as 别名]
# 或者: from pulsar.addon.ADDON import getAddonInfo [as 别名]
def run(url_suffix=""):
    if not os.path.exists(os.path.join(xbmc.translatePath(ADDON.getAddonInfo("path")), ".firstrun")):
        notify(ADDON.getLocalizedString(30101).encode('utf-8'))
        return

    socket.setdefaulttimeout(300)
    urllib2.install_opener(urllib2.build_opener(NoRedirectHandler()))

    url = sys.argv[0].replace("plugin://%s" % ADDON_ID, PULSARD_HOST + url_suffix) + sys.argv[2]
    xbmc.log(url)

    try:
        data = _json(url)
    except:
        return

    if not data:
        return

    if data["content_type"]:
        xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_UNSORTED)
        xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
        xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_DATE)
        xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_GENRE)
        xbmcplugin.setContent(HANDLE, data["content_type"])

    listitems = range(len(data["items"]))
    for i, item in enumerate(data["items"]):
        # Translate labels
        if item["label"][0:8] == "LOCALIZE":
            item["label"] = GetLocalizedString(item["label"])
        if item["label2"][0:8] == "LOCALIZE":
            item["label2"] = GetLocalizedString(item["label2"])

        listItem = xbmcgui.ListItem(label=item["label"], label2=item["label2"], iconImage=item["icon"], thumbnailImage=item["thumbnail"])
        if item.get("info"):
            listItem.setInfo("video", item["info"])
        if item.get("stream_info"):
            for type_, values in item["stream_info"].items():
                listItem.addStreamInfo(type_, values)
        if item.get("art"):
            listItem.setArt(item["art"])
        if item.get("context_menu"):
            # Translate context menus
            print "Before: %s" % item["context_menu"]
            for m, menu in enumerate(item["context_menu"]):
                if menu[0][0:8] == "LOCALIZE":
                    menu[0] = GetLocalizedString(menu[0])
            print "After: %s" % item["context_menu"]
            listItem.addContextMenuItems(item["context_menu"])
        listItem.setProperty("isPlayable", item["is_playable"] and "true" or "false")
        if item.get("properties"):
            for k, v in item["properties"].items():
                listItem.setProperty(k, v)
        listitems[i] = (item["path"], listItem, not item["is_playable"])

    xbmcplugin.addDirectoryItems(HANDLE, listitems, totalItems=len(listitems))
    xbmcplugin.endOfDirectory(HANDLE, succeeded=True, updateListing=False, cacheToDisc=True)
开发者ID:Stevie-Bs,项目名称:repository.xvbmc,代码行数:60,代码来源:navigation.py

示例6: run

# 需要导入模块: from pulsar.addon import ADDON [as 别名]
# 或者: from pulsar.addon.ADDON import getAddonInfo [as 别名]
def run(url_suffix=""):
    if ("%(os)s_%(arch)s" % PLATFORM) not in [
        "windows_x86",
        "darwin_x64",
        "linux_x86", "linux_x64", "linux_arm",
    ]:
        from pulsar.util import notify
        notify("Pulsar is compatible only with Windows, Linux and OS X")
        return
    if not os.path.exists(os.path.join(xbmc.translatePath(ADDON.getAddonInfo("path")), ".firstrun")):
        from pulsar.util import notify
        notify("You must restart XBMC before using Pulsar")
        return
    if PLATFORM["os"] not in ["windows", "linux", "darwin"]:
        from pulsar.util import notify
        notify("Pulsar is compatible only with Windows, Linux and OS X")
        return

    socket.setdefaulttimeout(300)
    urllib2.install_opener(urllib2.build_opener(NoRedirectHandler()))

    url = sys.argv[0].replace("plugin://%s" % ADDON_ID, PULSARD_HOST + url_suffix) + sys.argv[2]
    xbmc.log(url)
    data = _json(url)
    if not data:
        return

    if data["content_type"]:
        xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_UNSORTED)
        xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
        xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_DATE)
        xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_GENRE)
        xbmcplugin.setContent(HANDLE, data["content_type"])

    listitems = range(len(data["items"]))
    for i, item in enumerate(data["items"]):
        listItem = xbmcgui.ListItem(label=item["label"], label2=item["label2"], iconImage=item["icon"], thumbnailImage=item["thumbnail"])
        if item.get("info"):
            listItem.setInfo("video", item["info"])
        if item.get("stream_info"):
            for type_, values in item["stream_info"].items():
                listItem.addStreamInfo(type_, values)
        if item.get("art"):
            listItem.setArt(item["art"])
        if item.get("context_menu"):
            listItem.addContextMenuItems(item["context_menu"])
        listItem.setProperty("isPlayable", item["is_playable"] and "true" or "false")
        if item.get("properties"):
            for k, v in item["properties"].items():
                listItem.setProperty(k, v)
        listitems[i] = (item["path"], listItem, not item["is_playable"])

    xbmcplugin.addDirectoryItems(HANDLE, listitems, totalItems=len(listitems))
    xbmcplugin.endOfDirectory(HANDLE, succeeded=True, updateListing=False, cacheToDisc=True)
开发者ID:FREEZX,项目名称:plugin.video.pulsar,代码行数:56,代码来源:navigation.py

示例7: run

# 需要导入模块: from pulsar.addon import ADDON [as 别名]
# 或者: from pulsar.addon.ADDON import getAddonInfo [as 别名]
def run(url_suffix=""):
    if not os.path.exists(os.path.join(xbmc.translatePath(ADDON.getAddonInfo("path")), ".firstrun")):
        notify(ADDON.getLocalizedString(30101).encode('utf-8'))
        return

    socket.setdefaulttimeout(300)
    urllib2.install_opener(urllib2.build_opener(NoRedirectHandler()))

    url = sys.argv[0].replace("plugin://%s" % ADDON_ID, PULSARD_HOST + url_suffix) + sys.argv[2]
    xbmc.log(url)
    try: 
        data = _json(url)
    except urllib2.HTTPError, e:
        return
开发者ID:assli100,项目名称:kodi-openelec,代码行数:16,代码来源:navigation.py

示例8: notify

# 需要导入模块: from pulsar.addon import ADDON [as 别名]
# 或者: from pulsar.addon.ADDON import getAddonInfo [as 别名]
def notify(message='', header=None, time=5000, image=''):
    if header is None:
        header = ADDON.getAddonInfo("name")
    xbmc.executebuiltin('Notification("%s", "%s", "%d", "%s")' %
                        (header, message, time, image))
开发者ID:hdcasey,项目名称:plugin.video.pulsar,代码行数:7,代码来源:util.py


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