Closed darkphoenix closed 3 years ago
After some further looking through the code, it appears the alwaysArray logic is still there - but the parameter pass for getSong, getArtist, and getAlbum specifically got stripped out in 7358c20, for some reason, so it breaks for those functions. I've only recently updated from my own branch to develop again, and I only now tried to use one of those clients again, hence why it presumably got through unnoticed at the time?
i see it in master too. the overrides are where it should stay so i'll revert that now
5e7cf1017 puts an empty array in as it doesn't need to check for any arrays. b2495848a fixes up getalbum and getartist as well
i'll do another check (i also didn't realise the demo for subsonic was available so that's going to help!)
demo and develop sites updated (added to master with a0e367f21)
I see you reduced the arrays somewhat based on the actual response - that's a good bit neater than what it originally was, to be honest, I just took the global alwaysArray list and removed the respective items. Anyway, thanks for the quick response! And the demo site was really just a spontaneous idea, when I was testing I didn't remember the correct syntax and the official API spec page only had XML examples, so I picked a random song from the actual demo as an example :P
I figure if you aren't going to array anything we should reduce the foreach to the minimum.
i always use the subsonic api website where the examples are all xml so it'll be good to have that as a backup now.
Please try and break anything else you can in subsonic because that's a really important feature to maintain.
I'll try my best :D
I'm back to another setup where I use Mopidy for music, which relies on py-sonic and therefore the JSON API - so I figure if more stuff breaks I'll stumble over it sooner or later. For now everything I've tried seems to work with this bit fixed, so I think this can be closed - if I find something else I'll come back with another issue.
that's good then, thanks for the detail on this and making it easy to fix.
It appears the issues I described in #1829 have resurfaced, presumably because my (admittedly not that pretty) fix from back then got edited out along the way - see https://develop.ampache.dev/rest/getSong.view?u=demo&p=demodemo&v=1.10.0&c=hi&id=1&f=json vs the correct http://demo.subsonic.org/rest/getSong.view?u=guest&p=guest&v=1.10.0&c=hi&id=216&f=json - there should not be an array there. I'm not sure if there is a more elegant way than explicitly passing whether or not to create single element arrays, as I did in PR #1830 at the time, but something definitely needs to be done as this appears to break at least some functionality in every client using the JSON version of the API, including at least the py-sonic library (and as a result, the ability to use Mopidy and a few other players that support Subsonic as a backend).