Skip to content

Commit

Permalink
Merge pull request xbmc#1172 from koying/json-fix
Browse files Browse the repository at this point in the history
FIX: JSON-RPC: Setting the playcount does not produce expected announcement
  • Loading branch information
Montellese committed Jul 17, 2012
2 parents 92564dc + d7d9610 commit a6a5de0
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions xbmc/interfaces/json-rpc/VideoLibrary.cpp
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit a6a5de0

Please sign in to comment.