示例#1
0
def AddPathRequestHandler(prefix,
                          handler,
                          name,
                          thumb="icon-default.png",
                          art="art-default.png"):
    global __requestHandlers
    PMS.Log(
        "(Framework) NOTICE: Path request handlers are deprecated and will be removed in the next major framework revision."
    )
    if prefix[-1] == "/":
        prefix = prefix[:-1]
    if not __requestHandlers.has_key(prefix):
        handler_info = {
            "handler": handler,
            "name": name,
            "thumb": thumb,
            "art": art
        }
        __requestHandlers[prefix] = handler_info
        PMS.Log("(Framework) Added a path request handler for prefix '%s'" %
                prefix)
    else:
        PMS.Log(
            "(Framework) Couldn't add a path request handler for prefix '%s' - prefix already exists"
            % prefix)
    if not __objectManager.FunctionIsParent("Start"):
        PMS.Log(
            "(Framework) WARNING: Plugin.AddPathRequestHandler() should only be called within the Start() method."
        )
示例#2
0
def AddPrefixHandler(prefix,
                     handler,
                     name,
                     thumb="icon-default.png",
                     art="art-default.png"):
    global __prefixHandlers
    if prefix[-1] == "/":
        prefix = prefix[:-1]
    if not __prefixHandlers.has_key(prefix):
        handler_info = {
            "handler": handler,
            "name": name,
            "thumb": thumb,
            "art": art
        }
        __prefixHandlers[prefix] = handler_info
        PMS.Log("(Framework) Added a handler for prefix '%s'" % prefix)
    else:
        PMS.Log(
            "(Framework) Couldn't add a handler for prefix '%s' - prefix already exists"
            % prefix)
    if not __objectManager.FunctionIsParent("Start",
                                            "pms_fwk_handler_wrapper"):
        PMS.Log(
            "(Framework) WARNING: Plugin.AddPrefixHandler() should only be called from within Start() method."
        )
示例#3
0
def AddViewGroup(name, viewMode="List", mediaType="items"):
    global __viewGroups
    if viewMode in ViewModes.keys():
        __viewGroups[name] = {
            "ViewMode": str(ViewModes[viewMode]),
            "MediaType": mediaType
        }
        PMS.Log("(Framework) Added a view group named '%s'" % name)
    else:
        PMS.Log(
            "(Framework) Couldn't create the view group '%s' - invalid view mode."
            % name)
    if not __objectManager.FunctionIsParent("Start"):
        PMS.Log(
            "(Framework) WARNING: Plugin.AddViewGroup() should only be called within the Start() method."
        )
示例#4
0
def Add(id, type, default, label, **kwargs):
    global __prefs
    for pref in __prefs:
        if pref.has_key("id"):
            if pref["id"] == id:
                return

    # Convert boolean prefs to strings
    if lower(type) == "bool":
        if default == True:
            default = "true"
        else:
            default = "false"

    pref = {"id": id, "type": type, "default": default, "label": label}
    for kw in kwargs:
        pref[kw] = kwargs[kw]
    pref["value"] = default
    __prefs.append(pref)
    PMS.Log("(Framework) Added new preference '%s'" % id)
    if not __objectManager.FunctionIsParent("CreatePrefs"):
        PMS.Log(
            "(Framework) WARNING: Prefs.Add() should only be called within the CreatePrefs() method."
        )