void CPVRRecording::UpdateMetadata(void)
{
- CVideoDatabase db;
-
- if (!g_PVRClients->SupportsRecordingPlayCount(m_iClientId))
+ if (m_bGotMetaData)
+ return;
+
+ bool supportsPlayCount = g_PVRClients->SupportsRecordingPlayCount(m_iClientId);
+ bool supportsLastPlayed = g_PVRClients->SupportsLastPlayedPosition(m_iClientId);
+
+ if (!supportsPlayCount || !supportsLastPlayed)
{
- if (!m_bGotMetaData && db.Open())
+ CVideoDatabase db;
+ if (db.Open())
{
- CFileItem pFileItem(*this);
- m_playCount = db.GetPlayCount(pFileItem);
- }
- }
+ if (!supportsPlayCount)
+ {
+ CFileItem pFileItem(*this);
+ m_playCount = db.GetPlayCount(pFileItem);
+ }
- if (!g_PVRClients->SupportsLastPlayedPosition(m_iClientId))
- {
- if (!m_bGotMetaData && db.Open())
- db.GetResumeBookMark(m_strFileNameAndPath, m_resumePoint);
- }
+ if (!supportsLastPlayed)
+ db.GetResumeBookMark(m_strFileNameAndPath, m_resumePoint);
+ db.Close();
+ }
+ }
+
m_bGotMetaData = true;
}
std::vector<PVR_EDL_ENTRY> GetEdl() const;
/*!
- * @brief Get the resume point and play count from the server (if supported) or the database
- * @param bookmark The bookmark to update
+ * @brief Get the resume point and play count from the database if the
+ * client doesn't handle it itself.
*/
void UpdateMetadata(void);