From d51ec760e37f71417e48ad541d1c2872c13e1d01 Mon Sep 17 00:00:00 2001 From: cere Date: Wed, 21 Feb 2024 03:38:54 -0500 Subject: [PATCH] version bump, update deprecated functions that spam my log (lol) --- addon.xml | 2 +- resources/lib/plugin_content.py | 40 ++++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/addon.xml b/addon.xml index 466c29e..d14becb 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/resources/lib/plugin_content.py b/resources/lib/plugin_content.py index 3fcc03c..9cc4cbf 100644 --- a/resources/lib/plugin_content.py +++ b/resources/lib/plugin_content.py @@ -232,19 +232,33 @@ class PluginContent: li = xbmcgui.ListItem(label, offscreen=True) li.setProperty("isPlayable", "true") - li.setInfo( - "music", - { - "title": title, - "genre": track["genre"], - "year": track["year"], - "tracknumber": track["track_number"], - "album": track["album"]["name"], - "artist": track["artist"], - "rating": track["rating"], - "duration": duration, - }, - ) + # Kodi 19 legacy code + # Unsure how to detect Kodi version so I'll leave this here for those stuck in the past + # li.setInfo( + # "music", + # { + # "title": title, + # "genre": track["genre"], + # "year": track["year"], + # "tracknumber": track["track_number"], + # "album": track["album"]["name"], + # "artist": track["artist"], + # "rating": track["rating"], + # "duration": duration, + # }, + # ) + + # Kodi 20+ Equivalent + limus: xbmc.InfoTagMusic = li.getMusicInfoTag() + limus.setTitle(title) + limus.setAlbum(track["album"]["name"]) + limus.setGenres([track["genre"]]) + limus.setYear(track["year"]) + limus.setTrack(track["track_number"]) + limus.setArtist(track["artist"]) + limus.setRating(track["rating"]) + limus.setDuration(duration) + li.setArt({"thumb": track["thumb"]}) li.setProperty("spotifytrackid", track["id"]) li.setContentLookup(False)