本文整理汇总了C++中ProgramInfo::GetBookmarkUpdate方法的典型用法代码示例。如果您正苦于以下问题:C++ ProgramInfo::GetBookmarkUpdate方法的具体用法?C++ ProgramInfo::GetBookmarkUpdate怎么用?C++ ProgramInfo::GetBookmarkUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProgramInfo
的用法示例。
在下文中一共展示了ProgramInfo::GetBookmarkUpdate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GeneratePreviewImage
/** \brief Generate a preview image for the specified program.
*
* This function will find an existing preview image for a program, or
* schedules the generation of a preview image if it doesn't exist.
* If any of the arguments that could affect the generated image
* (size, outputfile, time offset) have been specified, then a new
* image will always be generated.
*
* \param pginfo Generate the image for this program.
* \param size Generate a preview image of these dimensions. If this
* is not specified the generated image will be the same size
* as the program.
* \param outputfile Use this specific filename for the preview
* image. If empty, a default name will be created based on the
* program information.
* \param time An offset from the start of the program. This can be
* seconds or frames. (See the next argument.)
* \param in_seconds If true, the 'time' offset is in seconds. If
* false, the offset is in frames.
* \param token An arbitrary string value used to match up this
* request with the response from the backend, and as a key for
* some indexing. A token isn't required, but is strongly
* suggested.
* \return The filename of the preview images. This will be null if
* the preview does not yet or will never exist.
*
* \note This function will always send one of three events. If the
* program has been marked for deletion, this function will send a
* PREVIEW_FAILED event. If a preview already exists, the function
* sends a PREVIEW_SUCCESS event. Otherwise it sends a PREVIEW_QUEUED
* event.
*
* \warning This function should only be called from the preview
* generation thread.
*/
QString PreviewGeneratorQueue::GeneratePreviewImage(
ProgramInfo &pginfo,
const QSize &size,
const QString &outputfile,
long long time, bool in_seconds,
QString token)
{
QString key = QString("%1_%2x%3_%4%5")
.arg(pginfo.GetBasename()).arg(size.width()).arg(size.height())
.arg(time).arg(in_seconds?"s":"f");
if (pginfo.GetAvailableStatus() == asPendingDelete)
{
SendEvent(pginfo, "PREVIEW_FAILED", key, token,
"Pending Delete", QDateTime());
return QString();
}
// keep in sync with default filename in PreviewGenerator::RunReal
QString filename = (outputfile.isEmpty()) ?
pginfo.GetPathname() + ".png" : outputfile;
QString ret_file = filename;
QString ret;
bool is_special = !outputfile.isEmpty() || time >= 0 ||
size.width() || size.height();
bool needs_gen = true;
if (!is_special)
{
QDateTime previewLastModified;
bool streaming = !filename.startsWith("/");
bool locally_accessible = false;
bool bookmark_updated = false;
QDateTime bookmark_ts = pginfo.GetBookmarkUpdate();
QDateTime cmp_ts;
if (bookmark_ts.isValid())
cmp_ts = bookmark_ts;
else if (MythDate::current() >= pginfo.GetRecordingEndTime())
cmp_ts = pginfo.GetLastModifiedTime();
else
cmp_ts = pginfo.GetRecordingStartTime();
if (streaming)
{
ret_file = QString("%1/%2")
.arg(GetRemoteCacheDir()).arg(filename.section('/', -1));
QFileInfo finfo(ret_file);
if (finfo.isReadable() && finfo.lastModified() >= cmp_ts)
{
// This is just an optimization to avoid
// hitting the backend if our cached copy
// is newer than the bookmark, or if we have
// a preview and do not update it when the
// bookmark changes.
previewLastModified = finfo.lastModified();
}
else if (!IsGeneratingPreview(key))
{
previewLastModified =
RemoteGetPreviewIfModified(pginfo, ret_file);
}
}
//.........这里部分代码省略.........