当前位置: 首页>>代码示例>>Python>>正文


Python helpers.timestamp函数代码示例

本文整理汇总了Python中support.helpers.timestamp函数的典型用法代码示例。如果您正苦于以下问题:Python timestamp函数的具体用法?Python timestamp怎么用?Python timestamp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了timestamp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: AdvancedMenu

def AdvancedMenu(randomize=None, header=None, message=None):
    oc = ObjectContainer(header=header or "Internal stuff, pay attention!", message=message, no_cache=True, no_history=True, title2="Advanced")

    oc.add(DirectoryObject(
        key=Callback(TriggerRestart),
        title=pad_title("Restart the plugin")
    ))
    oc.add(DirectoryObject(
        key=Callback(RefreshToken, randomize=timestamp()),
        title=pad_title("Re-request the API token from plex.tv")
    ))
    oc.add(DirectoryObject(
        key=Callback(LogStorage, key="tasks", randomize=timestamp()),
        title=pad_title("Log the plugin's scheduled tasks state storage")
    ))
    oc.add(DirectoryObject(
        key=Callback(LogStorage, key="subs", randomize=timestamp()),
        title=pad_title("Log the plugin's internal subtitle information storage")
    ))
    oc.add(DirectoryObject(
        key=Callback(ResetStorage, key="tasks", randomize=timestamp()),
        title=pad_title("Reset the plugin's scheduled tasks state storage")
    ))
    oc.add(DirectoryObject(
        key=Callback(ResetStorage, key="subs", randomize=timestamp()),
        title=pad_title("Reset the plugin's internal subtitle information storage")
    ))
    return oc
开发者ID:shahar3012,项目名称:Sub-Zero.bundle,代码行数:28,代码来源:menu.py

示例2: ResetStorage

def ResetStorage(key, randomize=None, sure=False):
    if not sure:
        oc = SubFolderObjectContainer(
                no_history=True,
                title1=_("Reset subtitle storage"),
                title2=_("Are you sure?"))
        oc.add(DirectoryObject(
            key=Callback(
                    ResetStorage,
                    key=key,
                    sure=True,
                    randomize=timestamp()),
            title=pad_title(_("Are you really sure?")),

        ))
        return oc

    reset_storage(key)

    if key == "tasks":
        # reinitialize the scheduler
        scheduler.init_storage()
        scheduler.setup_tasks()

    return AdvancedMenu(
        randomize=timestamp(),
        header=_("Success"),
        message=_("Information Storage (%s) reset", key)
    )
开发者ID:pannal,项目名称:Sub-Zero.bundle,代码行数:29,代码来源:advanced.py

示例3: SubtitleShiftModMenu

def SubtitleShiftModMenu(unit=None, **kwargs):
    if unit not in POSSIBLE_UNITS_D:
        raise NotImplementedError

    kwargs.pop("randomize")

    oc = SubFolderObjectContainer(title2=kwargs["title"], replace_parent=True)

    oc.add(DirectoryObject(
        key=Callback(SubtitleShiftModUnitMenu, randomize=timestamp(), **kwargs),
        title=_("< Back to unit selection")
    ))

    rng = []
    if unit == "h":
        rng = list(reversed(range(-10, 0))) + list(reversed(range(1, 11)))
    elif unit in ("m", "s"):
        rng = list(reversed(range(-15, 0))) + list(reversed(range(1, 16)))
    elif unit == "ms":
        rng = list(reversed(range(-900, 0, 100))) + list(reversed(range(100, 1000, 100)))

    for i in rng:
        if i == 0:
            continue

        mod_ident = SubtitleModifications.get_mod_signature("shift_offset", **{unit: i})
        oc.add(DirectoryObject(
            key=Callback(SubtitleSetMods, mods=mod_ident, mode="add", randomize=timestamp(), **kwargs),
            title="%s %s" % (("%s" if i < 0 else "+%s") % i, unit)
        ))

    return oc
开发者ID:pannal,项目名称:Sub-Zero.bundle,代码行数:32,代码来源:sub_mod.py

示例4: PinMenu

def PinMenu(pin="", randomize=None, success_go_to="channel"):
    oc = ObjectContainer(
            title2=_("Enter PIN number ") + str(len(pin) + 1),
            no_cache=True,
            no_history=True,
            skip_pin_lock=True)

    if pin == config.pin:
        Dict["pin_correct_time"] = datetime.datetime.now()
        config.locked = False
        if success_go_to == "channel":
            return fatality(
                force_title=_("PIN correct"),
                header=_("PIN correct"),
                no_history=True)
        elif success_go_to == "advanced":
            return AdvancedMenu(randomize=timestamp())

    for i in range(10):
        oc.add(DirectoryObject(
            key=Callback(
                    PinMenu,
                    randomize=timestamp(),
                    pin=pin + str(i),
                    success_go_to=success_go_to),
            title=pad_title(str(i)),
        ))
    oc.add(DirectoryObject(
        key=Callback(
                PinMenu,
                randomize=timestamp(),
                success_go_to=success_go_to),
        title=pad_title(_("Reset")),
    ))
    return oc
