Page 3 of 5

Posted: Sun Mar 25, 2007 9:01 pm
by RedX
But there is one problem that i think happens due to the natural way that Last.fm handles these url and that is that you can't use + in a bands name, atm just +44 comes into my mind that has a + in it, but even using url encode this gets interpreted as " 44" by last.fm and thus making it impossible to get any data for the band.

If anyone got an idea of a workaround please tell me :)

Posted: Mon Mar 26, 2007 3:40 am
by trixmoto
When calling Last.Fm I use this fix function (written by psyxonova in his ScrobblerDJ script)...

Code: Select all

Function fixurl(sRawURL)
  Const sValidChars = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\/&:"
  Const sEscapeChars = "\/&:"
  
  If Len(sRawURL) > 0 Then
    Dim iLoop : iLoop = 1
    Do While iLoop < Len(sRawURL)+1
      Dim sTmp : sTmp = Mid(sRawURL, iLoop, 1)
      If InStr(1,sValidChars,sTmp,0) = 0 Then
        sTmp = Hex(Asc(sTmp))
        If sTmp = "20" Then
          sTmp = "+"
        ElseIf Len(sTmp) = 1 Then
          sTmp = "%0"&sTmp
        Else
          sTmp = "%"&sTmp
        End If
      ElseIf InStr(1,sEscapeChars,sTmp,0) > 0 Then
        Select Case sTmp
          Case "&"
            sTmp = "%2526"
          Case "/"
            sTmp = "%252F"
          Case "\"
            sTmp = "%5C"
          Case ":"
            sTmp = "%3A"
        End Select
      End If
      fixurl = fixurl & sTmp
      iLoop = iLoop +1
    Loop
  End If
End Function

Posted: Mon Mar 26, 2007 6:26 am
by RedX
Thanks but that is the same as URLEncode from scrobblerdj whih we already use :)
Thx tho ;)

Posted: Mon Mar 26, 2007 10:58 am
by trixmoto
I've never found any problems with this - what is the exact URL that isn't working?

Posted: Mon Mar 26, 2007 11:42 am
by RedX
Artist +44

http://ws.audioscrobbler.com/1.0/artist ... tracks.xml <-is what gets interpreted as
artist " 44"

and also if i use
http://ws.audioscrobbler.com/1.0/artist ... tracks.xml
also gets interpreted as
" 44"

Posted: Mon Mar 26, 2007 3:04 pm
by trixmoto
Hmmm. I'm stumped! :-?

Posted: Tue Mar 27, 2007 8:59 am
by trixmoto
You have to double encode because it's being pushed through two layers, like this...

+44 -> %2B44 -> %252B44

The second encoding encodes the % so that it goes through the first layer and onto the second layer.

Posted: Tue Mar 27, 2007 4:19 pm
by tinny
Thanks Teknojnky, great script and excellent idea :wink:

Posted: Tue Mar 27, 2007 4:23 pm
by Teknojnky
Glad you like it! I'm quite enjoying it myself! 8)

Much thanks to Psyxonova for his work on scrobblerDJ, and to RedX, Trix, and all the other scripters who share their ideas, help on code and scripts!

Posted: Tue Mar 27, 2007 5:23 pm
by RedX
@ trix: thx it fixed it 8)

new version available in my ftp: v1.02 HERE!

Posted: Wed Mar 28, 2007 1:12 pm
by RedX
New version 1.03: HERE!
icon 1: ICON 1 icon 2: ICON 2

This release also include two icons that need to be in the same folder as the script (auto folder). If you don't copy them then u'll get two identical icons in the toolbar.

changelog:
1.03
* Added option panel for comfort setup
* Added another button to toolbar for easy selection between shuffle and normal
* Added status bar
* started working on future auto enqueue
* Added two custom icons

Posted: Fri Apr 13, 2007 5:04 am
by RedX
Hi!

New version out 1.05 it now supports mutiple artists selection.

Grab it HERE

When multiple artists are selected if you use the option ordered it will only return the top songs of the first artist selected since it is in order, but if you use the shuffle option it will return a mix of the songs of the selected artists.

If anyone needs i can change the options and make it return the top X from each artist.

Regards,
Red

Posted: Tue May 01, 2007 4:07 am
by trixmoto
I've just rewritten the "fixurl" function I got from psyxonova, just thought you might like to know...

http://www.mediamonkey.com/forum/viewtopic.php?t=17433

Posted: Tue May 01, 2007 7:24 am
by RedX
NEW VERSION 1.06

Uses the improved fixurl by Trixmoto and now should be able to handle any artist.

grab it HERE

Posted: Sun May 06, 2007 2:51 am
by cadmanmeg
So I downloaded the current version and saved that vbs file into my auto scripts folder under MM, but I get no toolbar or no way to use the script. Am I doing something wrong? I restarted MM, but still nothing to identify how to use or enable it. I am sure it is somethign I am over looking, just do not know what that is. Any help? Thanks much.