View Full Version : MusicIP Mixer (MusicIP.com, similar to Last.fm)
iamchrismoran
2008-02-11, 06:16
I'm not sure off hand about their licensing, but it would be cool to have the MusicIP Mixer plugin working for XBMC's music, where you select a song and based on some generated db of track info, it can generate a playlist "music like this".
I have the standalone player for the PC and and it's built into WinAMP (or is a plugin, I forget). I've seen requests for "smart" playlists, but I'm not sure if that's the same thing.
gilgongo
2008-08-24, 12:31
Hi - I've been using the open source SwissCenter (http://www.swisscenter.co.uk/) project for the ShowCenter 200, and they have a plugin that integrates MusicIP Mixer (http://www.musicip.com/mixer/index.jsp)
It's pretty cool - basically profiles your music collection and can automatically construct play lists of similar tracks based on those profiles.
Has anyone looked at doing this for XBMC?
Gamester17
2008-08-24, 15:31
Isn't XBMC's existing Last.FM (http://xbmc.org/wiki/?title=LastFM) feature similar to this?, ...in any case I am sure it could be nice to support both.
Please submit a feature request to trac (http://xbmc.org/trac) for tracking purposes.
gilgongo
2008-08-25, 23:19
Isn't XBMC's existing Last.FM (http://xbmc.org/wiki/?title=LastFM) feature similar to this?,
In effect, it's similar, but the algo is very different. You also don't need a net connection for it to work.
I'll submit a trac anyway.
Necromancyr
2009-01-28, 18:12
Just looking at the trac and I, obviously, can't edit/comment on it on there but this got changed to Streaming and it's definitely not. There's a headless app you can run on your computer that will do all of the site identification and provide the playlists back to a program via their API without having to be connected to the internet.
The music itself is from your library - NOT streaming. That's what makes it so great.
ErlendSB
2009-08-15, 13:59
MusicIP mixer works great!
I threw togheter a little script that uses the currently playing song to create a playlist.
Add the script to a remotekey or on your favourite dialog, and you've got a quick way of creating intelligent playlists. :grin:
As you can see from the code, the port number for the MusicIP api is hardcoded to "1234", and the playlist size is "12". Change them as you feel.
# Import XBMC module
import xbmc,urllib,urllib2 , re, os
from string import split, replace, find
# Script constants
__scriptname__ = "Music MIX"
if xbmc.Player().isPlayingAudio() == False:
self.close()
currentlyPlaying = xbmc.Player().getMusicInfoTag().getURL()
print currentlyPlaying
currentlyPlaying = currentlyPlaying.replace(":","%3A").replace(" ","+")
apiPath = 'http://localhost:1234/api/mix?song='
options = '&size=12&sizeType=tracks&content=text'
# The url in which to use
Base_URL = apiPath + currentlyPlaying + options
print Base_URL
#Pre-define global Lists
LinkURL = []
WebSock = urllib.urlopen(Base_URL) # Opens a 'Socket' to URL
WebHTML = WebSock.read() # Reads Contents of URL and saves to Variable
WebSock.close() # Closes connection to url
LinkURL = WebHTML.split("\n")
xbmc.PlayList(0).clear()
for l in LinkURL:
if not l == "":
xbmc.PlayList(0).add(l)
I agree MusicIP is a great feature to integrate - and this script is a step forward to do that.
Unfortunately I can't get it to work under Ubuntu Jaunty. Would appreciate any help.
This is what I did:
* updated and saved the MusicIP library, and set the api.
* started mmserver at boot.
* confirmed it's operational by creating a playlist via api call using a web browser.
* adjusted your script localhost:XXXX entry to match my settings.
* set xbmc to run "musicip.py" script in 2 places: main menu and as a "lyrics" script (to see which one works).
* imported all music into the xbmc library.
* ran the script while a song was playing.
When I run the script, I get the following entry in my playlist: "MusicIP API error - invalid request or internal error."
I'm not sure how to debug this to work out where the error is being generated. I suspect it's the url location of the playing file.
I'd appreciate any help / debug tips.
ErlendSB
2009-09-01, 16:22
Your probably right about the url location being the culprit.
I'm not sure what Ubuntu paths look like. But I suggest you look in your xbmc.log.
The lines "print currentlyPlaying" and "print Base_URL
" in the script should be printing the path of the currently playing song to the log.
The latter, the complete url that's sent to the API.
You should check and see if the first path point to the correct song.
In windows I needed to do some replacing of this path to make it url freindly. Hence the "replace(":","%3A").replace(" ","+")
"
Hope this helps.
Thanks for the script and debug support ErlendSB! All fixed now!
For others who experience the same problem - this was the issue... My music files are on an external/USB drive, which changes how the path appears in MusicIP for linux compared to how it appears in Ubuntu:
In Ubuntu (as shown in xbmc.log after the script failed)= /media/My Music/Album...
In MusicIP (as shown by viewing "song information" in MusicIP)= /media/My Music/./Album...
As suggested by ErlendSB, I simply amended the script to suit my system. In this case, the added "/./" in the file path for MusicIP. The line I amended is as follows:
currentlyPlaying = currentlyPlaying.replace("/My Music/","/My+Music/./").replace(" ","+")
I tested the need for the extra "/./" in the path by doing a direct call via web browser:
http:// localhost:XXXX/api/mix?song=/media/My+Music/./Album...&size=12&sizeType=tracks&content=text
(Where XXXX is my local api setting; and /Album... was the full path to the file I wanted to create a mix from).
For a while there I was afraid I'd have to move back to Windows to make use of MusicIP. This script, combined with XBMC, is better than the setup I had previously under Windows. And free I tells ya...