Exemplo n.º 1
0
def add_group(target, group_name=""):
    dialog = xbmcgui.Dialog()
    group_name = dialog.input(heading=utils.get_string(30023),
                              defaultt=group_name)
    group_id = ""

    if group_name:
        group_id = utils.get_unique_id(group_name)
        filename = os.path.join(_addon_data, "{}.group".format(group_id))
        group_def = {
            "label": group_name,
            "type": target,
            "paths": [],
            "id": group_id,
            "art": folder_sync if target == "widget" else folder_shortcut,
            "version": settings.get_addon_info("version"),
            "content": None,
        }

        utils.write_json(filename, group_def)
    else:
        dialog.notification("AutoWidget", utils.get_string(30024))

    del dialog
    return group_id
Exemplo n.º 2
0
def _add_path(group_def, labels, over=False):
    if not over:
        if group_def['type'] == 'shortcut':
            heading = utils.get_string(32043)
        elif group_def['type'] == 'widget':
            heading = utils.get_string(32044)
        
        labels['label'] = dialog.input(heading=heading, defaultt=labels['label'])
                                                 
    labels['id'] = utils.get_unique_id(labels['label'])
    labels['version'] = utils._addon_version
    
    manage.write_path(group_def, path_def=labels)
Exemplo n.º 3
0
def _add_path(group_def, labels, over=False):
    if not over:
        if group_def["type"] == "shortcut":
            heading = utils.get_string(32043)
        elif group_def["type"] == "widget":
            heading = utils.get_string(32044)

        labels["label"] = dialog.input(heading=heading,
                                       defaultt=labels["label"])

    labels["id"] = utils.get_unique_id(labels["label"])
    labels["version"] = utils._addon_version

    if labels["target"] == "settings":
        labels["file"]["filetype"] = "file"
        labels["file"]["file"] = labels["file"]["file"].split("&")[0]

    manage.write_path(group_def, path_def=labels)
Exemplo n.º 4
0
def add_group(target, group_name=''):
    group_name = dialog.input(heading=utils.get_string(32037),
                              defaultt=group_name)
    group_id = ''
    
    if group_name:
        group_id = utils.get_unique_id(group_name)
        filename = os.path.join(utils._addon_path, '{}.group'.format(group_id))
        group_def = {'label': group_name,
                     'type': target,
                     'paths': [],
                     'id': group_id,
                     'art': folder_sync if target == 'widget' else folder_shortcut,
                     'version': utils._addon_version}
    
        utils.write_json(filename, group_def)
    else:
        dialog.notification('AutoWidget', utils.get_string(32038))
    
    return group_id
Exemplo n.º 5
0
def _add_path(group_def, labels, over=False):
    if not over:
        if group_def["type"] == "shortcut":
            heading = utils.get_string(30028)
        elif group_def["type"] == "widget":
            heading = utils.get_string(30029)

        dialog = xbmcgui.Dialog()
        labels["label"] = dialog.input(heading=heading, defaultt=labels["label"])
        del dialog

    labels["id"] = utils.get_unique_id(labels["label"])
    labels["version"] = settings.get_addon_info("version")

    if labels["target"] == "settings":
        labels["file"]["filetype"] = "file"
        labels["file"]["file"] = labels["file"]["file"].split("&")[0]
    elif labels["target"] == "shortcut" and labels["file"]["filetype"] == "file":
        labels["content"] = None

    manage.write_path(group_def, path_def=labels)
Exemplo n.º 6
0
def add_group(target, group_name=""):
    group_name = dialog.input(heading=utils.get_string(32037),
                              defaultt=group_name)
    group_id = ""

    if group_name:
        group_id = utils.get_unique_id(group_name)
        filename = os.path.join(utils._addon_path, "{}.group".format(group_id))
        group_def = {
            "label": group_name,
            "type": target,
            "paths": [],
            "id": group_id,
            "art": folder_sync if target == "widget" else folder_shortcut,
            "version": utils._addon_version,
        }

        utils.write_json(filename, group_def)
    else:
        dialog.notification("AutoWidget", utils.get_string(32038))

    return group_id
Exemplo n.º 7
0
def add_group(target):
    dialog = xbmcgui.Dialog()
    group_name = dialog.input(heading=utils.get_string(32037))
    group_id = ''

    if group_name:
        group_id = utils.get_unique_id(group_name)
        filename = os.path.join(_addon_path, '{}.group'.format(group_id))
        group_def = {
            'label': group_name,
            'type': target,
            'paths': [],
            'id': group_id,
            'info': {},
            'art': folder_sync if target == 'widget' else folder_shortcut,
            'version': _addon_version
        }

        utils.write_json(filename, group_def)
        utils.update_container()
    else:
        dialog.notification('AutoWidget', utils.get_string(32038))

    return group_id