Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: JSONRPC queries

  1. #1
    Senior Member
    Join Date
    Mar 2017
    Posts
    253

    JSONRPC queries

    I’m developing a material style skin for LMS (using vue.js and vuetify.js). It’s not yet ready for serious use – as it has a few missing details such as sync and editing of the play queue (had a working version, but mobile browsers don’t support HTML5 drag’n’drop).

    For the music browsing side, I have most things working – at least what I mainly use; artists, genres, radios, apps, etc. However a few things have me stumped.

    1. How do I add an Artist, Album, or Genre to favourites? I thought [“favorites”, “add”, “artist_id:XXXX”, “title:ArtistName”] would work – but it does not. If I use the current web UI to add an artist as a favourite, then list this via ["favorites","items", 0,20, "want_url:1"] it returns {"id":"3","name":"Artist Name","type":"playlist","isaudio":1,"hasitems":1} And the web UI can navigate into this. How does this work?

    2. How do I get a TuneIn, Artist, or Album image for a favorite?

    3. I’d like to add configuring of the “Don’t stop the music” plugin – as this is one I use a lot. How do I get a list of the installed plugins? I can see the JSONRPC call to get a plugins config, and change it. But how can I check if a plugin is installed? For the DSTM plugin, how can I get a list of of its options (e.g. LastMix, etc) ?

    Thanks for any help.

    If anyone is interested, the code and current screenshots are at: https://github.com/CDrummond/lms-material

  2. #2
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    777
    Quote Originally Posted by cpd73 View Post
    1. How do I add an Artist, Album, or Genre to favourites? I thought [“favorites”, “add”, “artist_id:XXXX”, “title:ArtistName”] would work – but it does not. If I use the current web UI to add an artist as a favourite, then list this via ["favorites","items", 0,20, "want_url:1"] it returns {"id":"3","name":"Artist Name","type":"playlist","isaudio":1,"hasitems":1} And the web UI can navigate into this. How does this work?
    Note: this is from my own research, I haven't found any official docs..
    These are XMLBrowser based queries, which are designed for context menus / tree structures etc.. Items in the tree have an id, which "represents the hierarchical structure [...] using a dotted syntax similar to the one used in SNMP, like eg. 2.0.9.3."
    You'll need to provide an item_id with favorites add, which specifies where to add the favorite.
    With the 'favorites', 'items' query, you'll get those item ids.

    Or you can simply show the context menu in your UI and let LMS handle the logic (see the {track/artist/genre/album/folder/playlist/year}info queries)

    How do I get a list of the installed plugins?
    Use the systeminfo query

    But how can I check if a plugin is installed?
    Use a query like "can","dontstopthemusic", "dontstopthemusicsetting","?" to check for a specific plugin (command)

    For the DSTM plugin, how can I get a list of of its options (e.g. LastMix, etc) ?
    Use "dontstopthemusic", "dontstopthemusicsetting"
    Details see here

  3. #3
    Senior Member
    Join Date
    Mar 2017
    Posts
    253
    Thanks for the reply.

    I’ve already discovered the xmlbrowser stuff, but thanks. It was what URL to use when adding an artist, or album, from the local library. However, I’ve just noticed that if I go into editing a favorite as set by the web UI, I can see that it uses db:album.title=AlbumName as the URL to save an album as a favortite. So I can use this. Not sure how the web UI then gets the cover, but I can dig some more.

    Can’t find any systeminfo query – searched the CLI docs.

    As to DSTM, its the list of available options that I’d like to see – so I can show them in the UI. I know that ["playerpref", "plugin.dontstopthemusic : provider", "?"] shows the current setting – but I need the list of options (plus a mapping of this setting value to textual string).

  4. #4
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,118
    If you want to have the best support for the existing menus, you should invest in SlimMenu/SlimBrowse (http://wiki.slimdevices.com/index.ph...Play_interface). It's not an easy task, but would automatically give you all the menus there are. Otherwise there's no reliable method to get all the features you see in the menus.
    Michael

    http://www.herger.net/slim-plugins - Spotty, MusicArtistInfo

  5. #5
    Senior Member
    Join Date
    Mar 2017
    Posts
    253
    I've managed to get favourites working - with the exception of images. But good enough for now.

    As for DSTM, ["xx:xx:xx:xx:xx:xx", ["dontstopthemusicsetting",0,1]] provides exactly what I was looking for :-)

  6. #6
    Senior Member
    Join Date
    Mar 2017
    Posts
    253

    Play Band's Campout 'playlist'

    Whilst testing changes to my Skin, I've been playing with some apps. YouTube seems to be working (although it lists songs as hasitems:1 and isaudio:1, but when you navigate there is nothing). But I can't get Band's Campout to load a playlist. The playlist I'm talking about is under Band's Campout > Bandcamp weeklies > 'Some date' > Listen to songs (without comments) When I click on this my Skin issues (e.g.) ["aa:aa:bb:bb:cc:cc",["bandcamp","playlist","load","item_id:0.0.2"]] - but nothing is added. Why is this not working? What should the command be?

    Do I need to internally list all the items, and add to the queue one by one? If so, why? The YouTube app lists playlists, and these can be added with the above method.
    Last edited by cpd73; 2018-10-23 at 09:08.

  7. #7
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,118

    JSONRPC queries

    You really should try to implement SlimBrowse. You'd then not have to
    worry about services vs. radio vs. local content. You implement it once
    and for all. Just grab the menu and use the command it tells you to use.
    A new service comes up? You wouldn't even notice. It would just work.

    --

    Michael

  8. #8
    Senior Member
    Join Date
    Mar 2017
    Posts
    253
    Quote Originally Posted by mherger View Post
    You really should try to implement SlimBrowse.
    Do you have a simple example? I looked at the page before, but it doesn't make much sense to me. How would I use this in JavaScript? Or would it need implementing in the perl side?

  9. #9
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,118

    JSONRPC queries

    > Do you have a simple example? I looked at the page before, but it
    > doesn't make much sense to me. How would I use this in JavaScript? Or
    > would it need implementing in the perl side?


    I don't have a simple example, sorry. But it's basically a request to
    jsonrpc like all the others. Let me see whether I can find the not so
    simple example I must have lying around somewhere...

    --

    Michael

  10. #10
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,118

    JSONRPC queries

    Still haven't found the code I wrote a few years ago... but here's the
    quick summary:

    - request '{"id":0,"params":["<player mac>",["menu", 0, 100000,
    "direct:1"]],"method":"slim.request"}' to get the main menu. It defines
    "nodes", and menu items going in to these nodes. And each item comes
    with the command and params to use in order to get its sub-menu or
    trigger an action.

    - There would be an item "opmlmyapps", which defines its action as

    "actions": {
    "go": {
    "params": {
    "menu": "myapps"
    },
    "cmd": [
    "myapps",
    "items"
    ],
    "player": 0
    }
    },

    which means that ["myapps", "items", 0, 1000, "menu:1"] should give
    you the "My Apps" menu. Make sure to use the "menu:1" parameter to
    get menu definitions rather than raw data

    - you'd then parse those menus to decide how to act on them. Some might
    be simple menu items to show. Others might be radio buttons etc. That's
    where you'd have to get an understanding of the SlimBrowse protocol.

    --

    Michael

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •