Similar Artists Javascript Widget Mod

Third-party modifications and add-ons, Apps and Clients

Moderator: moderators

Re: Similar Artists Javascript Widget Mod

Postby califrag » Sun Oct 02, 2011 2:20 am

Ah of course the #1 rule, which I follow :) I'm using Chromium browser
califrag
 
Posts: 72
Joined: Mon Sep 26, 2011 3:43 am

Re: Similar Artists Javascript Widget Mod

Postby BKKKPewsey » Sun Oct 02, 2011 2:59 am

Making the assumption that you are not using the server code but only the client then that should work.
You may need to stop SS and clear the jetty cache then restart before it shows. (And clear browser cache)
Also test it with a common band because sometimes nothing will show if it cannot recognise the artist.
:mrgreen:
Everyone is entitled to be stupid, Image but some abuse the privilege!

Due to the confusion from too many genres of music, we have decided to put both country music and rap music into the genre of Crap music.
User avatar
BKKKPewsey
 
Posts: 2080
Joined: Mon May 23, 2011 12:16 pm
Location: United Kingdom

Re: Similar Artists Javascript Widget Mod

Postby califrag » Sun Oct 02, 2011 6:56 am

BKKKPewsey wrote:Making the assumption that you are not using the server code but only the client then that should work.
You may need to stop SS and clear the jetty cache then restart before it shows. (And clear browser cache)
Also test it with a common band because sometimes nothing will show if it cannot recognise the artist.
:mrgreen:


heh yep, everything above correct...
Using only the client,
stopped SS and cleared jetty cache, restarted
cleared browser cache
tried with several bands..
I've made a bunch of other changes to the default subsonic theme and pages... I probably broke some functionality..

I noticed scripts.js has the following

