I’d recommend taking a completely different approach. I’m not wild about the idea of creating Devices & Groups for your movies. If I were writing this, I’d create a single Kodi device & add a Movies
& SelectedMovie
attribute to it. Movies
can be an array of all of your movies & you could bind that to a GridView. That will be a little cleaner & more dynamic.
Kodi_Array.hrp (7.4 KB)
function onConnect() {
var movies = [{ Id: "1", Title: "Airplane", Thumbnail: "https://upload.wikimedia.org/wikipedia/en/2/21/Airplane%21_%281980_film%29.jpg" }, { Id: "2", Title: "Batman Begins", Thumbnail:"https://upload.wikimedia.org/wikipedia/en/a/af/Batman_Begins_Poster.jpg" }, { Id: "3", Title: "The Aviator", Thumbnail:"https://upload.wikimedia.org/wikipedia/en/f/fa/The_Aviator_%282004%29.png" }];
var kodiDevice = plugin.Devices[DEVICE_ID];
if (kodiDevice != null) {
kodiDevice.Movies = movies;
}
}
Take advantage of the new ItemsSource, TextMemberPath, SelectedValuePath, & IconMemberPath properties on the GridView.
NOTE: The current version does of IconMemberPath only supports display of images from the Images folder in the project. The next version I will try to add support for URL images from your Kodi server or from the web. This simulator screenshot showing the images was taken from my development build, not the current release build 3.0.21.