Spotify API: Album name appears multiple times in a single query - api

I am receiving several multiple album names from the query listed below. I want to know if there is a way of receiving only one instance of the album name.
http://ws.spotify.com/lookup/1/?uri=spotify:artist:3TVXtAsR1Inumwj472S9r4&extras=album

Unfortunately, no.
Artists very often have multiple releases of the same album, for various reasons. Normally, it's slightly different versions of the album for different areas of the world - indeed, in the example you give the territories key has different values for each duplicate.
Depending on your use case, you need to deal with this correctly. If you're suggesting albums for a user to listen to, you need to make sure the album is available in the territory the user is in.
If you're just listing albums on a static page and not linking to them, putting the list of names though a set to thin out the duplicates would be sufficient.

Related

Showing relevant songs based on user data

I have this app where I have the genre of music that the user is liking and whenever a user listens to a song he rates it.I want to show them the most relevant songs that the users might like.How do I carry on the database schema?What all data should I take from a user and how to get the most relevant song for the particular user?
Clear Explanation is appreciated.
This is a very active field of research known as recommender systems. If you wish to deal with it seriously, database design is only a first step; you will need to think about a suitable algorithm etc. Your question was specifically about the database schema, so I recommend the following readings:
RecDB in Action: Recommendation Made Easy in
Relational Databases
Recommender system datastructures
Are you recommending the user songs based on his ratings only? In that case, you might need every user in your database to rate at least a few songs. If a user has not yet rated any songs (maybe he signed up for your application recently), you will not be able to recommend him any song. This problem, is called "The Cold Start Problem".
Coming to the question, you can group songs by either genre, artist, album, year or you can take any combination of these parameters. So, your Songs table will have these values along with name of the song, and probably a unique ID. Users table can be as small as UserID and name or you can include his age, location so that you can recommend him songs based on other user's likings with similar age and location.
There would also be a User-Song map table that contains the ratings that every user gives different songs (one-to-many mapping). This table can be used to find a user's favourite song(s)

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 can I extract artist and song information from Youtube music videos?

I know "extracting song or artist names from Youtube" is not possible by using Youtube's data API. However, I have found several websites that have extracted the artist or song names successfully. I guess they are using machine learning or something else.
Is there any common practice to extracting those artist or song names?
You can extract artists and song titles from extra description, though there is one downside, the extra information may not appear in some countries (outside of United States), so you will need a proxy that is located in U.S, you can use Yahoo's YQL service to avoid this issue. The DIV element "watch-description-extra-info" will have all the extra information you need.

Soundcloud API - Pull Artist Name and Song Title Separately?

Looking through the Soundcloud documentation - it doesn't appear that you can pull the artist name and the song name separately (or am I missing something?):
http://developers.soundcloud.com/docs/api/reference#playlists
ie:
for song https://soundcloud.com/yaz-francis-1/pompeii-bastille
Artist: Bastille
Song: Pompeii
Is it just combined in the tracktitle (title)? User is also not always the song artist name, but the username of the person who posted it to soundcloud.
If not, is there anyway to pull Artist Name and Song separately?
Any help would be greatly appreciated - thanks!
Best,
JP
Well the API doesn't give you the fields separately, but depending on your application there might be a way to get that data anyway.
I have written a webapp using the Soundcloud API and I am actually extracting the artist name separately. If you're interested, I can tell you howI did it.
You need to apply some NLP-tricks and use regular expressions.
I'm in the process of building a Web app for a client who owns a record label and wants to publish 5000+ songs of varying artists and albums. I have diaected the api to death and found the best way to tie a track to an artist is by using tags. This way you can also search by the artist name and get results in the api. In my particular case I am using machine tags to store the artist, album and track name. I also store another tag as a key for finding only tracks that match that key so on my Web app I don't get tracks from other users, since you can't filter results by tags and genre when getting tracks from a specific user.
It's a but messy but it works. So something like this to get all songs by this artist on my Web app from a specific users account
/tracks.json?client_id=xxx&q=app:key=uniqueid&tags=app:artist=artist+name
You can also throw genre in there too if you wanted. Hope this was helpful

Using APIs to Filter Albums by Years

So I'm working on an application that has a feature that generates a list of 100 or so artists that are similar to those in the user's music catalog using the Echo Nest API. Then, a user can supply a certain year, and, based on the similar artists, the application will return a list of albums that were released on that year.
The only problem is that I have no idea how to filter albums based on year. The Echo Nest API doesn't really do much with albums. The Discogs and Last.fm APIs work with albums, and the Discogs API has data about albums' release dates, but there is no way to filter an initial query by release date. For example, if I have the artist Fleet Foxes and I want to filter it by albums released in 2011, there is no option to search for albums by the Fleet Foxes confined to release dates of 2011.
The only option I can really see at this point is iterating over EVERY album an artist has and only adding those albums that meet my specifications. However, this is obviously very heavy on both the APIs and my server, especially considering that many of the artists in the list of 100 similar artists will have no albums that match my criteria and that many artists have well within the range of 100 albums when you take into consideration singles, remixes, etc.
Does anyone see a better way of doing this?
If an API really doesn't have any way to filter by year, then yes, of course you will have to pull down all of the releases and filter them after the fact.
If you think this is a burden on your code and/or their server, you should file a feature request to add the filtering.
However, you should make sure first that they really don't provide such a thing. Most REST APIs separate "fetch" and "search". For example, http://api.example.com/artists/12345/releases may not have any way to filter it, but http://api.example.com/search?type=releases&artist=12345&year=2011 may exist.
Without looking into all of the APIs in detail, a quick check of Discogs' "Run a search query" docs shows that you can include a year criterion in the search (although it looks like maybe you can't actually search by artist ID, just by artist name?).