Permalink
Browse files

FIX: JSON-RPC: Setting the playcount does not produce expected announ…

…cement
  • Loading branch information...
1 parent 92564dc commit d7d9610212718a92b51162a9f62ad830fbf41993 @koying committed Jul 17, 2012
Showing with 24 additions and 4 deletions.
  1. +24 −4 xbmc/interfaces/json-rpc/VideoLibrary.cpp
@@ -350,7 +350,12 @@ JSONRPC_STATUS CVideoLibrary::SetMovieDetails(const CStdString &method, ITranspo
return InternalError;
if (playcount != infos.m_playCount || lastPlayed != infos.m_lastPlayed)
- videodatabase.SetPlayCount(CFileItem(infos), infos.m_playCount, infos.m_lastPlayed.IsValid() ? infos.m_lastPlayed : CDateTime::GetCurrentDateTime());
+ {
+ // restore original playcount or the new one won't be announced
+ int newPlaycount = infos.m_playCount;
+ infos.m_playCount = playcount;
+ videodatabase.SetPlayCount(CFileItem(infos), newPlaycount, infos.m_lastPlayed.IsValid() ? infos.m_lastPlayed : CDateTime::GetCurrentDateTime());
+ }
return ACK;
}
@@ -382,7 +387,12 @@ JSONRPC_STATUS CVideoLibrary::SetTVShowDetails(const CStdString &method, ITransp
return InternalError;
if (playcount != infos.m_playCount || lastPlayed != infos.m_lastPlayed)
- videodatabase.SetPlayCount(CFileItem(infos), infos.m_playCount, infos.m_lastPlayed.IsValid() ? infos.m_lastPlayed : CDateTime::GetCurrentDateTime());
+ {
+ // restore original playcount or the new one won't be announced
+ int newPlaycount = infos.m_playCount;
+ infos.m_playCount = playcount;
+ videodatabase.SetPlayCount(CFileItem(infos), newPlaycount, infos.m_lastPlayed.IsValid() ? infos.m_lastPlayed : CDateTime::GetCurrentDateTime());
+ }
return ACK;
}
@@ -422,7 +432,12 @@ JSONRPC_STATUS CVideoLibrary::SetEpisodeDetails(const CStdString &method, ITrans
return InternalError;
if (playcount != infos.m_playCount || lastPlayed != infos.m_lastPlayed)
- videodatabase.SetPlayCount(CFileItem(infos), infos.m_playCount, infos.m_lastPlayed.IsValid() ? infos.m_lastPlayed : CDateTime::GetCurrentDateTime());
+ {
+ // restore original playcount or the new one won't be announced
+ int newPlaycount = infos.m_playCount;
+ infos.m_playCount = playcount;
+ videodatabase.SetPlayCount(CFileItem(infos), newPlaycount, infos.m_lastPlayed.IsValid() ? infos.m_lastPlayed : CDateTime::GetCurrentDateTime());
+ }
return ACK;
}
@@ -455,7 +470,12 @@ JSONRPC_STATUS CVideoLibrary::SetMusicVideoDetails(const CStdString &method, ITr
return InternalError;
if (playcount != infos.m_playCount || lastPlayed != infos.m_lastPlayed)
- videodatabase.SetPlayCount(CFileItem(infos), infos.m_playCount, infos.m_lastPlayed.IsValid() ? infos.m_lastPlayed : CDateTime::GetCurrentDateTime());
+ {
+ // restore original playcount or the new one won't be announced
+ int newPlaycount = infos.m_playCount;
+ infos.m_playCount = playcount;
+ videodatabase.SetPlayCount(CFileItem(infos), newPlaycount, infos.m_lastPlayed.IsValid() ? infos.m_lastPlayed : CDateTime::GetCurrentDateTime());
+ }
return ACK;
}

0 comments on commit d7d9610

Please sign in to comment.