Example #1
0
def MetadataMenu(
    rating_key, title=None, base_title=None, display_items=False, previous_item_type=None, previous_rating_key=None
):
    title = unicode(title)
    item_title = title
    title = base_title + " > " + title
    oc = ObjectContainer(title2=title, no_cache=True, no_history=True)

    if display_items:
        items = getAllItems(key="children", value=rating_key, base="library/metadata")
        kind, deeper = get_items_info(items)
        # we don't know exactly where we are here, only add ignore option to series
        if should_display_ignore(items, previous=previous_item_type):
            add_ignore_options(oc, "series", title=item_title, rating_key=rating_key, callback_menu=IgnoreMenu)
        dig_tree(
            oc,
            items,
            MetadataMenu,
            pass_kwargs={
                "base_title": title,
                "display_items": deeper,
                "previous_item_type": kind,
                "previous_rating_key": rating_key,
            },
        )
    else:
        return RefreshItemMenu(rating_key=rating_key, title=title, item_title=item_title)

    return oc
Example #2
0
def FirstLetterMetadataMenu(
    rating_key, key, title=None, base_title=None, display_items=False, previous_item_type=None, previous_rating_key=None
):
    """

    :param rating_key: actually is the section's key
    :param key: the firstLetter wanted
    :param title: the first letter, or #
    :param deeper:
    :return:
    """
    title = base_title + " > " + unicode(title)
    oc = ObjectContainer(title2=title, no_cache=True, no_history=True)

    items = getAllItems(key="first_character", value=[rating_key, key], base="library/sections", flat=False)
    kind, deeper = get_items_info(items)
    dig_tree(
        oc,
        items,
        MetadataMenu,
        pass_kwargs={
            "base_title": title,
            "display_items": deeper,
            "previous_item_type": kind,
            "previous_rating_key": rating_key,
        },
    )
    return oc
Example #3
0
def SectionsMenu():
    items = getAllItems("sections")

    return dig_tree(
        ObjectContainer(title2="Sections", no_cache=True, no_history=True),
        items,
        None,
        menu_determination_callback=determine_section_display,
        pass_kwargs={"base_title": "Sections"},
        fill_args={"title": "section_title"},
    )
Example #4
0
def SectionMenu(rating_key, title=None, base_title=None, section_title=None, ignore_options=True):
    items = getAllItems(key="all", value=rating_key, base="library/sections")

    kind, deeper = get_items_info(items)

    section_title = title
    title = base_title + " > " + title
    oc = ObjectContainer(title2=title, no_cache=True, no_history=True)
    if ignore_options:
        add_ignore_options(oc, "sections", title=section_title, rating_key=rating_key, callback_menu=IgnoreMenu)

    return dig_tree(oc, items, MetadataMenu,
                    pass_kwargs={"base_title": title, "display_items": deeper, "previous_item_type": "section",
                                 "previous_rating_key": rating_key})
Example #5
0
def SectionMenu(rating_key, title=None, base_title=None, section_title=None, ignore_options=True):
    items = getAllItems(key="all", value=rating_key, base="library/sections")

    kind, deeper = get_items_info(items)
    title = unicode(title)

    section_title = title
    title = base_title + " > " + title
    oc = ObjectContainer(title2=title, no_cache=True, no_history=True)
    if ignore_options:
        add_ignore_options(oc, "sections", title=section_title, rating_key=rating_key, callback_menu=IgnoreMenu)

    return dig_tree(oc, items, MetadataMenu,
                    pass_kwargs={"base_title": title, "display_items": deeper, "previous_item_type": "section",
                                 "previous_rating_key": rating_key})
Example #6
0
def SectionFirstLetterMenu(rating_key, title=None, base_title=None, section_title=None):
    items = getAllItems(key="first_character", value=rating_key, base="library/sections")

    kind, deeper = get_items_info(items)

    title = unicode(title)
    oc = ObjectContainer(title2=section_title, no_cache=True, no_history=True)
    title = base_title + " > " + title
    add_ignore_options(oc, "sections", title=section_title, rating_key=rating_key, callback_menu=IgnoreMenu)

    oc.add(DirectoryObject(
        key=Callback(SectionMenu, title="All", base_title=title, rating_key=rating_key, ignore_options=False),
        title="All"
    )
    )
    return dig_tree(oc, items, FirstLetterMetadataMenu, force_rating_key=rating_key, fill_args={"key": "key"},
                    pass_kwargs={"base_title": title, "display_items": deeper, "previous_rating_key": rating_key})
Example #7
0
def SectionFirstLetterMenu(rating_key, title=None, base_title=None, section_title=None):
    items = getAllItems(key="first_character", value=rating_key, base="library/sections")

    kind, deeper = get_items_info(items)

    title = unicode(title)
    oc = ObjectContainer(title2=section_title, no_cache=True, no_history=True)
    title = base_title + " > " + title
    add_ignore_options(oc, "sections", title=section_title, rating_key=rating_key, callback_menu=IgnoreMenu)

    oc.add(DirectoryObject(
        key=Callback(SectionMenu, title="All", base_title=title, rating_key=rating_key, ignore_options=False),
        title="All"
    )
    )
    return dig_tree(oc, items, FirstLetterMetadataMenu, force_rating_key=rating_key, fill_args={"key": "key"},
                    pass_kwargs={"base_title": title, "display_items": deeper, "previous_rating_key": rating_key})
Example #8
0
def MetadataMenu(rating_key, title=None, base_title=None, display_items=False, previous_item_type=None, previous_rating_key=None):
    title = unicode(title)
    item_title = title
    title = base_title + " > " + title
    oc = ObjectContainer(title2=title, no_cache=True, no_history=True)

    if display_items:
        items = getAllItems(key="children", value=rating_key, base="library/metadata")
        kind, deeper = get_items_info(items)
        # we don't know exactly where we are here, only add ignore option to series
        if should_display_ignore(items, previous=previous_item_type):
            add_ignore_options(oc, "series", title=item_title, rating_key=rating_key, callback_menu=IgnoreMenu)
        dig_tree(oc, items, MetadataMenu,
                 pass_kwargs={"base_title": title, "display_items": deeper, "previous_item_type": kind, "previous_rating_key": rating_key})
    else:
        return RefreshItemMenu(rating_key=rating_key, title=title, item_title=item_title)

    return oc
Example #9
0
def FirstLetterMetadataMenu(rating_key, key, title=None, base_title=None, display_items=False, previous_item_type=None,
                            previous_rating_key=None):
    """

    :param rating_key: actually is the section's key
    :param key: the firstLetter wanted
    :param title: the first letter, or #
    :param deeper:
    :return:
    """
    title = base_title + " > " + unicode(title)
    oc = ObjectContainer(title2=title, no_cache=True, no_history=True)

    items = getAllItems(key="first_character", value=[rating_key, key], base="library/sections", flat=False)
    kind, deeper = get_items_info(items)
    dig_tree(oc, items, MetadataMenu,
             pass_kwargs={"base_title": title, "display_items": deeper, "previous_item_type": kind, "previous_rating_key": rating_key})
    return oc
Example #10
0
def SectionsMenu():
    items = getAllItems("sections")

    return dig_tree(ObjectContainer(title2="Sections", no_cache=True, no_history=True), items, None,
                    menu_determination_callback=determine_section_display, pass_kwargs={"base_title": "Sections"},
                    fill_args={"title": "section_title"})