Page 1 of 9

Similar Artists Javascript Widget Mod

PostPosted: Mon Feb 28, 2011 2:47 am
by mqchen
I just set up subsonic a few days ago and noticed the default web-interface was missing similar artists feature, so I spent a few hours and implemented one in javascript. Why Javascript you ask? Because, then we don´t need to recompile subsonic, I think..

Anyway, here is the package: https://github.com/mqchen/SimilarArtist ... r-Subsonic

(Please note that it is only intended as a temporary solution until the feature is implemented in subsonic properly)

It´s not pretty, but it works and looks like this:
Image

It uses MusicBrainz to get the artist´s actual name (incase it is slightly misspelt) and then gets up to 30 similar artists from Last.fm.

In case any one is interested (why javascript and php?). Well, I fist tried a pure Javascript implementation using YQL as a jsonp proxy for MusicBrainz and Last.fm (since they don´t have an jsonp API), but there was a bug, which caused Yahoo to block my IP for YQL (as far as I can tell), so with no luck finding a good jsonp proxy, I just decided to go with php.

If you have any problems just let me know and I´ll try to help!

PostPosted: Mon Feb 28, 2011 3:04 am
by kroken
Can you make it to work with other themes then just the standard?

PostPosted: Mon Feb 28, 2011 6:39 am
by mrmand
Great

PostPosted: Mon Feb 28, 2011 8:26 am
by donpearson
Your image of it don't work anymore.
Cant see what the mod dose :wink:

PostPosted: Mon Feb 28, 2011 9:16 am
by mqchen
donpearson wrote:Your image of it don't work anymore.
Cant see what the mod dose :wink:


Hmm, strange. Here are two links: http://imgur.com/yttXr http://bildr.no/image/833668.jpeg

kroken wrote:Can you make it to work with other themes then just the standard?


Actually, it works with all the themes shipped with Subsonic. (I though you meant 3rd-party themes...)

PostPosted: Mon Feb 28, 2011 3:39 pm
by kroken
Yeah it works but it not seems to work with Firefox

PostPosted: Tue Mar 01, 2011 7:06 am
by 3R3
mqchen, thanks for trying your hand at this. now that you gave a "framework" to mod around this feature, I'm sure many different designs and implementations will pop up in the mod forum.
Many thanks for this!
*goes off to mod some ss*

edit: with firefox in ubuntu karmic it doesnt work. also tried with opera 10 on karmic.
I tried clearing browser cache and cookies, stopping server, clearing jetty cache and restarting server, to no avail. I followed the instruction on your website, is there anything else thats needed? something pretty obvious maybe?
Only thing I can think of is your unis php server service got discovered and stopped for excessive traffic and load.

PostPosted: Wed Mar 02, 2011 4:08 pm
by mqchen
3R3 wrote:edit: with firefox in ubuntu karmic it doesnt work. also tried with opera 10 on karmic.
I tried clearing browser cache and cookies, stopping server, clearing jetty cache and restarting server, to no avail. I followed the instruction on your website, is there anything else thats needed? something pretty obvious maybe?
Only thing I can think of is your unis php server service got discovered and stopped for excessive traffic and load.


Hmm, this is really strange. The server is up, and it works well in both Chrome and Firefox on OSX, as well as Chrome on Ubuntu.

For some reason, Firefox on Ubuntu just decides to abort the request, on a random basis. I will look more into this, but it is really strange...

PostPosted: Wed Mar 02, 2011 9:08 pm
by fonsoy
Normally I don't post too much, but this looks great!!!

I would love to implement this.
If you need any testers (I run Windows Server 2k8) I'll hear from you.

PostPosted: Thu Mar 03, 2011 3:28 pm
by mqchen
mqchen wrote:
3R3 wrote:edit: with firefox in ubuntu karmic it doesnt work. also tried with opera 10 on karmic.
I tried clearing browser cache and cookies, stopping server, clearing jetty cache and restarting server, to no avail. I followed the instruction on your website, is there anything else thats needed? something pretty obvious maybe?
Only thing I can think of is your unis php server service got discovered and stopped for excessive traffic and load.


Hmm, this is really strange. The server is up, and it works well in both Chrome and Firefox on OSX, as well as Chrome on Ubuntu.

For some reason, Firefox on Ubuntu just decides to abort the request, on a random basis. I will look more into this, but it is really strange...


I can't seem to reproduce the error any more on Ubuntu with neither Firefox nor Opera. I had some connectivity problems last time I tried, so I'm not sure if the problem was with the script or my network.

Could you please open up Firebug and check what is happening with the request? Just open Firebug → Net → HTML and look for a request to the host moquanc.at.ifi.uio.no. Should look something like this:
Image

fonsoy wrote:Normally I don't post too much, but this looks great!!!

I would love to implement this.
If you need any testers (I run Windows Server 2k8) I'll hear from you.


