Sonos Api: Is there a way to understand which Sonos favorite is playing? - sonos

I want to understand which favorite playlist is currently playing on my Sonos speaker.
I've tried the following options:
There's no favorite ID in playbackMetadata and in playbackStatus. So, matching with favorite ID doesn't work
There's containerId in playbackMetadata, which sort of gives information about provider-specific playlist identifiers. Yet, there's no same identifiers in getFavorites response. So, matching containerId won't work either.
Tried loadingFavorite (both with and without playOnComplete set), then getting playbackMetadata in order to build a mapping of favorite ID to containerId. No luck either. Even with 2s delay between two calls to give some space for favorite to be loaded, playlistMetadata returns old containerId (or it might be new, only it doesn't get changed for a new favorite).
Is there a straightforward option? Or not that straightforward, but working?

It is not possible, at least at the UPnP level. When a Favorite is submitted for playback, nothing is included that would allow tracking it back to its origin.

Related

How to find only original tracks on soundcloud

I am using soundcloud API for a project but the problem is I get remix of the original songs or cover version, its okay if I get remix and cover version but is there any mechanism that the original one comes as first song in the search result ? I tried searching on Google and read the API documentation but found nothing in this context.
The track object in soundcloud's API actually has the track_type property which has possible values of 'original' and 'remix' among other things. Sadly like most valueable metadata the track object has, content providers neglect to fill the field. So unless content providers start putting more effort into filling in the metadata fields the only option you have is giving songs priority based on words in the title or tags.

API key for themoviedb.org

I need to use themoviedb.org for one of the apps I am working on. For using the API, I need an API key. How do I get an API key on themoviedb.org?
I found this in the forum:
You can request an API key by clicking on the "API" link from within your account page on the left hand sidebar. See here
In terms of making things faster for people, the URL for application is here these days (Under Account>Settings>API as previously mentioned): https://www.themoviedb.org/settings/api
You'll want to start with a Developer key as wait time for a Developer key is zero (immediate). A commercial key, as far as I understand it, is only appropriate once the app is developed and running. Turnaround for a commercial API key is about 3 days-ish though obviously could vary.
Once you have a key, inside the doco pages there's a "Try It Out" tab which lets you do calls. The normal code flow (for getting movie details) would be something like:
Get Configuration (needed for image paths, should be cached)
Search Movies (returns a list, find the numeric id for the one you want in the list returned). Be aware there might be duplicates returned - you can use the year of release, title and language to find the one you want.
Get Movie Details with the movie numeric ID, with "append_to_response" of "credits,images,trailers" so that actors, writers, directors, and trailers (aka videos) are returned.
Check doco for how to find the actual image paths, using configuration values fetched above. It's generally considered courteous to copy the images you want to use to your own server rather than serving them from TMDB's server.

How to get reposted tracks from my activities?

Using the Souncloud API, I'd like to retrieve the reposted tracks from my activities. The /me/activities endpoint seems suited for this and I tried the different types provided.
However, I didn't find out how to get that data. Does anyone know?
Replace User Id, limit and offset with what you need:
https://api-v2.soundcloud.com/profile/soundcloud:users:41691970?limit=50&offset=0
You could try the following approach:
Get the users that shared a track via /tracks/{id}/shared-to/users endpoint.
Fetch the tracks postet by this user via /tracks endpoint, as the _user_id_ is contained.
Compare the tracks metadata with the one you originally posted.
I am not into the Soundcloud API, but taking a close look at it seems to make this approach at least as technical possible, though e.g. fetching all tracks won't be a production solution, of course. It's more a hint. Perhaps reposting means something totally different in this context.
And the specified entpoint exists in the general api doc, so I don't know if you would have to extend the java-api-wrapper for using it.

Does Deezer APIs track method return unreliable results?

Here are some example (setting italy as country):
http://api.deezer.com/2.0/track/2566127 says the track is not readable, but I can play it both from deezer.com and from an API app, the same for http://api.deezer.com/2.0/track/7960580
http://api.deezer.com/2.0/track/3259613 says the track is not readable, it is actually not existent (and usually for not existent track the API return error)
Some other times a track (which used to exist) results as not existent (e.g. http://api.deezer.com/2.0/track/17737916 Beatles - Till There Was You) both from API and deezer.com player (http://www.deezer.com/it/track/17737916) BUT if I search the song using the tile from deezer.com I can see that the track is available with a new id (APIs don't give me the "alternative" id, though).
Am I doing something wrong or the APIs responses are sometime just nor reliable?
Tracks in the Deezer API have now an "alternative" field as well as "available_countries" to deal with those country availability issues. You can check it in the API Explorer.
This is however not working for deprecated track ids, because queries on unexisting tracks will just result in a DataException. You could use ISRC codes to work around that, that we now provide as well. Hope this helps.

YouTube API v3.0: How do you determine if a video is 'pay-per-view'?

I am using the YouTube Python API (v3.0) to query YouTube with specific video IDs, and I would like to know which ones of the videos listed in the results are paid-content (there are some TV-shows in there).
I have gone through the 'video' object parameters (https://developers.google.com/youtube/v3/docs/videos), but I have not been able to find anything useful:
'contentDetails.licensedContent' flag does not seem to match non-free videos
'status.license' seems to be almost always set to 'youtube'
'status.embeddable' also does not seem to depend on free/not-free
Any suggestions or solutions are welcome!
There's no field in the youtube#video object that represents whether a specific video costs money. You could use a rough proxy, like the presence of youtube#video.contentRating, as a clue that the video might be something that's television/film content, but that doesn't necessarily mean that it's paid content.