Permalink
Browse files

jsonrpc: force media item refresh after changing an item's details (f…

…ixes #13173)
  • Loading branch information...
1 parent 0ff0d2e commit cb3bcfcfeff76d13279b14d43cb71e2e39b9c6d7 @Montellese Montellese committed Oct 11, 2012
@@ -390,6 +390,7 @@ JSONRPC_STATUS CAudioLibrary::SetArtistDetails(const CStdString &method, ITransp
if (musicdatabase.SetArtistInfo(id, artist) <= 0)
return InternalError;
+ CJSONRPCUtils::NotifyItemUpdated();
return ACK;
}
@@ -432,6 +433,7 @@ JSONRPC_STATUS CAudioLibrary::SetAlbumDetails(const CStdString &method, ITranspo
if (musicdatabase.SetAlbumInfo(id, album, songs) <= 0)
return InternalError;
+ CJSONRPCUtils::NotifyItemUpdated();
return ACK;
}
@@ -481,6 +483,7 @@ JSONRPC_STATUS CAudioLibrary::SetSongDetails(const CStdString &method, ITranspor
if (musicdatabase.UpdateSong(song, id) <= 0)
return InternalError;
+ CJSONRPCUtils::NotifyItemUpdated();
return ACK;
}
@@ -21,6 +21,9 @@
#include "IClient.h"
#include "ITransportLayer.h"
+#include "FileItem.h"
+#include "GUIUserMessages.h"
+#include "guilib/GUIWindowManager.h"
#include "interfaces/IAnnouncer.h"
#include "utils/StdString.h"
#include "utils/Variant.h"
@@ -155,4 +158,13 @@ namespace JSONRPC
return ReadData;
}
+
+ class CJSONRPCUtils
+ {
+ public:
+ static inline void NotifyItemUpdated()
+ {
+ g_windowManager.SendThreadMessage(CGUIMessage(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_UPDATE, g_windowManager.GetActiveWindow()));
@pieh

pieh Oct 14, 2012

Member

Isn't it a little heavy and shouldn't we send GUI_MSG_UPDATE_ITEM to update single item? Worst case scenario, addon that updates each item's details (f.e. logo downloader) that will update details of f.e. 500 movies (will cause xbmc to 500 times update directory if we happen to be in media window)

@Montellese

Montellese Oct 14, 2012

Owner

Please read the discussion in the PR which covers this.

+ }
+ };
}
@@ -507,6 +507,7 @@ JSONRPC_STATUS CVideoLibrary::SetMovieDetails(const CStdString &method, ITranspo
videodatabase.SetPlayCount(CFileItem(infos), newPlaycount, infos.m_lastPlayed.IsValid() ? infos.m_lastPlayed : CDateTime::GetCurrentDateTime());
}
+ CJSONRPCUtils::NotifyItemUpdated();
return ACK;
}
@@ -544,6 +545,7 @@ JSONRPC_STATUS CVideoLibrary::SetTVShowDetails(const CStdString &method, ITransp
videodatabase.SetPlayCount(CFileItem(infos), newPlaycount, infos.m_lastPlayed.IsValid() ? infos.m_lastPlayed : CDateTime::GetCurrentDateTime());
}
+ CJSONRPCUtils::NotifyItemUpdated();
return ACK;
}
@@ -589,6 +591,7 @@ JSONRPC_STATUS CVideoLibrary::SetEpisodeDetails(const CStdString &method, ITrans
videodatabase.SetPlayCount(CFileItem(infos), newPlaycount, infos.m_lastPlayed.IsValid() ? infos.m_lastPlayed : CDateTime::GetCurrentDateTime());
}
+ CJSONRPCUtils::NotifyItemUpdated();
return ACK;
}
@@ -627,6 +630,7 @@ JSONRPC_STATUS CVideoLibrary::SetMusicVideoDetails(const CStdString &method, ITr
videodatabase.SetPlayCount(CFileItem(infos), newPlaycount, infos.m_lastPlayed.IsValid() ? infos.m_lastPlayed : CDateTime::GetCurrentDateTime());
}
+ CJSONRPCUtils::NotifyItemUpdated();
return ACK;
}
@@ -860,6 +864,8 @@ JSONRPC_STATUS CVideoLibrary::RemoveVideo(const CVariant &parameterObject)
videodatabase.DeleteEpisode((int)parameterObject["episodeid"].asInteger());
else if (parameterObject.isMember("musicvideoid"))
videodatabase.DeleteMusicVideo((int)parameterObject["musicvideoid"].asInteger());
+
+ CJSONRPCUtils::NotifyItemUpdated();
return ACK;
}

0 comments on commit cb3bcfc

Please sign in to comment.