I'm glad you like it. Please let me know if you have any problems setting it up. The PHP server part of it has only been tested on OSX and Linux, so I'm not sure how well it'll work on a Windows server.

PostPosted: Fri Mar 04, 2011 3:47 pm
by alkimiya
Thanks a lot mqchen, it works really nicely.

Hopefully someone could write a "Server"-integration for Subsonic that filters out artists that are missing in the collection.

PostPosted: Sat Mar 05, 2011 8:55 am
by 3R3
mqchen wrote:
mqchen wrote:
3R3 wrote:edit: with firefox in ubuntu karmic it doesnt work. also tried with opera 10 on karmic.
I tried clearing browser cache and cookies, stopping server, clearing jetty cache and restarting server, to no avail. I followed the instruction on your website, is there anything else thats needed? something pretty obvious maybe?
Only thing I can think of is your unis php server service got discovered and stopped for excessive traffic and load.


Hmm, this is really strange. The server is up, and it works well in both Chrome and Firefox on OSX, as well as Chrome on Ubuntu.

For some reason, Firefox on Ubuntu just decides to abort the request, on a random basis. I will look more into this, but it is really strange...


I can't seem to reproduce the error any more on Ubuntu with neither Firefox nor Opera. I had some connectivity problems last time I tried, so I'm not sure if the problem was with the script or my network.

Could you please open up Firebug and check what is happening with the request? Just open Firebug → Net → HTML and look for a request to the host moquanc.at.ifi.uio.no. Should look something like this:
Image

fonsoy wrote:Normally I don't post too much, but this looks great!!!

I would love to implement this.
If you need any testers (I run Windows Server 2k8) I'll hear from you.


I'm glad you like it. Please let me know if you have any problems setting it up. The PHP server part of it has only been tested on OSX and Linux, so I'm not sure how well it'll work on a Windows server.


It works now. Firebug allowed me to read the answer to the failed requests, which read: path not found. So I just put the files in the wrong path.

Works nice now, my only request would be, like alkimiya above me said, to filter out the hits not in collection and not use the search to access the local collection but direct links to the artists folder. Although its not always possible to do that. but filtering would be the real killer, else it might become tedious to always fiddle with the search and wade through irrelevant search hits. At least until the search has matured some more ;)

Another question, is it intentional that the similar artists are only shown when just a single user is playing music? when more than 1 user is in the now playing tab, the list is gone for me. Thats good of course, just curious.

I could't find a parameter for the length of the similar artist list in the js files. I suppose it's in the php on the server?

So cool widget, thx for sharing it with the world!

PostPosted: Thu Mar 10, 2011 4:47 pm
by mqchen
So, I have added support for configuring how many artists you want it to suggest.

To change the amount of artists you want it to suggest:
Check out the latest from the repository: https://github.com/mqchen/SimilarArtist ... r-Subsonic
(Only "Client/similar_artists/similar_artists.js", "Server/jsonp.php" and "Server/Music/ArtistInfo.php" have been updated).

Open the Client/similar_artists/similar_artists.js"-file and change the limit-variable.

If you are running the PHP server on your own server then you need to update the "Server/jsonp.php" and "Server/Music/ArtistInfo.php" files from the repository.


About the issue of multiple users logging on; I am the only one who uses my server, so I haven´t been able to test it that much, but it should be able to suggest similar artists for every artist that is being played...

PostPosted: Sat Mar 12, 2011 11:22 pm
by 3R3
I thought about your widget some time now, and the best way of unobtrusively integrating it into the existing inteface I could come up with would be something like this:
Image
Image
After a click on the little red heart, tooltip appears.
The tooltip would be maybe 3 sec persistent after cursor leaves tooltips boundaries. Links are filtered to only show stuff in collection, and link directly to album/folder.

I think this will be used instantly even by the most unadventuruos user...after all, everyone likes little red hearts and wants to click 'em ;-)

About the issue of multiple users logging on; I am the only one who uses my server, so I haven´t been able to test it that much, but it should be able to suggest similar artists for every artist that is being played...

Yes, when multiple users log on, this gets quite ugly with the widgets getting stacked on top of each other between the "playing" pane and the chat. Makes the right frame rather tall and scrolly <.<
So I thought of a way to only show one widget, on demand per user using a ajax tooltip or something. Unfortunately I only know the names of these things but have never used it myself...

PostPosted: Tue Mar 15, 2011 4:28 pm
by kermit22
I'm getting an error when I try to run this on windows. Firebug reports a 404 error. Here is what my firebug output is:

Code: Select all
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 404 NOT_FOUND</title>
</head>
<body>
<h2>HTTP ERROR: 404</h2><pre>NOT_FOUND</pre>
<p>RequestURI=/script/similar_artists/similar_artists.js</p>
<p><i><small><a href="http://jetty.mortbay.org">Powered by jetty://</a></small></i></p>
                                               


Does that mean that I didn't place the directory/files in the correct locations?