pvr: Mark recordings 'watched' / 'unwatched' #508
Conversation
looking good. 1 request: please change it into a watched counter instead of a boolean. if the backend only supports watched/unwatched, convert it in the add-on. |
done |
} | ||
else | ||
{ | ||
if (pItem->GetOverlayImage().Equals("OverlayWatched.png")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without looking into the CFileItem code, I know there must be a better way to check the watched status than like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forget my comment below. I'll change it to the play count. For folders we should keep both buttons anyways...
Thanks for reviewing. I agree that this is a big ugly. But currently I don't see how this could be handled correctly:
- CGUIListItem usues the enum GUIIconOverlay when you set the overlay. But there's no public function to get the overlay as enum.
- I could change it to use the play count values of the VideoInfoTag (like it is done in GUIWindowMusicNav). But I'm already working on the watched overlay for the recording subfolders. As soon as that is finished I'd like to remove the 'if (pItem->m_bIsFolder)' and only use the '.Equls("OverlayWatched")'. Because we don't have VideoInfoTags for folders.
- GUIWindowVideoNav btw uses also the '.Equls("OverlayWatched")' code so we're not using it more ugly that they do ;)
done |
Added new commit to the PR. This enables the watched overlay also for the recording folders. |
if ((supportsPlayCount && current->m_iRecPlayCount > 0) || | ||
(!supportsPlayCount && db.Open() && db.GetPlayCount(*pFileItem) > 0)) | ||
{ | ||
pFileItem->SetOverlayImage(CGUIListItem::ICON_OVERLAY_UNWATCHED, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like you got the wrong overlay here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The api is a bit strange 'unwatched' with 'true' will use the next enum value which is 'watched'.
However, I changed it to
pFileItem->SetOverlayImage(CGUIListItem::ICON_OVERLAY_WATCHED, false);
Rebased and fixed the overlay as commented above. |
thanks. one last thing before this can be merged: please add the method to each client's "UNUSED API FUNCTIONS" list, in the bottom of the client.cpp file. |
…pability and watched flag in PVRRecording(s). Allow read/write play count from/to client using context menu. Mapped watched overlay to client play count instead of using video database (if supported by client).
…yCount. This marks a recording as watched on the client after recording has been played.
done in 5098d0d |
it needed a couple of little fixes. |
This is my first contribution to the pvr branch, so please be patient :-)
Great that we have the recording's watched state visible in the recordings view.
This PR basically adds 2 new features --> watched/unwatched in context menu and client api to sync watched state
2dbda19 Adds 'mark watched' / 'unwatched' to the recording's context menu that changes the watched state in the video database. Works for both, single files and complete folders. The code that is actually changing the values in the database has been taken from GUIWindowVideoBase::MarkWatched.
fc7452b Adds an client API function "MarkRecordingWatched". This allows to set the watched state on the client (if supported). For some clients like mythtv, this functionality is quite essential as it allows the backend to maintain the disk space better (watched recordings can be removed when running out of space). Another advantage is that you have a consistent view when using different frontend / webinterface with the backend.
a89437b Uses the new client API to set the watched state on the client in video database SetPlayCount. This syncs the state with the client for example after watching a recording.
Looking forward to your comments!
Christian
Updated this PR to also contain the API (cause that one depends on the context menu). Hope that is ok for you