getmusicbee.com

MusicBee & Add-Ons => Customizations => Plugins => Topic started by: Thorbjorn on July 17, 2012, 06:31:50 PM

Title: Last.fm playing track data
Post by: Thorbjorn on July 17, 2012, 06:31:50 PM
This isn't actually a plugin, but didn't know where else to put it.

I was inspired by Stevens new Last.fm plugin and wanted to make something that updates by itself. I made this web page that uses the playing track to search last.fm for top artist tracks, related artists and similar tracks. Clicking on an entry will locate it in the library if it exist.

To use it just paste this link into the displayed tabs:
http://lastfm.host-ed.me/?&artist=<Artist>&track=<Title>

Example:
http://lastfm.host-ed.me/?artist=kaizers%20orchestra&track=prosessen (http://lastfm.host-ed.me/?artist=kaizers%20orchestra&track=prosessen)

Optional extra parameters:
number=x              how many results you want to show (default = 5)
bg=xxxxxx               html color code of page background (without the #)
font=xxxxxx            html color code of font and links
hover=xxxxxx          html color code of hover bg
last=1                      Show last.fm icon with link for each entry
spot=1                    Show spotify icon with link for each entry found (slows down the page a bit)

Example:
http://lastfm.host-ed.me/?artist=kvelertak&track=blodt%C3%B8rst&number=9&bg=000000&font=ffffff&hover=b10000&last=1&spot=1

I put it up on a free host, so if it goes down it probably exceeded the traffic limit.

Looks like this so far:
(http://i.imgur.com/U2WDW.png?1?6930)
Title: Re: Last.fm playing track data
Post by: Thorbjorn on July 17, 2012, 06:33:57 PM
An improvement would of course be if it could link to a track in the musicbee database if it was there, but I'm guessing that's not possible from a webpage, and I have no idea how to make a plugin. Feel free to do so if anyone knows/wants, I would love that feature :)
Title: Re: Last.fm playing track data
Post by: lnminente on July 17, 2012, 09:28:48 PM
That's very nice! I have added it as a new tab inside the Playing track tab :)

(http://s10.postimage.org/ujd4qk80p/Untitled.png)
Title: Re: Last.fm playing track data
Post by: beeing good on July 17, 2012, 09:42:14 PM
That's very nice! I have added it as a new tab inside the Playing track tab :)

Same here, works really well.

Would be great if it could link to the musicbee library though.
Title: Re: Last.fm playing track data
Post by: Thorbjorn on July 17, 2012, 10:23:13 PM
I added some parameters to change colors. The original colors were just to fit with my skin.

The minimum syntax you need is:
http://lastfm.host-ed.me/?artist=<Artist>&track=<Title>

Optional extra parameters:
number=x              how many results you want to show (default = 5)
bg=xxxxxx               html color code of page background (without the #)
font=xxxxxx            html color code of font and links
hover=xxxxxx          html color code of hover bg

Example:
http://lastfm.host-ed.me/?artist=kvelertak&track=blodt%C3%B8rst&number=9&bg=000000&font=ffffff&hover=b10000
Title: Re: Last.fm playing track data
Post by: Steven on July 17, 2012, 10:50:33 PM
An improvement would of course be if it could link to a track in the musicbee database if it was there, but I'm guessing that's not possible from a webpage, and I have no idea how to make a plugin. Feel free to do so if anyone knows/wants, I would love that feature :)
what do you mean by link to a track? If you mean on clicking the link it navigated the main panel to select that track, then yes something could be done. You would set the link to be something like:
track://artistname;title
and MB would intercept that when clicked
Title: Re: Last.fm playing track data
Post by: Thorbjorn on July 17, 2012, 11:04:39 PM
Yes that's exactly what I mean. I tried what you said now (track://Archive;Again), but I got a popup that said "track is not a registered protocol". Did you mean this could be implemented, but is not now? Would be awesome if this is possible. I didn't think it would be.
Title: Re: Last.fm playing track data
Post by: lnminente on July 17, 2012, 11:20:30 PM
(Thanks, nicer now. For the skin metrocolours.red i'm using http://lastfm.host-ed.me/?artist=<Artist>&track=<Title>&bg=22282a&font=fbffc7&hover=a8001f )

Edit: The result is here http://s16.postimage.org/ao727n6bp/Untitled.png
Title: Re: Last.fm playing track data
Post by: Steven on July 19, 2012, 08:46:54 PM
i've added support for this protocol on web-links:
musicbee://artist=xxxx&title=yyyy

if xxxx or yyyy contain a "&" (or any html escape characters) then it needs to be hex encoded

at the moment it filters the library for that artist and title.
it will be in the next update
Title: Re: Last.fm playing track data
Post by: Steven on July 19, 2012, 09:27:56 PM
this has the functionality
http://musicbee.niblseed.com/V2/MusicBee_Exe_Patched.zip
Title: Re: Last.fm playing track data
Post by: Thorbjorn on July 19, 2012, 09:53:01 PM
Awesome, but sadly I can't get it to work here. I get a popup with "musicbee is not a registered protocol". It's not because I use a portable version?
Title: Re: Last.fm playing track data
Post by: Steven on July 19, 2012, 09:58:44 PM
here is an example
http://musicbee.niblseed.com/Debug/test.htm


<a href="musicbee:artist=Bon%20Jovi&title=Always">test</a>
Title: Re: Last.fm playing track data
Post by: Thorbjorn on July 19, 2012, 10:07:21 PM
That works! I used the example you posted earlier with musicbee://artist=xxxx&title=yyyy
Without the // it works fine.

I found a bug though. When in artwork view it correctly selects the album/artist containing the song, but if I'm already viewing an album/artist, nothing happens when I press the link. Same thing happens if I have the "switch to Album and Tracks view when drilling down" option selected.
Title: Re: Last.fm playing track data
Post by: Thorbjorn on July 20, 2012, 11:04:00 AM
I uploaded a new version now with the new MB link. I put spotify and last.fm links with their icons next to the song/artist. I also reduced the font size a bit to fit better with the MusicBee font.

(http://i.imgur.com/cmhEa.png)

http://lastfm.host-ed.me/?artist=nneka&track=focus&number=10

I tried hex encoding the url and it looks fine, but I don't have MusicBee here so I can't test if it works. I'm going on vacation in a few hours so won't be able to fix anything for a while.
Title: Re: Last.fm playing track data
Post by: lnminente on September 08, 2012, 12:57:53 PM
Thorbjorn, it works really well. Very useful for knowing which good tracks are missing in our libraries :)

Steven, when only the artist is sent in the musicbee link, but not the title of the track could we do a filtering of that artist the same than when we middle clicking the artist name? Currently i have it sorted by playcount and realized it only goes to the first track of that artist. TIA

BTW Would be nice having this as a local plugin
Title: Re: Last.fm playing track data
Post by: Thorbjorn on September 22, 2012, 03:59:34 PM
lnmente: Yes it would be better to have as a local plugin (especially as the free server I use can be slow sometimes), but I have no experience in creating anything like that. I had a look into it, but didn't understand much. Could possibly work my way through it with some time. Would you be willing to release the source of your last.fm plugins Steven? It's hard to understand how to work with the API without any examples to imitate.

+1 to improving the artist filtering method.
Title: Re: Last.fm playing track data
Post by: Thorbjorn on September 22, 2012, 04:03:40 PM
I didn't like how slow the tracks were being shown so I tested a bit, and it seems the spotify search is slowing it down. I uploaded a new version where the spotify link and last.fm link is removed by default. They can be shown by adding:
&last=1
&spot=1
to the url. The last.fm icon doesn't slow anything down, but the spotify does, for now at least.
The free host I'm using is still slow at times, but the page should load much faster now without spotify.
Title: Re: Last.fm playing track data
Post by: Eighty on September 25, 2012, 06:13:51 PM
I don't understand how to use this.
To use it just paste this link into the displayed tabs:
http://lastfm.host-ed.me/?&artist=<Artist>&track=<Title>
What is a "displayed tab"? If I just click the main window, press Ctrl+T, and paste the above url into the address bar, I always get the same page, for the artist "<Artist>", not the artist currently playing.
Title: Re: Last.fm playing track data
Post by: Thorbjorn on September 25, 2012, 06:56:49 PM
You need to have the "track & artist information" panel which updates based on the current playing track. If you don't have it you can add it by going to Preferences->Layout->Tick "Show track & artist information" and choose if you want to show it in a tab or on the bottom (as in my screenshots).

You then right-click the header of this panel and choose "Customize Panel Settings". Press "Displayed Tabs" and add the url there and give it a name.
Title: Re: Last.fm playing track data
Post by: Eighty on September 25, 2012, 07:48:08 PM
Thanks. This is really cool! I have a pretty comprehensive music collection, so this tool allows me to list related artists and immediately listen to them, instead of having to search and browse for them.
Title: Re: Last.fm playing track data
Post by: Alainn on December 10, 2012, 08:09:40 PM
I'm making a version of this in PHP5 on a local WAMP-server and it's coming along great :) I just shouldn't use something like urlencode($artist) since that's far too drastic :(

Would it be better to create a new thread with a tutorial on how to set this up in the How-To's or can I post here?
Title: Re: Last.fm playing track data
Post by: Thorbjorn on December 20, 2012, 09:52:20 PM
I have no preference. You may post here if you prefer that. I'm not working on this any more as it's mostly replaced by Steven's native plugin: http://getmusicbee.com/forum/index.php?topic=7484.0

I can upload my php source somewhere if you want to look at it?
Title: Re: Last.fm playing track data
Post by: Alainn on December 22, 2012, 03:02:37 PM
That would be great, thanks. My code is a bit ugly since I haven't coded since PHP4.
Title: Re: Last.fm playing track data
Post by: boroda on June 26, 2013, 07:54:49 AM
Here is plugin's wiki page (http://musicbee.wikia.com/wiki/Last.fm_Plugins). Please update it if plugin is updated.