예제 #1
0
def RecentMissingSubtitlesMenu(force=False, randomize=None):
    title = _("Items with missing subtitles")
    oc = SubFolderObjectContainer(title2=title, no_cache=True, no_history=True)

    running = scheduler.is_task_running("MissingSubtitles")
    task_data = scheduler.get_task_data("MissingSubtitles")
    missing_items = task_data["missing_subtitles"] if task_data else None

    if ((missing_items is None) or force) and not running:
        scheduler.dispatch_task("MissingSubtitles")
        running = True

    if not running:
        oc.add(
            DirectoryObject(
                key=Callback(RecentMissingSubtitlesMenu,
                             force=True,
                             randomize=timestamp()),
                title=_(u"Find recent items with missing subtitles"),
                thumb=default_thumb))
    else:
        oc.add(
            DirectoryObject(key=Callback(RecentMissingSubtitlesMenu,
                                         force=False,
                                         randomize=timestamp()),
                            title=_(u"Updating, refresh here ..."),
                            thumb=default_thumb))

    if missing_items is not None:
        for added_at, item_id, item_title, item, missing_languages in missing_items:
            oc.add(
                DirectoryObject(key=Callback(ItemDetailsMenu,
                                             title=title + " > " + item_title,
                                             item_title=item_title,
                                             rating_key=item_id),
                                title=item_title,
                                summary=_(
                                    "Missing: %s", ", ".join(
                                        display_language(l)
                                        for l in missing_languages)),
                                thumb=get_item_thumb(item) or default_thumb))

    return oc
예제 #2
0
def RecentMissingSubtitlesMenu(force=False, randomize=None):
    title = _("Items with missing subtitles")
    oc = SubFolderObjectContainer(title2=title, no_cache=True, no_history=True)

    running = scheduler.is_task_running("MissingSubtitles")
    task_data = scheduler.get_task_data("MissingSubtitles")
    missing_items = task_data["missing_subtitles"] if task_data else None

    if ((missing_items is None) or force) and not running:
        scheduler.dispatch_task("MissingSubtitles")
        running = True

    if not running:
        oc.add(DirectoryObject(
            key=Callback(RecentMissingSubtitlesMenu, force=True, randomize=timestamp()),
            title=_(u"Find recent items with missing subtitles"),
            thumb=default_thumb
        ))
    else:
        oc.add(DirectoryObject(
            key=Callback(RecentMissingSubtitlesMenu, force=False, randomize=timestamp()),
            title=_(u"Updating, refresh here ..."),
            thumb=default_thumb
        ))

    if missing_items is not None:
        for added_at, item_id, item_title, item, missing_languages in missing_items:
            oc.add(DirectoryObject(
                key=Callback(ItemDetailsMenu, title=title + " > " + item_title, item_title=item_title,
                             rating_key=item_id),
                title=item_title,
                summary=_("Missing: %s", ", ".join(display_language(l) for l in missing_languages)),
                thumb=get_item_thumb(item) or default_thumb
            ))

    return oc
예제 #3
0
def get_item_task_data(task_name, rating_key, language):
    task_data = scheduler.get_task_data(task_name)
    search_results = task_data.get(rating_key, {}) if task_data else {}
    return search_results.get(language)
예제 #4
0
def get_item_task_data(task_name, rating_key, language):
    task_data = scheduler.get_task_data(task_name)
    search_results = task_data.get(rating_key, {}) if task_data else {}
    return search_results.get(language)