[REQUEST] Last.FM AutoDJ Plugin or Script that plays similar music tracks or artists? - Printable Version
+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Help and Support (/forumdisplay.php?fid=33)
+--- Forum: Add-ons Help and Support (/forumdisplay.php?fid=27)
+---- Forum: Music Add-ons (/forumdisplay.php?fid=148)
+---- Thread: [REQUEST] Last.FM AutoDJ Plugin or Script that plays similar music tracks or artists? (/showthread.php?tid=71602)
Pages: 1 2
[REQUEST] Last.FM AutoDJ Plugin or Script that plays similar music tracks or artists? - bblauritzen - 2010-04-06 15:43
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??
- Necromancyr - 2010-04-06 16:37
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.
- jw76 - 2010-05-18 03:17
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
That's such a good idea - nzskater - 2010-05-18 04:37
As a consumer I would REALLY like this feature.
- jevers - 2010-10-08 18:33
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.
- ErlendSB - 2010-10-20 10:55
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.
- spiff - 2010-10-20 11:01
xbmc already has an api key for last.fm - you can use that. see e.g. the lastfm scraper.
- ErlendSB - 2010-10-20 11:11
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?
- spiff - 2010-10-20 11:17
yeah, we have no special terms so the tos must be respected. shouldn't be all that much of a limitation though?
- ErlendSB - 2010-10-20 11:33
(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.