Пример #1
0
def prompt_for_link(old_link='', old_name=''):
    if old_link.endswith('\n'):
        old_link = old_link[:-1]
    if old_name.endswith('\n'):
        old_name = old_name[:-1]
    new_link = kodi.get_keyboard('Edit Link', old_link)
    if new_link is None:
        return

    new_name = kodi.get_keyboard('Enter Name', old_name)
    if new_name is None:
        return

    if new_name:
        return (new_link, new_name)
    else:
        return (new_link, )
Пример #2
0
def create_dir(path, dir_name=None):
    if dir_name is None:
        dir_name = kodi.get_keyboard('Enter Directory Name')
        if dir_name is None:
            return

    try:
        os.mkdir(os.path.join(path, dir_name))
    except OSError as e:
        kodi.notify(msg=e.strerror)
    kodi.refresh_container()
Пример #3
0
def rename_dir(path, dir_name, new_name=None):
    if new_name is None:
        new_name = kodi.get_keyboard('Enter Directory Name', dir_name)
        if new_name is None:
            return

    old_path = os.path.join(path, dir_name)
    new_path = os.path.join(path, new_name)
    try:
        os.rename(old_path, new_path)
    except OSError as e:
        kodi.notify(msg=e.strerror)
    kodi.refresh_container()