How to Parse a Smart Playlist
#1
Hello,

I would like to parse the various entries in a Kodi Smart Playlist (video). Say I want to find out everything in a Smart Playlist named "Favorite Movies" that is in the /Playlist/video. Is there a way to parse a Smart Playlist by name? Are there any examples of doing this anywhere? Could someone maybe show me what I need to do Python-wise?

Thank you,
Mark
Reply
#2
There is a JSON API call to get the items of a playlist:

https://kodi.wiki/view/JSON-RPC_API/v8#P...t.GetItems

Here's a code snippet from one of my addons that makes a JSON call (not the one you need, but it's a start) and gets data back from it:

python:
 
import xbmc, json

response = xbmc.executeJSONRPC (
      '{"jsonrpc":"2.0", "method":"Player.GetItem", "params":{"playerid":0, "properties":["artist", "musicbrainzartistid"]},"id":1}' )
artist_names = json.loads( response ).get( 'result', {} ).get( 'item', {} ).get( 'artist', [] )
Reply
#3
(2020-03-11, 18:27)pkscout Wrote: There is a JSON API call to get the items of a playlist:

https://kodi.wiki/view/JSON-RPC_API/v8#P...t.GetItems

Here's a code snippet from one of my addons that makes a JSON call (not the one you need, but it's a start) and gets data back from it:

python:
 
import xbmc, json

response = xbmc.executeJSONRPC (
      '{"jsonrpc":"2.0", "method":"Player.GetItem", "params":{"playerid":0, "properties":["artist", "musicbrainzartistid"]},"id":1}' )
artist_names = json.loads( response ).get( 'result', {} ).get( 'item', {} ).get( 'artist', [] )

Thank you for the direction and help. I have looked at the link for the json request that you shared and I still have a question, if you will.....How do you specify the playlist that you want to parse if you have 50 playlists in the directory? Are they each given an integer value from like 0 to 49?
Reply
#4
not tested, but i think you can get those by making a Playlist.GetPlaylists request.
https://kodi.wiki/view/JSON-RPC_API/v8#P...tPlaylists
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply

Logout Mark Read Team Forum Stats Members Help
How to Parse a Smart Playlist0