开发者ID:pannal,项目名称:Sub-Zero.bundle,代码行数:35,代码来源:advanced.py

示例5: fatality

def fatality(randomize=None, header=None, message=None, only_refresh=False):
    """
    subzero main menu
    """
    oc = ObjectContainer(header=header, message=message, no_cache=True, no_history=True)

    if not config.plex_api_working:
        oc.add(DirectoryObject(
            key=Callback(fatality, randomize=timestamp()),
            title=pad_title("PMS API ERROR"),
            summary=lib_unaccessible_error
        ))
        return oc

    if not only_refresh:
        oc.add(DirectoryObject(
            key=Callback(OnDeckMenu),
            title=pad_title("Subtitles for 'On Deck' items"),
            summary="Shows the current on deck items and allows you to individually (force-) refresh their metadata/subtitles."
        ))
        oc.add(DirectoryObject(
            key=Callback(RecentlyAddedMenu),
            title="Subtitles for 'Recently Added' items (max-age: %s)" % Prefs["scheduler.item_is_recent_age"],
            summary="Shows the recently added items, honoring the configured 'Item age to be considered recent'-setting (%s) and allowing you to individually (force-) refresh their metadata/subtitles." %
                    Prefs["scheduler.item_is_recent_age"]
        ))

        task_name = "searchAllRecentlyAddedMissing"
        task = scheduler.task(task_name)

        if task.ready_for_display:
            task_state = "Running: %s/%s (%s%%)" % (len(task.items_done), len(task.items_searching), task.percentage)
        else:
            task_state = "Last scheduler run: %s; Next scheduled run: %s; Last runtime: %s" % (scheduler.last_run(task_name) or "never",
                                                                                               scheduler.next_run(task_name) or "never",
                                                                                               str(task.last_run_time).split(".")[0])

        oc.add(DirectoryObject(
            key=Callback(RefreshMissing, randomize=timestamp()),
            title="Search for missing subtitles (in recently-added items, max-age: %s)" % Prefs["scheduler.item_is_recent_age"],
            summary="Automatically run periodically by the scheduler, if configured. %s" % task_state
        ))

    oc.add(DirectoryObject(
        key=Callback(fatality, randomize=timestamp()),
        title=pad_title("Refresh"),
        summary="Refreshes the current view"
    ))

    if not only_refresh:
        oc.add(DirectoryObject(
            key=Callback(AdvancedMenu, randomize=timestamp()),
            title=pad_title("Advanced functions"),
            summary="Use at your own risk"
        ))

    return oc
开发者ID:shahar3012,项目名称:Sub-Zero.bundle,代码行数:57,代码来源:menu.py

示例6: ListEmbeddedSubsForItemMenu

def ListEmbeddedSubsForItemMenu(**kwargs):
    rating_key = kwargs["rating_key"]
    part_id = kwargs["part_id"]
    title = kwargs["title"]
    kwargs.pop("randomize")

    oc = SubFolderObjectContainer(title2=title, replace_parent=True)

    oc.add(DirectoryObject(
        key=Callback(ItemDetailsMenu, rating_key=kwargs["rating_key"], item_title=kwargs["item_title"],
                     base_title=kwargs["base_title"], title=kwargs["item_title"], randomize=timestamp()),
        title=_("< Back to %s", kwargs["title"]),
        thumb=default_thumb
    ))

    plex_item = get_item(rating_key)
    part = get_part(plex_item, part_id)

    if part:
        for stream_data in get_embedded_subtitle_streams(part, skip_duplicate_unknown=False):
            language = stream_data["language"]
            is_unknown = stream_data["is_unknown"]
            stream = stream_data["stream"]
            is_forced = stream_data["is_forced"]

            if language:
                oc.add(DirectoryObject(
                    key=Callback(TriggerExtractEmbeddedSubForItemMenu, randomize=timestamp(),
                                 stream_index=str(stream.index), language=language, with_mods=True, **kwargs),
                    title=_(u"Extract stream %(stream_index)s, %(language)s%(unknown_state)s%(forced_state)s"
                            u"%(stream_title)s with default mods",
                            stream_index=stream.index,
                            language=display_language(language),
                            unknown_state=_(" (unknown)") if is_unknown else "",
                            forced_state=_(" (forced)") if is_forced else "",
                            stream_title=" (\"%s\")" % stream.title if stream.title else ""),
                ))
                oc.add(DirectoryObject(
                    key=Callback(TriggerExtractEmbeddedSubForItemMenu, randomize=timestamp(),
                                 stream_index=str(stream.index), language=language, **kwargs),
                    title=_(u"Extract stream %(stream_index)s, %(language)s%(unknown_state)s%(forced_state)s"
                            u"%(stream_title)s",
                            stream_index=stream.index,
                            language=display_language(language),
                            unknown_state=_(" (unknown)") if is_unknown else "",
                            forced_state=_(" (forced)") if is_forced else "",
                            stream_title=" (\"%s\")" % stream.title if stream.title else ""),
                ))
    return oc
