Help! as a Glitch newbie (and a JS newbie and nearly everything else) I’m getting stuck trying to get my project to make RPC calls to my Kodi server.
I’m trying to find the Album ID for a Fleet Foxes album. The RPC call works from a browser window, but when I use the same structure in Glitch I get this log entry:
Command sent = {“jsonrpc”:“2.0”,“id”:1,“method”:“AudioLibrary.GetAlbums”,“params”:{“limits”:{“start”:0,“end”:50},“properties”:[“playcount”,“artist”,“genre”,“rating”,“thumbnail”,“year”,“mood”,“style”],“filter”:{“field”:“album”,“operator”:“is”,“value”:“Fleet Foxes”},“sort”:{“order”:“ascending”,“method”:“album”,“ignorearticle”:true}}}
Interesting, Gareth - can you please tell me more? The quotes are inserted by a function called json.stringify (from another library). Most of the code was written by Omertu - I’m just trying to cannibalise it to play albums rather than movies.
the Javascript for the original parameter string looks like this:
var kodiPlayAlbum = function(request, response,param, id) {
var AlbumTitle = request.query.q.trim();
// Build filter to search library for this album
It’s probably not the issue then, given the code above, otherwise you’ll be seeing lots of errors in your logs. I just meant that the quotes should be "" not “”, but that’s probably introduced by the forum when you’re pasting in code outside of a code block. It’d be handy if you’re able to share the project you’re using, so we can take a look at the code in context.
The Kodi username passwords I stored in Glitch in the .env file included capital letters - because that was how I had set up the Kodi implementation. If I set the username and password in .env to all lower case, my call is executed, or attempted to be executed in Kodi. I can get Kodi to execute a ‘Stop’ RPC (which is pretty simple) but I’m still struggling to get it to execute a ‘GetAlbums’ RPC - log entry below.
Command sent = {“jsonrpc”:“2.0”,“id”:1,“method”:“AudioLibrary.GetAlbums”}
8:45 PM
TypeError: Cannot read property ‘length’ of undefined
8:45 PM
at Fuse._startSearch (/app/node_modules/fuse.js/src/fuse.js:170:23)
8:45 PM
at Fuse.search (/app/node_modules/fuse.js/src/fuse.js:141:10)
8:45 PM
at /app/server.js:306:27
8:45 PM
at process._tickCallback (internal/process/next_tick.js:109:7)
8:45 PM