Skip to content

Loading…

ADD: "last played" sort option to TV Show GUI #1660

Merged
merged 1 commit into from

5 participants

@koying
Team Kodi member

No description provided.

@Fneufneu
Team Kodi member

Cool feature, why it's only for tv show ? can be usefull for movies to.

@koying
Team Kodi member

@jmarshallnz Could you have a look, please.
I don't think adding this sort option to movies makes a lot of sense...

@jmarshallnz
Team Kodi member

Code looks good to me. Only question is if it should be applied to other cases. Does lastplayed get updated when something is only half watched?

@koying
Team Kodi member

Re cases, I don't see a use case for movies or episodes. Might be interesting for artists/albums, maybe?
Re updated, lastplayed is based on playcount, IIRC.
@Montellese could probably tell when a file is considered as "played".

@Montellese
Team Kodi member

IIRC lastplayed is not updated when a video is not finished i.e. if lastplayed is updated, playcount is updated as well.

@koying
Team Kodi member

It's the other way around, I think. lastplayed is based upon playcount. JM's question is when is the playcount updated...

@Montellese
Team Kodi member

Nope you can have a playcount of 0 (by marking a video as unwatched) but you can still have a lastplayed value so that statement is not correct.

@koying
Team Kodi member

My mistake. I mixed up things.
Am I right assuming the lastplayed field is updated at the same time as playcount is set to 1?

@MartijnKaijser
Team Kodi member

Even if you haven't finished it so playcount stays zero but last played time is still updated.

@koying
Team Kodi member

OK. So answer to @jmarshallnz is: It is updated as soon as playback starts ;)

@MartijnKaijser
Team Kodi member

Or on stops. Not sure (tm)

@jmarshallnz
Team Kodi member

Righto - merge at your leisure then.

@koying koying merged commit c9accb2 into xbmc:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 23, 2012
  1. @koying
Showing with 7 additions and 1 deletion.
  1. +6 −1 xbmc/utils/LabelFormatter.cpp
  2. +1 −0 xbmc/video/GUIViewStateVideo.cpp
View
7 xbmc/utils/LabelFormatter.cpp
@@ -95,9 +95,10 @@ using namespace MUSIC_INFO;
* %Y - Year
* %Z - tvshow title
* %a - Date Added
+ * %p - Last Played
*/
-#define MASK_CHARS "NSATBGYFLDIJRCKMEPHZOQUVXWa"
+#define MASK_CHARS "NSATBGYFLDIJRCKMEPHZOQUVXWap"
CLabelFormatter::CLabelFormatter(const CStdString &mask, const CStdString &mask2)
{
@@ -312,6 +313,10 @@ CStdString CLabelFormatter::GetMaskContent(const CMaskString &mask, const CFileI
if (movie && movie->m_dateAdded.IsValid())
value = movie->m_dateAdded.GetAsLocalizedDate();
break;
+ case 'p': // Last played
+ if (movie && movie->m_lastPlayed.IsValid())
+ value = movie->m_lastPlayed.GetAsLocalizedDate();
+ break;
}
if (!value.IsEmpty())
return mask.m_prefix + value + mask.m_postfix;
View
1 xbmc/video/GUIViewStateVideo.cpp
@@ -168,6 +168,7 @@ CGUIViewStateWindowVideoNav::CGUIViewStateWindowVideoNav(const CFileItemList& it
AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE, 551, LABEL_MASKS("%T", "%M", "%T", "%M")); // Title, #Episodes | Title, #Episodes
AddSortMethod(SORT_METHOD_EPISODE, 20360, LABEL_MASKS("%L", "%M", "%L", "%M")); // Label, #Episodes | Label, #Episodes
+ AddSortMethod(SORT_METHOD_LASTPLAYED, 568, LABEL_MASKS("%T", "%p", "%T", "%p")); // Title, #Last played | Title, #Last played
AddSortMethod(SORT_METHOD_YEAR, 562, LABEL_MASKS("%L","%Y","%L","%Y")); // Label, Year | Label, Year
SetSortMethod(SORT_METHOD_LABEL);
Something went wrong with that request. Please try again.