Soundcloud sets and http post api


#1

I’m using the http post api to load and play tracks using the following curl commands below. The first track in the set plays, but next just restarts the first track. Any ideas why this isn’t working?

curl -d '{"jsonrpc": "2.0", "id": 1, "method": "core.tracklist.add", "params": {"uri": "sc:https://soundcloud.com/mattholland/sets/deep-crates"}}' -H 'Content-Type: application/json' localhost:6680/mopidy/rpc

curl -d '{"jsonrpc": "2.0", "id": 1, "method": "core.playback.play", "params": {}}' -H 'Content-Type: application/json' localhost:6680/mopidy/rpc

curl -d '{"jsonrpc": "2.0", "id": 1, "method": "core.playback.next", "params": {}}' -H 'Content-Type: application/json' localhost:6680/mopidy/rpc

Also, is there any documentation about the soundcloud uri scheme? I’ve found the documentation at https://docs.mopidy.com/en/latest/api/backend/#backend-api but it seems to imply knowledge gained from somewhere else. For example soundcloud:song. works for me but it’s not mentioned in that link (found it with some googling).


#2

The Mopidy documentation does not document the uri schemes for backend extensions. The uri schemes are generally ad-hoc and extension specific.

Since there is no documentation for mopidy-soundcloud, the source code is the only resource. But (if I remember correctly) prefixing ‘sc:’ to arbitrary Soundcloud website URLs is not supported like it is for some extensions. This is primarily because the Soundcloud API and website are entirely separate beasts and there is not always a simple mapping between them (I’m not saying there isn’t in the particular case of sets, I don’t remember). Without a mapping back to the API endpoint you’d have to parse the HTML web page for the data and that’s a non-starter in my opinion.

Also note that Soundcloud do not provide any public documentation for their API. However, you can explore what’s available by doing manual requests. Take a look at mopidy-soundcloud source files if you need a place to start.

If you find this is now outdated or you can improve upon mopidy-soundcloud then PRs are very welcome.


#3

Thanks very much for the reply! I actually have just now been making progress on adding sets to the tracklist, using a more trimmed down test soundcloud set, so it seems the problem I was having was specific to my playlist itself and not the syntax of the command.

I suspected that the source code was the only documentation but it’s good to have confirmation. I’d love to help with PRs but I am quite green at Python and no experience so far at contributions to open source projects. Perhaps once I know my way around better and have some simpler projects under my belt.


#4

If you are interesting in contributing there some info at https://docs.mopidy.com/en/latest/contributing/ some of which is likely relevant to other projects too. Documentation contributions are a good way to start and just as valuable as code.

There’s also https://docs.mopidy.com/en/latest/devenv/ to help people get going.


#5

Thanks you for the links, I will look into it.