Skip to content
This repository
Browse code

videodb: only set playcount, lastplayed, dateadded and resume propert…

…ies in GetFileInfo() if they aren't already set
  • Loading branch information...
commit 0f216441406470c40a27db191de8f47d44eae96d 1 parent b07d4c3
Sascha Montellese authored October 03, 2012

Showing 1 changed file with 11 additions and 6 deletions. Show diff stats Hide diff stats

  1. 17  xbmc/video/VideoDatabase.cpp
17  xbmc/video/VideoDatabase.cpp
@@ -1857,12 +1857,17 @@ bool CVideoDatabase::GetFileInfo(const CStdString& strFilenameAndPath, CVideoInf
1857 1857
     details.m_strPath = m_pDS->fv("path.strPath").get_asString();
1858 1858
     CStdString strFileName = m_pDS->fv("files.strFilename").get_asString();
1859 1859
     ConstructPath(details.m_strFileNameAndPath, details.m_strPath, strFileName);
1860  
-    details.m_playCount = m_pDS->fv("files.playCount").get_asInt();
1861  
-    details.m_lastPlayed.SetFromDBDateTime(m_pDS->fv("files.lastPlayed").get_asString());
1862  
-    details.m_dateAdded.SetFromDBDateTime(m_pDS->fv("files.dateAdded").get_asString());
1863  
-    details.m_resumePoint.timeInSeconds = m_pDS->fv("bookmark.timeInSeconds").get_asInt();
1864  
-    details.m_resumePoint.totalTimeInSeconds = m_pDS->fv("bookmark.totalTimeInSeconds").get_asInt();
1865  
-    details.m_resumePoint.type = CBookmark::RESUME;
  1860
+    details.m_playCount = max(details.m_playCount, m_pDS->fv("files.playCount").get_asInt());
  1861
+    if (!details.m_lastPlayed.IsValid())
  1862
+      details.m_lastPlayed.SetFromDBDateTime(m_pDS->fv("files.lastPlayed").get_asString());
  1863
+    if (!details.m_dateAdded.IsValid())
  1864
+      details.m_dateAdded.SetFromDBDateTime(m_pDS->fv("files.dateAdded").get_asString());
  1865
+    if (!details.m_resumePoint.IsSet())
  1866
+    {
  1867
+      details.m_resumePoint.timeInSeconds = m_pDS->fv("bookmark.timeInSeconds").get_asInt();
  1868
+      details.m_resumePoint.totalTimeInSeconds = m_pDS->fv("bookmark.totalTimeInSeconds").get_asInt();
  1869
+      details.m_resumePoint.type = CBookmark::RESUME;
  1870
+    }
1866 1871
 
1867 1872
     return !details.IsEmpty();
1868 1873
   }

0 notes on commit 0f21644

Please sign in to comment.
Something went wrong with that request. Please try again.