开发者ID:pannal,项目名称:Sub-Zero.bundle,代码行数:49,代码来源:item_details.py

示例7: ResetStorage

def ResetStorage(key, randomize=None, sure=False):
    if not sure:
	oc = ObjectContainer(no_history=True, title1="Reset subtitle storage", title2="Are you sure?")
	oc.add(DirectoryObject(
	    key=Callback(ResetStorage, key=key, sure=True, randomize=timestamp()),
	    title=pad_title("Are you really sure?")
	))
	return oc

    resetStorage(key)
    return AdvancedMenu(
	randomize=timestamp(),
        header='Success',
        message='Subtitle Information Storage reset'
    )
开发者ID:zemzela,项目名称:Sub-Zero,代码行数:15,代码来源:menu.py

示例8: LogStorage

def LogStorage(key, randomize=None):
    log_storage(key)
    return AdvancedMenu(
        randomize=timestamp(),
        header='Success',
        message='Information Storage (%s) logged' % key
    )
开发者ID:faacunha,项目名称:Sub-Zero.bundle,代码行数:7,代码来源:menu.py

示例9: ReApplyMods

def ReApplyMods(randomize=None):
    Thread.CreateTimer(1.0, apply_default_mods, reapply_current=True)
    return AdvancedMenu(
        randomize=timestamp(),
        header=_("Success"),
        message=_("This may take some time ...")
    )
开发者ID:pannal,项目名称:Sub-Zero.bundle,代码行数:7,代码来源:advanced.py

示例10: TriggerCacheMaintenance

def TriggerCacheMaintenance(randomize=None):
    scheduler.dispatch_task("CacheMaintenance")
    return AdvancedMenu(
        randomize=timestamp(),
        header=_("Success"),
        message=_("TriggerCacheMaintenance triggered")
    )
开发者ID:pannal,项目名称:Sub-Zero.bundle,代码行数:7,代码来源:advanced.py

示例11: TriggerStorageMigration

def TriggerStorageMigration(randomize=None):
    scheduler.dispatch_task("MigrateSubtitleStorage")
    return AdvancedMenu(
        randomize=timestamp(),
        header=_("Success"),
        message=_("MigrateSubtitleStorage triggered")
    )
开发者ID:pannal,项目名称:Sub-Zero.bundle,代码行数:7,代码来源:advanced.py

示例12: SelectStoredSubForItemMenu

def SelectStoredSubForItemMenu(**kwargs):
    rating_key = kwargs["rating_key"]
    part_id = kwargs["part_id"]
    language = Language.fromietf(kwargs["language"])
    item_type = kwargs["item_type"]
    sub_key = tuple(kwargs.pop("sub_key").split("__"))

    plex_item = get_item(rating_key)
    storage = get_subtitle_storage()
    stored_subs = storage.load(plex_item.rating_key)

    subtitles = stored_subs.get_all(part_id, language)
    subtitle = subtitles[sub_key]

    save_stored_sub(subtitle, rating_key, part_id, language, item_type, plex_item=plex_item, storage=storage,
                    stored_subs=stored_subs)

    stored_subs.set_current(part_id, language, sub_key)
    storage.save(stored_subs)
    storage.destroy()

    kwa = {
        "header": _("Success"),
        "message": _("Subtitle saved to disk"),
        "title": kwargs["title"],
        "item_title": kwargs["item_title"],
        "base_title": kwargs.get("base_title")
    }

    # fixme: return to SubtitleOptionsMenu properly? (needs recomputation of current_data

    return ItemDetailsMenu(rating_key, randomize=timestamp(), **kwa)
开发者ID:pannal,项目名称:Sub-Zero.bundle,代码行数:32,代码来源:item_details.py

示例13: TriggerBetterSubtitles

def TriggerBetterSubtitles(randomize=None):
    scheduler.dispatch_task("FindBetterSubtitles")
    return AdvancedMenu(
        randomize=timestamp(),
        header=_("Success"),
        message=_("FindBetterSubtitles triggered")
    )
开发者ID:pannal,项目名称:Sub-Zero.bundle,代码行数:7,代码来源:advanced.py

示例14: LogStorage

def LogStorage(key, randomize=None):
    log_storage(key)
    return AdvancedMenu(
        randomize=timestamp(),
        header=_("Success"),
        message=_("Information Storage (%s) logged", key)
    )
开发者ID:pannal,项目名称:Sub-Zero.bundle,代码行数:7,代码来源:advanced.py

示例15: ResetProviderThrottle

def ResetProviderThrottle(randomize=None):
    Dict["provider_throttle"] = {}
    Dict.Save()
    return AdvancedMenu(
        randomize=timestamp(),
        header=_("Success"),
        message=_("Provider throttles reset")
    )
开发者ID:pannal,项目名称:Sub-Zero.bundle,代码行数:8,代码来源:advanced.py


注:本文中的support.helpers.timestamp函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。