Thread Rating:
  • 1 Vote(s) - 5 Average
[REQUEST] Last.FM AutoDJ Plugin or Script that plays similar music tracks or artists?
#1
Lightbulb 
Request.

Last.FM AutoDJ script for the music library.

Let me explain

When you start playing a song it query's (through the Last.FM API) "track.getSimilar" http://www.last.fm/api/show?service=319 , then sweeps through your library to find a match and then appends the matched song to the playlist. If there isn't any track similarity then it query's "artist.getSimilar" http://www.last.fm/api/show?service=119 and appends a song from the artist that comes closest.

That way you could start listening to one song and the script will create the playlist for you based on your first choice.

I'm currently using MediaMonkey as my music player, been meaning to use XBMC (one program for all media would be much easier) but i really miss that feature.

This feature works best on a well grown music library.

Any programmers up for the challenge??

---
B.B.Lauritzen
Reply
#2
This is similar to Pandora, but with a local library, and similar to the 'Smart Playlist' feature available in...uhm...can't recall now (the company was bought out, but basically it scanned all your music and then could generate smart lists of similar music based on a seed song).

This seems like a good way to get around the need for a massive backend database for music 'similarity' storing/scoring.
Reply
#3
i think i am going to take a crack at the following..

A simple script that reads the current artist and track info that is playing in XBMC, passes this info off the last.fm api, requesting similar artist and tracks. The script will then search the music db for artists or songs that match the API response. If a match is found, track is appended to current music queue.

So querying the last.fm api is fairly straightforward, and existing libraries exist to do this.

Not sure about the XBMC side of things.

- how can python scripts interact with the database? Which is preferred json , web api, or directly with the sqllite library?
- Is it possible to control a playlist from a script? Can the script continually run in the background while playing music?

edit #1 - getting current artist / song
http://wiki.xbmc.org/index.php?title=HOW...aying_song
Reply
#4
As a consumer I would REALLY like this feature.
Reply
#5
This is also something I'd like to be able to run. Curious if there was any progress made on this script? I'd like to take a shot at implementing something or expanding on something else already implemented.
Reply
#6
I've started working on this script and have made some progress, but there are a few snags:

The Last.FM api requires an API key. I have acquired my own for testing purposes, but this might be a bit of a show-stopper if we're to make this into a user friendly addon.

I query similarTrack recursively until the playlist has 25 items after 5 tries.
This is a bit time consuming and it might exceed the traffic limits stated in the api eula.

The script is far from finished, but if someone wants to try it out, you can find the script here: http://code.google.com/p/lastfmplaylistgenerator/
Feel free to modify/improve and please share your thoughts/code.
I'm just trying to learn python, so development is slow and the code probably needs a good cleanup.

Note that you'll have to modify the script to add you own api key.
Reply
#7
xbmc already has an api key for last.fm - you can use that. see e.g. the lastfm scraper.
Reply
#8
That's great!

Is there a public property I can access through python to get to the key? (scraper - gotcha)

Do I need to take into consideration the number of queries I do against the api with this key?
ref:
http://www.last.fm/api/tos 4.4
Reply
#9
yeah, we have no special terms so the tos must be respected. shouldn't be all that much of a limitation though?
Reply
#10
You're right.

(Re)read this line:
Quote: You will not make more than 5 requests per originating IP address per second, averaged over a 5 minute period

To generate a new playlist, I expect to quickly post up to 5 request.
So unless you want to generate a new playlist every min or so, it should be fine.
Reply
#11
Any progress on your addon?

Starting to jump into the music section of XBMC and add all my tunes.. something like this would be perfect when hosting a party
Reply
#12
There has been some progress on this script.
Try it out:
http://forum.xbmc.org/showthread.php?tid=83915

or

http://code.google.com/p/lastfmplaylistgenerator/
Reply
#13
Thanks, was hoping to find something similar to what was described in this thread.. rather than building an entire playlist, only query for the next 1-2 tracks to play based on the current song - changes if I manually select a different song
Reply



[REQUEST] Last.FM AutoDJ Plugin or Script that plays similar music tracks or artists?51