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

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??

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.
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
As a consumer I would REALLY like this feature.
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.
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.
xbmc already has an api key for last.fm - you can use that. see e.g. the lastfm scraper.
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?
http://www.last.fm/api/tos 4.4
yeah, we have no special terms so the tos must be respected. shouldn't be all that much of a limitation though?
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.
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
There has been some progress on this script.
Try it out:


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

Logout Mark Read Team Forum Stats Members Help
[REQUEST] Last.FM AutoDJ Plugin or Script that plays similar music tracks or artists?1
This forum uses Lukasz Tkacz MyBB addons.