Volumio - Play specific track via REST API - raspberry-pi

Using the REST API -https://volumio.github.io/docs/API/REST_API.html
Is there a method to play a specific track?
eg .
volumio.local/api/v1/commands/?cmd=playplaylist&name=Rock
But use a track name instead of a playlist.

Related

How to get live video id from YouTube channel

YouTube API eventType=live not working, does anyone have an idea why?
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCmyKnNRH0wH-r8I-ceP-dsg&eventType=live&type=video&key=
Without eventType was working fine (but not now):
https://www.youtube.com/embed/live_stream?channel=UCmyKnNRH0wH-r8I-ceP-dsg&autoplay=1
Looks like YouTube changed something in API, search.list really not returning live broadcast since end of last week.
If you have user's access token you can use https://www.googleapis.com/youtube/v3/liveBroadcasts?part=snippet&broadcastStatus=active&broadcastType=all
endpoint to retrieve if any broadcast is live.
If you do not have user's access token, you can try this answer
but i didn't check it if it is working
Anyway this question looks like to be a duplicate of this question
Right now the YouTube API is not working, specifically for retrieving live streams of a specific channelId. In other words if you are setting channelId in the API call, you will get 0 results.
If you're using an API key rather than OAuth (not sure if OAuth works) the only work around at the moment is to use the API to search for a specific title. Here is my query URL below.
https://www.googleapis.com/youtube/v3/search?part=id%2Csnippet&type=video&maxResults=20&order=date&q=My+Uniquely+Titled+Livestream&key=[apiKey]
The results returned by the API will be from all of YouTube. (Note: the rest is done serverside) Put the results into an array and discard any that don't match your channelId. Then check the titles in an array and only get the video ID of the one that matches your desired title. That is the basic logic and it is sort of a rigid work around that won't work for most. But at least it will get you what you need until Google fixes the API.

Retrieving the "recommended" playlist via API call?

for any given song, e.g.
https://soundcloud.com/shesthequeen/i-dont-wanna-know
SoundCloud has a "recommended" playlist that usually start playing after that song is finished:
https://soundcloud.com/shesthequeen/i-dont-wanna-know/recommended
How can I retrieve this "recommended" playlist via the SoundCloud API? Is there a way? Which connector should I use? I'd like to avoid scraping HTML.
Thanks in advance,
Mary
Looks like that this will be a new subresource of the upcoming tracks endpoint in the next API version.
GET /tracks/{id}/related
These are the API calls:
https://api-v2.soundcloud.com/tracks/102113299/related?anon_user_id=36331428&limit=10&offset=0&linked_partitioning=1
https://api-v2.soundcloud.com/tracks/102113299/related

How to stream SoundCloud at a different speed or tempo?

From the SoundCloud API Guide, this is how to get the streaming URL of a sound:
import soundcloud
# create a client object with your app credentials
client = soundcloud.Client(client_id='YOUR_CLIENT_ID')
# fetch track to stream
track = client.get('/tracks/293')
# get the tracks streaming URL
stream_url = client.get(track.stream_url, allow_redirects=False)
# print the tracks stream URL
print stream_url.location
Is there any way to command the API to return a URL for the sound at a different speed or better yet, at a different tempo?
Thats not a feature from SoundClouds API. You need to somehow analyze your track to change the tempo / speed / bpm. For that you can use the EchoNest / Spotify APIs.
Check this question:
How to get BPM and tempo audio features in Python
If you change to JavaScript you can use the browser built-in WebAudio / WebMIDI API on Chrome and/or FireFox.
API description by Mozilla:
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API
Examples by Google:
http://webaudiodemos.appspot.com/
Hackday project based on Samplr + SoundCloud API using WebAudio + WebMIDI (Chrome only):
http: // dope-dj-culture.com/ No longer a valid URL.

User specific tracks search using soundcloud api

Is there a way to make user specific track search using the soundcloud api? This is a sample api call url that returns various track results from other all of soundcloud, which is not the desired result.
https://api.soundcloud.com/users/CLIENT_USER_NAME/tracks?q=SEARCH_TERM&client_id=CLIENT_ID
You can use SC.get to return all of a particular user's tracks, e.g.
SC.get('/users/id/tracks', function(tracks){
// Do stuff
});
http://developers.soundcloud.com/docs/api/reference#users
To get the user id, you can use resolve:
http://developers.soundcloud.com/docs/api/reference#resolve
No you cannot search a specific user's tracks. The documentation is wrong in this case.

Order by playbacks when fetching tracks from SoundCloud

I am fetching a list of tracks from soundcloud's API using the following query to retrieve the 5 most popular tracks:
https://api.soundcloud.com/tracks?client_id=XXX&order=hotness&limit=5
But recently SoundCloud removed the hotness order. In the blog post they say tracks can instead be sorted by playback_count. But can this be done in the query or do they suggest I pull down the whole SoundCloud library and order them in the client? The following doesn't seem to work:
https://api.soundcloud.com/tracks?client_id=XXX&order=playback_count&limit=5
So how would one retrieve the top tracks on SoundCloud?
The solution was to use the undocumented calls for the explorer feature that SoundCloud itself uses (I used the dev tools in Chrome to check the AJAX calls).
https://api.soundcloud.com/explore/sounds/category?limit=L&client_id=XXX
This appears to use some sort of sorting on the popularity of the songs. The songs can then be filtered on only music by checking the "grouping" attribute. I then have to resolve the list of IDs to actual songs which can be done with the (documented, official) API call:
https://api.soundcloud.com/tracks?ids=1,2,3&client_id=XXX
This seems to work perfectly and I also get the added benefit of an even distribution among genres. But of course, this can stop working at any moment since the API calls are undocumented and perhaps not meant for public use.
Just wanted to provide an update. It seems soundcloud has moved to v2 of the explore API call.
Use this to get a list of categories:
https://api.soundcloud.com/explore/v2
And this to get tracks from a category:
https://api-v2.soundcloud.com/explore/metal?limit=10&offset=0
So far it seems to without a key, although I have no idea how long that will last.
EDIT: So the 2nd url doesn't seem to allow cross-origin, but so far this does work, though it only returns the trackID not the full information
https://api.soundcloud.com/explore/v2/metal?limit=50&consumer_key=XXX
check here, soundcloud removed order by hotness.
Has order by hotness been removed from Soundclouds API
so, for now, only order by date is possible.