ScrobblerDJ v1.26, Let your music free!!!

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Post by Teknojnky » Wed Nov 28, 2007 11:20 am

actually, to prevent confusion, scrobblerdj uses function URLEncode, whereas genrefinder uses fixurl (appears to be the same type of function? but different name.

Its not a drop in replacement either, due to variable naming differences.

Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Post by Teknojnky » Wed Nov 28, 2007 11:48 am

here is what appears to be working for me, a drop in replacement of the urlencode scrobblerdj function, along with the required other functions from trix's genrefinder and other scripts.

If there is a problem posting this, feel free to let me know and I will remove it, or mods can.

Code: Select all

Public Function URLEncode(sRawURL)
	logme "* URLEncode has started with parameters " & sRawURL
    Dim iLoop, sRtn, sTmp	
  Const sValidChars = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\/&:"
  Dim url : url = Replace(sRawURL,"+","%2B")
  If UCase(Right(url,6)) = " (THE)" Then
    url = "The "&Left(url,Len(url)-6)
  End If
  If UCase(Right(url,5)) = ", THE" Then
    url = "The "&Left(url,Len(url)-5)
  End If  
  
  If Len(url) > 0 Then
    Dim i : i = 1
    Do While i < Len(url)+1
      Dim s : s = Mid(url,i,1)
      If InStr(1,sValidChars,s,0) = 0 Then
        Dim d : d = Asc(s)
        If d = 32 Or d > 2047 Then
          s = "+"
        Else
          If d < 128 Then
            s = DecToHex(d)
          Else
            s = DecToUtf(d)
          End If
        End If
      Else
        Select Case s
          Case "&"
            s = "%2526"
          Case "/"
            s = "%252F"
          Case "\"
            s = "%5C"
          Case ":"
            s = "%3A"
        End Select
      End If
      URLEncode = URLEncode&s
      i = i + 1
      SDB.ProcessMessages
    Loop
  End If
	
    logme "* URLEncode will return " & sRtn & " and exit"

End Function

Function HexToDec(h)
  HexToDec = 0
  Dim i : i = 0
  For i = Len(h) To 1 Step -1
    Dim d : d = Mid(h,i,1)
    d = Instr("0123456789ABCDEF",UCase(d))-1
    If d >= 0 Then
      HexToDec = HexToDec+(d*(16^(Len(h)-i)))
    Else
      HexToDec = 0
      Exit For
    End If
  Next
End Function

Function DecToBin(intDec)
  DecToBin = ""
  Dim d : d = intDec
  Dim e : e = 1024
  While e >= 1
    If d >= e Then
      d = d - e
      DecToBin = DecToBin&"1"
    Else
      DecToBin = DecToBin&"0"
    End If
    e = e / 2
  Wend
End Function

Function BinToHex(strBin)
  Dim d : d = 0
  Dim i : i = 0
  For i = Len(strBin) To 1 Step -1
    Select Case Mid(strBin,i,1)
      Case "0"
        'do nothing
      Case "1"
        d = d + (2^(Len(strBin)-i))
      Case Else
        BinToHex = "00"
        Exit Function
    End Select
  Next
  BinToHex = DecToHex(d)
End Function

Function DecToHex(d)
  If d < 16 Then
    DecToHex = "0%"&CStr(Hex(d))
  Else
    DecToHex = "%"&CStr(Hex(d))
  End If
End Function

Function DecToUtf(d)
  Dim b : b = DecToBin(d)
  Dim a : a = "110"&Left(b,5)
  b = "10"&Mid(b,6)
  DecToUtf = "%"&BinToHex(a)&"%"&BinToHex(b)
End Function

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto » Wed Nov 28, 2007 12:17 pm

Sorry, I assumed I kept his function name when I copied it! :oops:

It is of course fine to post my code tidied up to fit in with this script. Giving back to the script that taught me how it's done! :)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

Guest

Post by Guest » Tue Dec 11, 2007 4:11 pm

what version of media monkey do you need for this script? does it support the latest?

nohitter151
Posts: 23640
Joined: Wed Aug 09, 2006 10:20 am
Location: NJ, USA
Contact:

Post by nohitter151 » Tue Dec 11, 2007 4:33 pm

I believe it only supports MM2.5 at this point, and does not work with MM3.
MediaMonkey user since 2006
Need help? Got a suggestion? Can't find something?

Please no PMs in reply to a post. Just reply in the thread.

dressen
Posts: 13
Joined: Tue Feb 13, 2007 3:09 am
Location: Seattle, WA

Working version in MM3!

Post by dressen » Wed Dec 12, 2007 6:43 am

Hi everyone,

This is one my favorite scripts and I had to see it working in MM3. I'm pleased to say I've gotten it working (first real MM scripting I've done).

Here is a link to a working version of ScrobblerDJ.vbs for MM3:
http://www.mediafire.com/?bnbu3ythf0j

Install ScrobblerDj as normal, then overwrite ScrobblerDJ.vbs with this version and it should work.

This version is not backwards compatible and will not work with MM2.x.

I've placed the comment "MM3 " wherever I made a change.

Enjoy!

Kingmob
Posts: 5
Joined: Fri Aug 11, 2006 12:48 pm
Location: Rotterdam, The Netherlands

Post by Kingmob » Thu Dec 13, 2007 8:05 am

Great script!

I have a problem though, it seems to get stuck in a 'loop' for certain types of music. For instance, i have a lot of REM and U2 albums, with lots of top rated songs and it will alternate between the two artists indefinitely. In short, the "no same artist" option does not seem to work for me?

Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Post by Teknojnky » Thu Dec 13, 2007 11:27 am

the no same artist does not apply to the default playlist, if your default playlist includes alot of rem and u2, then you will hear alot of rem and u2.

try changing or modifying your default playlist to something that has not been played in a longer time or not played at all.

ReVe
Posts: 1
Joined: Thu Dec 13, 2007 6:28 pm
Location: Netherlands

no related artist found (!?)

Post by ReVe » Thu Dec 13, 2007 7:11 pm

Hi,

First off, my thanks to psyXonova and Peke for this script. I really like it a lot! It feels like the musical equivalent of letting your mind wander; skipping from this idea to that, oftentimes pleasantly surprised by unexpected trains of thought, or memories you had half forgotten. :)

I have however noticed something strange. SDJ will sometimes say that it is unable to find a similar artist, and will play a song from the default playlist, while a quick check on Last.fm shows that there are plenty of similar artists that I have available (with high enough similarity; not having been played recently; high enough rating). This isn’t such a big problem (if you create/select a good default playlist, you’ll hardly notice anything), but a bit strange nonetheless.

Looking at the debug log and the code, I think I have an idea of what’s going wrong. The logs I made seemed to indicate that SDJ reverts to a song from the default playlist every time it finds an artist that has already recently been played.
I have virtually no experience in programming, so I don’t know what everything means exactly, but I think there’s probably something not right in this next part of the ScrobblerDJ.vbs code:

Code: Select all

            Do
                RNumber = Int(XDict.Count * Rnd)
                logme "ParseXML will now call NotTooSoon with parameters " & XDict.Item(RNumber)
                If Not NotTooSoon(XDict.Item(RNumber)) Then 
                	ParseXML = "E2"
	                logme "** NotTooSoon was False. ParseXML will return E2 and Exit"
	                Exit Do
                End If
                logme "ParseXML will now call sub CheckExist with parameters " & XDict.Item(RNumber) & ", 0, " & out_type
                res = CheckExist(XDict.Item(RNumber), 0, out_type)
                logme "CheckExist returned " & res & " to ParseXML"
                If res <> 0 Then
                	    ParseXML = res & "|§|§|§" & XDict.Item(RNumber)
                	 	logme "** ParseXML will return " & ParseXML
                        Exit Do
                End If

                If i = n Then
                	logme "** ParseXML tried too many times (" & i & "). It will return E2 code and exit"
                    ParseXML = "E2"
                    Exit Do
                End If
                i = i + 1
                TimerLoop = 0
                SDB.ProcessMessages

            Loop
If I understand it correctly, this is a loop that tries different artists from a Last.fm related artists list to see if they haven’t been played recently (NotTooSoon) and if you have them on your computer (CheckExist). However, when it finds an artist that has been played recently (so that NotTooSoon fails) then it exits the loop, instead of trying again with a new artist (until the counter (i) has reached a max (n)).
Changing the above code to the following (combining two If-Thens into a single new one) seems to actually solve this problem for me, while not producing any errors (at least so far).

Code: Select all

            Do
                RNumber = Int(XDict.Count * Rnd)
                logme "ParseXML will now call NotTooSoon with parameters " & XDict.Item(RNumber)
                logme "ParseXML will now call sub CheckExist with parameters " & XDict.Item(RNumber) & ", 0, " & out_type
                res = CheckExist(XDict.Item(RNumber), 0, out_type)
                logme "CheckExist returned " & res & " to ParseXML"
                If NotTooSoon(XDict.Item(RNumber)) And res <> 0 Then
                	    ParseXML = res & "|§|§|§" & XDict.Item(RNumber)
                	 	logme "** ParseXML will return " & ParseXML
                        Exit Do
                End If

                If i = n Then
                	logme "** ParseXML tried too many times (" & i & "). It will return E2 code and exit"
                    ParseXML = "E2"
                    Exit Do
                End If
                i = i + 1
                TimerLoop = 0
                SDB.ProcessMessages

            Loop
Again, I don’t really know what I’m doing, so if I’ve completely misunderstood the script, or if this change will cause problems, or if there’s a better solution, please let me know. Also, I wasn’t able to find any posts in this discussion topic describing similar problems, so it might just have been a problem with my setup (I use the latest official SDJ 1.26 with MM 2.5.5.998). Then again, this might be useful for some, so I decided to share it with you anyway. Sorry about the long post, though.

riffcat
Posts: 13
Joined: Fri Dec 07, 2007 8:23 pm

scrobler - mixed mode

Post by riffcat » Thu Dec 13, 2007 9:47 pm

would it be possible to make the script operate in a "mixed" mode? By "mixed" mode i mean by - instead of the the script adding a recommended track when the last song is being played. Have the script add a recommended song "play next" at preset intervals. like every other song or every 5 songs. This way one could play a selected playlist and have it mixed up a bit yet still keeping to the general mood of the play list.

I really like this script but sometimes I feel it tends to extremely detour from my general mood of listening. If it added a recommended track at certain intervals then the playlist "mood" would still stay "on-track"

drjboulder
Posts: 1119
Joined: Mon Apr 09, 2007 12:03 am
Location: Boulder, Colorado, USA

Re: Working version in MM3!

Post by drjboulder » Thu Dec 13, 2007 11:11 pm

dressen wrote:Hi everyone,
This is one my favorite scripts and I had to see it working in MM3. I'm pleased to say I've gotten it working (first real MM scripting I've done).
Here is a link to a working version of ScrobblerDJ.vbs for MM3:
http://www.mediafire.com/?bnbu3ythf0j
Install ScrobblerDj as normal, then overwrite ScrobblerDJ.vbs with this version and it should work.
Dressen you are my hero!!!
I put off upgrading to MM3 as long as possible solely because of lack of Scrobbler DJ. To now have it back has perfected the Monkey!

Cheers also to the original developer, psyXonova; his inspiration for the script, Trixmoto; Peke & Abrazor for their help and anyone else who contributed to one of the best ever scripts for the monkey
D Rock
Image
MediaMonkeyGoldv3.0.3.1183
Vista Home Basic|4thGen 20GPod
Zune Small Player Skin w/ Aqua 4 Player Mod
Backup | Last FM Node | Scrobbler DJ | TopTracks | StayInSameStyleDJ
RadioDJ | RadioFreeMonkey | PrettyPictures | MiniLyricsEmbedder
LyricsViewer | Lyricator | LyricsPlugin | VisualizationEmbedder | MonkeyRok
RightClickForWeb | WebSearchPanels | WebNodes | MagicNodes | FavoritesNodes
NowPlayingArtNode |AutoRateAccurate | TaggingInconsistencies
AdvancedDuplicateFind&Fix | CaseModify | PlayHistory&Stats | Etc...

Peke
Posts: 13294
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia
Contact:

Post by Peke » Fri Dec 14, 2007 12:02 am

@riffcat
Both Things are very very possible.

@ReVe
Good point. SDJ needs little tiding. There is several important adds in MM3 that makes SDJs job little easier and less demanding.
Best regards,
Pavle
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
How to add SCREENSHOTS to forum

Diabolic-Destiny
Posts: 223
Joined: Sun Apr 29, 2007 9:45 pm

Post by Diabolic-Destiny » Fri Dec 14, 2007 2:50 am

dressen so far your script has worked flawlessly for me nice work
Image
Image

Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Re: scrobler - mixed mode

Post by Teknojnky » Fri Dec 14, 2007 10:31 am

riffcat wrote:I really like this script but sometimes I feel it tends to extremely detour from my general mood of listening. If it added a recommended track at certain intervals then the playlist "mood" would still stay "on-track"
Did you try making the 'default' playlist more tailored to your mood?

Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Post by Teknojnky » Fri Dec 14, 2007 10:36 am

@ Reve, Yes I think you found a very old and overlooked bug. That always bothered the crap out of me when it says it couldn't find a track when I know I had something that should have been usable (my library is huge).

I had tried to comb thru the code at various times to try to figure out and better optimize it, but I never did figure out how.

Your explaination and understanding seem to make sense, I will try out your modification to see if it improves things for me as well.

There is/was also a problem with the urlencode, a fix which is posted a few posts ago, you should also check that out if you have problems with artists/tracks with non-ansi characters.

Cheers!

Locked