Go to the documentation of this file.
18 LOG(VB_GENERAL, LOG_INFO,
"Query playback state for all videos from database");
24 LOG(VB_GENERAL, LOG_INFO, QString(
"Collected playbackstate for %1 videos").arg(
m_fileMarkup.count()));
39 if (filterFilename.isEmpty())
41 query.
prepare(
"SELECT filename, type, mark, `offset` "
43 "WHERE type IN (:BOOKMARK, :FRAMES, :PLAYPOS) "
48 query.
prepare(
"SELECT filename, type, mark, `offset` "
50 "WHERE type IN (:BOOKMARK, :FRAMES, :PLAYPOS) "
51 "AND filename = :FILENAME "
53 query.
bindValue(
":FILENAME", filterFilename);
70 if (!lastFilename.isEmpty() &&
filename != lastFilename)
75 switch(query.
value(1).toInt())
99 return it.value().bookmarkPos > 0;
109 return it.value().lastPlayPos;
119 const auto pos = it.value().lastPlayPos;
120 const auto total = it.value().totalFrames;
125 return std::clamp(100 * pos / total, (uint64_t)0, (uint64_t)100);
QMap< QString, Markup > m_fileMarkup
maps filename to markup
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
QSqlQuery wrapper that fetches a DB connection from the connection pool.
void Initialize()
Initializes playback state from database.
uint64_t totalFrames
total frames
QVariant value(int i) const
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
bool HasBookmark(const QString &filename) const
Query bookmark of video with the specified filename.
bool m_alwaysShowWatchedProgress
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
static void DBError(const QString &where, const MSqlQuery &query)
uint GetWatchedPercent(const QString &filename) const
Query watched percent of video with the specified filename.
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
static eu8 clamp(eu8 value, eu8 low, eu8 high)
bool GetBoolSetting(const QString &key, bool defaultval=false)
uint64_t GetLastPlayPos(const QString &filename) const
Query last playback position of video with the specified filename.
void Update(const QString &filename)
Updates playback state of video with specified filename.
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
uint64_t bookmarkPos
bookmark position
bool AlwaysShowWatchedProgress() const
Returns cached setting "AlwaysShowWatchedProgress".
uint64_t lastPlayPos
last playing position
void QueryData(const QString &filterFilename=QString())
Query playback state from database, only for single video if a filename is specified.
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.