Comments on Mirton's Scripts

20 comments

Comment on Last Fm Artist with user Compatibility made Oct 6, 2008:

avg

you don't have to credit me, and i'll help recode some more this weekend

Comment on Last Fm Artist with user Compatibility made Oct 6, 2008:

Mirton

UPDATE 2:

I changed the script so that now you can select how many users you want to check compatibility with.

The list of top fans cna be viewed on this XML:

http://ws.audioscrobbler.com/1.0/artist/Mogwai/...

This is only for artists for now. For albums it still takes the users from the Top listeners section on the album's page.

Comment on Last Fm Artist with user Compatibility made Oct 6, 2008:

Mirton

Thanks a lot :)

Obviously you are a more experienced and elegant coder :)

I updated my code.

Where would you like me to put acknowledgments? Description here? or as a comment in the code :)

Comment on Last Fm Artist with user Compatibility made Oct 6, 2008:

avg

hey, i recoded a bunch of your script. check it out here. tell me if you like it or not and update so ican delete it.

changes:

-utilizes xpath instead of substrings for getting users [that's the major one, deleted a lot of lines thanks to this, and its probably more efficient now]

-makes sure not to compare with current user (100% fake reading)

-took out unneeded header from ajax request

-changed name "avg_comp" to "comp_total"

-took out the "#" from href, because it sends you to the top of the page when you click on it

-made the "Check compatibility" link bold with css

-changed that var tracklist=xpath("//h2[@class='h2Brushed']"); for the new xpath function

-a bunch of other tiny tidbits

Comment on Last Fm Artist with user Compatibility made Oct 5, 2008:

Mirton

Thanks for the suggestions :)

I changed the xpath query.

The problem with the styles was that I wasn't adding all the CSS elements. It works now :)

Yeah, the regex is a good idea, I used an ugly method to cast the return value from parseCompat into an integer, I multiplied it by 1 :P

I added a comment with thanks and a link to your userscripst.org profile page :)

Comment on Last Fm Artist with user Compatibility made Oct 5, 2008:

avg

and your xpath can be better:


function xpath(query) {
return document.evaluate(query, document, null,9, null).singleNodeValue;
}

now, instead of doing:


var result=xpath("//ul[@class='usersSmall clearit']"),
users = result.snapshotItem(0),

you can do:


var users=xpath("//ul[@class='usersSmall clearit']")

Comment on Last Fm Artist with user Compatibility made Oct 5, 2008:

avg

as for your style issue, perhaps the styles need to be !important-ized.

I did it for you, see if it works with this new css string:


#compatibility span.bar{display:block !important;position:relative !important;margin:5px 0 !important;width:100% !important;height:8px !important;overflow:hidden !important;-moz-border-radius:3px !important;-webkit-border-radius:3px !important;background:#ccc !important}#compatibility span.bar span{display:block !important;height:8px !important;-moz-border-radius:3px !important;-webkit-border-radius:3px !important}#compatibility span.verylow span{background:#9a9a9a !important}#compatibility span.low span{background:#453e45 !important}#compatibility span.medium span{background:#5336bd !important}#compatibility span.high span{background:#05bd4c !important}#compatibility span.veryhigh span{background:#e9c102 !important}#compatibility span.super span{background:#ff0101 !important}

Comment on Last Fm Artist with user Compatibility made Oct 5, 2008:

avg

hey nice script, 1 suggestion:

for your parseCompat function, this might be better:


function parseCompat(text){
return eval(/-{0,1}\d+\.{0,1}\d{0,}(?=%)/.exec(text)[0])
}

This also returns a number type instead of a string, so you can legally do math.

Comment on Last Fm Artist with user Compatibility made Oct 5, 2008:

Mirton

UPDATE:

I added a "Check Compatibility" link in the "Compatibility" section.

So in order to check your compatibility, you have to click on it.

I did this for two reasons:

1. It's very hard to calibrate the delay in order to eficiently get all listener's compatibility.

2. Last.fm is already overloaded as it is, so this will prevent additional strain on their servers (you don't really want to check compatibility every time you visit an artist's page :) )

Comment on Last Fm Artist with user Compatibility made Oct 5, 2008:

Mirton

I added the percentege and the color compatibility bar which spans based on percentage.

It looks like this:

http://img100.imageshack.us/img100/7616/tasteba...

( borrowed the percentage idea not code from Last.fm Compatibility Percentage by iriebob :) )

I also added compatibility check for albums, but now I can't seem to add the compatibility bar there :S

Comment on Last Fm Artist with user Compatibility made Oct 4, 2008:

Mirton

Right you are :P.

I changed the range to be *.6

I added compatibility check for albums.

I also added a percentage (average_value / 6)*100

Comment on Last Fm Artist with user Compatibility made Oct 3, 2008:

paulthedog

A little mistake... localized sites will be lastfm.* not last.* =)

Comment on Last Fm Artist with user Compatibility made Oct 3, 2008:

Mirton

Thanks for pointing it out. Forgot about it. Its now fixed.

I'm wondering to what values should I set the ranges.

Curently its < *.75 , so if an average compatibility is 1.67 where Very low = 1 and Low = 2 , then the average compatibility will be Very low.

Comment on Last Fm Artist with user Compatibility made Oct 3, 2008:

paulthedog

Fix compatibility with regional versions of last.fm

// @include http://www.lastfm.*/music/*

Comment on Glumbert Add removal made May 27, 2008:

Mirton

Now it also removes the LiveVideo Add on the right.

Comment on IMDB message board filter (WIP) made Nov 7, 2007:

markula

sounds good

Comment on Pajacyk made Sep 6, 2007:

Mirton

Link to the description of this charity.

http://www.pah.org.pl/7184.html

Comment on Pajacyk made Sep 4, 2007:

Mirton

anyone know how to delete Firefox cookies in javascript?

That way I could modify the code to make as much as 3-4 clicks a day, so as not to raise any suspicion. We dont want them seeing 30 click an hour from the same IP ;)

Comment on Glumbert Add removal made May 31, 2007:

Mirton

The Add is back again, so I updated the source. It should remove the add on the right.

Comment on Glumbert Add removal made May 21, 2007:

Mirton

Looks like they removed the add so there is no need for this script :)

Once they add more "Adds" I'll update the script to remove them ;)