Code: Select all
       if(typeof(jQuery) === undefined) { // if jQuery isn't loaded yet...


should be

Code: Select all
       if(typeof(jQuery) == undefined) { // if jQuery isn't loaded yet...


right?

...

I think that fixed it.. but it seems to appear, then disappear about every thirty seconds...
is this normal behavior? Also... does it show similar artists for the song that is playing?

Okay I think I figured it out... It keeps 'flashing' when it finds similar artists the on the first attempt, but has trouble finding the song match.
Instead of just leaving the 'artist' results alone, then adding the song search results after it finally gets them, it re-queries both items. I'm wondering if this can be changed.

I also noticed this in the similar_artist.js file line 193:

Code: Select all
         var desc = ((artist.type !== 'Unknown') ? '('+artist.type+') ' : '') + artist.disambiguation;


should be

Code: Select all
         var desc = ((artist.type != 'Unknown') ? '('+artist.type+') ' : '') + artist.disambiguation;
califrag
 
Posts: 72
Joined: Mon Sep 26, 2011 3:43 am

Re: Similar Artists Javascript Widget Mod

Postby mqchen » Sun Oct 02, 2011 8:10 pm

About the operators, it should be '===' and '!=='. It is the identity operator instead of the equals operator (http://stackoverflow.com/questions/3594 ... ator-i-use)

Could you open in up in Firebug and post the error messages you get, as well as the Net tab?
User avatar
mqchen
 
Posts: 28
Joined: Mon Feb 28, 2011 2:33 am

Re: Similar Artists Javascript Widget Mod

Postby BKKKPewsey » Sun Oct 02, 2011 8:37 pm

BKKK puts down his copy of php for Dummies and opens up Javascript for Idiots :roll:

Bring back BASIC I say
:mrgreen:
Everyone is entitled to be stupid, Image but some abuse the privilege!

Due to the confusion from too many genres of music, we have decided to put both country music and rap music into the genre of Crap music.
User avatar
BKKKPewsey
 
Posts: 2080
Joined: Mon May 23, 2011 12:16 pm
Location: United Kingdom

Re: Similar Artists Javascript Widget Mod

Postby califrag » Sun Oct 02, 2011 9:51 pm

mqchen wrote:About the operators, it should be '===' and '!=='. It is the identity operator instead of the equals operator (http://stackoverflow.com/questions/3594 ... ator-i-use)

Could you open in up in Firebug and post the error messages you get, as well as the Net tab?


Ha.. I knew that,..... :oops:

Okay, maybe not heh... Thanks for the clarification...
You can't tell from my post but it was 11pm and I hadn't slept in about 48 hours...

Note trying to make excuses... Just... making excuses :mrgreen:

So i fixed my copies... now it stopped working...

I don't know if they are supposed to be identify operators or not, but for whatever reason those tags seem to control whether or not the script works for me in Chromium [16.0.893.0 (Developer Build 102734 Windows)]
califrag
 
Posts: 72
Joined: Mon Sep 26, 2011 3:43 am

Re: Similar Artists Javascript Widget Mod

Postby mqchen » Mon Oct 03, 2011 6:38 pm

Well, get some sleep!

Anyway, it is much easier if you could open up Firebug and show us what kind of errors you get as well as network activity. I am running it on Chrome 14, so it should work fine on Chromium. Maybe it's because you're running a dev version? Or maybe it's because of the other changes you made to the template?
User avatar
mqchen
 
Posts: 28
Joined: Mon Feb 28, 2011 2:33 am

Re: Similar Artists Javascript Widget Mod

Postby califrag » Mon Oct 03, 2011 9:09 pm

mqchen wrote:Well, get some sleep!

Anyway, it is much easier if you could open up Firebug and show us what kind of errors you get as well as network activity. I am running it on Chrome 14, so it should work fine on Chromium. Maybe it's because you're running a dev version? Or maybe it's because of the other changes you made to the template?



Heh thanks, I slept in until 1 today after staying up til about 5am........ On the plus side, the sunrise is always beautiful :D

ANyways, I havent' set up firebug yet, but attached screenshot is what chromium is throwing out..

It looks like my jQuery is crashing out which is causing some other things to not work properly. 99% of the time it loads fine and doesn't throw these messages.

The other 1% of the time it will throw the jQuery error then some other things will break (the prototype dispatchEvent and a jQuery .show() reference)
califrag
 
Posts: 72
Joined: Mon Sep 26, 2011 3:43 am

Re: Similar Artists Javascript Widget Mod

Postby mqchen » Wed Oct 05, 2011 5:00 pm

Hmm, so does it work 99% of the time, or does jQuery load 99% of the time, but the widget still doesn't work?
User avatar
mqchen
 
Posts: 28
Joined: Mon Feb 28, 2011 2:33 am

Re: Similar Artists Javascript Widget Mod

Postby califrag » Wed Oct 05, 2011 7:46 pm

mqchen wrote:Hmm, so does it work 99% of the time, or does jQuery load 99% of the time, but the widget still doesn't work?

It works 99% of the time.
99% of the time, jQuery 'loads' and the widget works.
Randomly 1% of the time it throws the 'jQuery undefined' error I posted and nothing works (playlists break, javascript breaks, everything stops working until refresh).
I ended up commenting out the scripts.js similar artists stuff (disabling it) because it was causing the problem.
After I disabled the script the jQuery error has not popped up anymore (which makes sense) and everything is working properly.

I tried adding wrapping everything in 'if (typeof(jQuery) !== undefined) {" but it still popped up the jquery undefined error.. not sure what is goin on.
califrag
 
Posts: 72
Joined: Mon Sep 26, 2011 3:43 am

Re: Similar Artists Javascript Widget Mod

Postby mqchen » Wed Oct 05, 2011 8:52 pm

Yeah, I think this might have happened to me as well... It has to do with loading jQuery dynamically. The method is a little buggy.

Try wrapping it with this instead
Code: Select all
if(jQuery !== undefined) {

}
User avatar
mqchen
 
Posts: 28
Joined: Mon Feb 28, 2011 2:33 am

Re: Similar Artists Javascript Widget Mod

Postby califrag » Wed Oct 05, 2011 9:14 pm

mqchen wrote:Yeah, I think this might have happened to me as well... It has to do with loading jQuery dynamically. The method is a little buggy.

Try wrapping it with this instead
Code: Select all
if(jQuery !== undefined) {

}



still throwing an error for me.. I've tried

if (jQuery !== undefined) {
if (jQuery !== "undefined") {
if (typeof(jQuery) !== undefined) {
if (typeof(jQuery) !== "undefined") {

no luck with any of them (obviously the ones in quotes wouldnt work.. just trying for the helluvit)
califrag
 
Posts: 72
Joined: Mon Sep 26, 2011 3:43 am

Re: Similar Artists Javascript Widget Mod

Postby califrag » Thu Oct 27, 2011 5:25 am

Hi mqchen,
I've managed to get this working without throwing errors and have incorporated it into a branch of Subsonic I am developing on.

I hope you don't mind.

I've also renamed everything from 'similar_artists' to 'music_brainz' so it will be more than just 'similar artists', it will be an entire music_brainz integration.

I've still got a little more work to do to fix 'Similar songs', but if you are interested in the version I've modified I can post the modified files here, on your github or they will also be available through the subsonic svn after my next commit (within the next few days).
califrag
 
Posts: 72
Joined: Mon Sep 26, 2011 3:43 am

Re: Similar Artists Javascript Widget Mod

Postby mqchen » Tue Nov 01, 2011 11:08 pm

califrag wrote:Hi mqchen,
I've managed to get this working without throwing errors and have incorporated it into a branch of Subsonic I am developing on.

I hope you don't mind.

I've also renamed everything from 'similar_artists' to 'music_brainz' so it will be more than just 'similar artists', it will be an entire music_brainz integration.

I've still got a little more work to do to fix 'Similar songs', but if you are interested in the version I've modified I can post the modified files here, on your github or they will also be available through the subsonic svn after my next commit (within the next few days).


I don't mind at all. Feel free to fork the project on Github: https://github.com/mqchen/SimilarArtist ... r-Subsonic

I decided to call it Similar Artists because it uses more than one service. It uses both Musicbrainz and Last.fm.
User avatar
mqchen
 
Posts: 28
Joined: Mon Feb 28, 2011 2:33 am

Re: Similar Artists Javascript Widget Mod

Postby califrag » Tue Nov 01, 2011 11:24 pm

mqchen wrote:
califrag wrote:Hi mqchen,
I've managed to get this working without throwing errors and have incorporated it into a branch of Subsonic I am developing on.

I hope you don't mind.

I've also renamed everything from 'similar_artists' to 'music_brainz' so it will be more than just 'similar artists', it will be an entire music_brainz integration.

I've still got a little more work to do to fix 'Similar songs', but if you are interested in the version I've modified I can post the modified files here, on your github or they will also be available through the subsonic svn after my next commit (within the next few days).


I don't mind at all. Feel free to fork the project on Github: https://github.com/mqchen/SimilarArtist ... r-Subsonic

I decided to call it Similar Artists because it uses more than one service. It uses both Musicbrainz and Last.fm.


Ahhh cool. I didn't realize the last.fm integration. I will add that to the list for 'TODO'. basically I'd like to separate each service-subservice.... for example

MusicBrainz ID \ Database Query
get from Music brainz (as controlled by MusicBrainzService.java)

Lyrics (as controlled by LyricsService.java)
get ID3 lyrics if any (as controlled by MetaDataParser.java)
fallback to musiXmatch api (as controlled by musiXmatchService.java)
fallback to lyrics wikia or user's choice (as controlled by LyricsService.java)

Similar artists (as controlled by SimilarArtistsService.java)
get from last.fm (as controlled by LastFMService.java)
fallback to whatever else..

or however the cases may be.. I hope that makes sense.. Just trying to get some organization into the way everything is handled so that it will be easier to handle multiple services for each feature. :)
califrag
 
Posts: 72
Joined: Mon Sep 26, 2011 3:43 am

PreviousNext

Return to Mods, Apps and Clients

Who is online

Users browsing this forum: No registered users and 4 guests