Skip to content
This repository
Browse code

Merge pull request #1926 from axmhari/pvr-watched-fix

[pvr] Use play count and resume point information from the PVR client if available.
  • Loading branch information...
commit 7899597011184774b41059f5066d963e4c769216 2 parents 3041d7a + 1449141
jmarshallnz authored December 12, 2012
3  xbmc/FileItem.cpp
@@ -1448,6 +1448,9 @@ void CFileItem::UpdateInfo(const CFileItem &item, bool replaceLabels /*=true*/)
1448 1448
   if (item.HasVideoInfoTag())
1449 1449
   { // copy info across (TODO: premiered info is normally stored in m_dateTime by the db)
1450 1450
     *GetVideoInfoTag() = *item.GetVideoInfoTag();
  1451
+    // preferably use some information from PVR info tag if available
  1452
+    if (HasPVRRecordingInfoTag())
  1453
+      GetPVRRecordingInfoTag()->CopyClientInfo(GetVideoInfoTag());
1451 1454
     SetOverlayImage(ICON_OVERLAY_UNWATCHED, GetVideoInfoTag()->m_playCount > 0);
1452 1455
   }
1453 1456
   if (item.HasMusicInfoTag())
11  xbmc/pvr/recordings/PVRRecording.cpp
@@ -274,3 +274,14 @@ CStdString CPVRRecording::GetTitleFromURL(const CStdString &url)
274 274
   }
275 275
   return StringUtils::EmptyString;
276 276
 }
  277
+
  278
+void CPVRRecording::CopyClientInfo(CVideoInfoTag *target)
  279
+{
  280
+  if (!target)
  281
+    return;
  282
+
  283
+  if (g_PVRClients->SupportsRecordingPlayCount(m_iClientId))
  284
+    target->m_playCount = m_playCount;
  285
+  if (g_PVRClients->SupportsLastPlayedPosition(m_iClientId))
  286
+    target->m_resumePoint = m_resumePoint;
  287
+}
6  xbmc/pvr/recordings/PVRRecording.h
@@ -132,6 +132,12 @@ namespace PVR
132 132
      */
133 133
     static CStdString GetTitleFromURL(const CStdString &url);
134 134
 
  135
+    /*!
  136
+     * @brief Copy some information from the client to the given video info tag
  137
+     * @param target video info tag to which the information will be copied
  138
+     */
  139
+    void CopyClientInfo(CVideoInfoTag *target);
  140
+
135 141
   private:
136 142
     CDateTime m_recordingTime; /*!< start time of the recording */
137 143
 
5  xbmc/video/windows/GUIWindowVideoNav.cpp
@@ -53,6 +53,7 @@
53 53
 #include "guilib/GUIKeyboardFactory.h"
54 54
 #include "video/VideoInfoScanner.h"
55 55
 #include "video/dialogs/GUIDialogVideoInfo.h"
  56
+#include "pvr/recordings/PVRRecording.h"
56 57
 
57 58
 using namespace XFILE;
58 59
 using namespace VIDEODATABASEDIRECTORY;
@@ -469,6 +470,10 @@ void CGUIWindowVideoNav::LoadVideoInfo(CFileItemList &items, CVideoDatabase &dat
469 470
         fetchedPlayCounts = true;
470 471
       }
471 472
       
  473
+      // preferably use some information from PVR info tag if available
  474
+      if (pItem->HasPVRRecordingInfoTag())
  475
+        pItem->GetPVRRecordingInfoTag()->CopyClientInfo(pItem->GetVideoInfoTag());
  476
+
472 477
       // set the watched overlay
473 478
       if (pItem->IsVideo())
474 479
         pItem->SetOverlayImage(CGUIListItem::ICON_OVERLAY_UNWATCHED, pItem->HasVideoInfoTag() && pItem->GetVideoInfoTag()->m_playCount > 0);

0 notes on commit 7899597

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