' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ' ' MonkeyShark ' version 1.0 ' 09/16/2011 ' ' by Lysle Shaw-McMinn ' http://lysle.net/projects ' ' ' INSTALLATION: ' ' 1) THIS FILE, SharkMonkey.vbs SHOULD BE SAVED TO THE FOLDER Program Files\MediaMonkey\Scripts\ ' ' 2) GO DOWN THIS PAGE TO WHERE IT SAYS [username][/username] and [password][/password] AND PUT ' YOUR USERNAME AND PASSWORD IN FOR GROOVESHARK. IF YOU DO NOT THEN THIS SCRIPT WILL NOT WORK. ' ' 3) PUT THE BELOW TEXT INTO Program Files\MediaMonkey\Scripts\Scripts.ini BUT REMOVE THE ' FIRST, ' JUST LIKE THE OTHER ADD-ONS FOR MM ' ' [MonkeyShark] ' Filename=MonkeyShark.vbs ' Procname=MonkeyShark ' Order=41 ' DisplayName=Export playlists to Grooveshark... ' Description=Exports all Playlists to Grooveshark ' Language=VBScript ' ScriptType=0 ' ' FOR INFORMATION ON HOW THIS SCRIPT WORKS, AND FOR TROUBLESHOOTING, VISIT http://lysle.net/projects ' ' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Option Explicit ' Recursively process all playlists Sub ReadPlaylists( playlists, plst, prefix) Dim items Set items = plst.ChildPlaylists If prefix<>"" Then prefix = prefix & " - " End If Dim i, newplst, title For i=0 To items.Count-1 Set newplst = items.Item(i) title = prefix & newplst.Title If Not playlists.exists(title) Then playlists.Add title, newplst End If ReadPlaylists playlists, newplst, title Next End Sub Function strClean (strtoclean) Dim objRegExp, outputStr Set objRegExp = New Regexp objRegExp.IgnoreCase = True objRegExp.Global = True objRegExp.Pattern = "[?*"",\\<>&#~%{}+_.@:\!;]+" outputStr = objRegExp.Replace(strtoclean, "") objRegExp.Pattern = "\+" outputStr = objRegExp.Replace(outputStr, "") strClean = outputStr End Function Sub SharkMonkey Dim playlists Set playlists = CreateObject("Scripting.Dictionary") ' Use progress to notify user about the current action Dim Progress, ExpText Set Progress = SDB.Progress ExpText = SDB.Localize("Exporting...") Progress.Text = ExpText ' Prepare a list of all playlists ReadPlaylists playlists, SDB.PlaylistByTitle( ""), "" ' Go through the list and export each playlist Dim i, iTrck, plst, objHTTP, fulltxt, rannum, plsts, titles, title, tracks, trck, ln, tlen, art, tit plsts = playlists.Items titles = playlists.Keys Progress.MaxValue = playlists.count rannum = Int( ( 99999 - 10000 + 1 ) * Rnd + 10000 ) fulltxt = "[new query]" ' ' ' ' ' ' ' FILL IN BELOW WITH YOUR GROOVESHARK LOGIN INFORMATION ' fulltxt = fulltxt & "[username]fakeusername[/username]" fulltxt = fulltxt & "[password]fakepass[/password]" ' ' FILL IN ABOVE ' ' ' ' ' For i=0 To playlists.Count-1 Set plst = plsts(i) Set tracks = plst.Tracks title = Titles(i) Progress.Text = ExpText & " (" & title & ") - " & Progress.Value & "/" & Progress.MaxValue If Progress.Value + 3 > Progress.MaxValue Then Progress.Text = ExpText & " (Now Sending to lysle.net/projects)" End If fulltxt = fulltxt & "[new playlist] [playlist]" & title & "[/playlist] [code]" & rannum & "[/code][tracks]" If tracks.Count>0 Then For iTrck=0 To tracks.Count-1 Set trck = tracks.Item(iTrck) ln = "[track] " art = trck.ArtistName tit = trck.Title If art<>"" Then If tit<>"" Then ln = ln & art & " [title] " & tit Else ln = ln & art & " [title] Untitled" End If Else If tit<>"" then ln = ln & " Unknown Artist [title] " & tit End If End If fulltxt = fulltxt & ln Next End If Progress.Value = i+1 Next ' send it to my webserver Set objHTTP = CreateObject("Microsoft.XMLHTTP") objHTTP.open "POST", "http://lysle.net/projects/grooveshark_mm_to_gs_catch.php", False objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" objHTTP.send "field1=" & strClean(fulltxt) Set objHTTP = Nothing MsgBox "Sucessfully saved your playlists to the messenger webhost. Please allow 24 hours for import to complete. To check your import status, visit www.lysle.net/projects and enter your import status code " & rannum & ". Your import will be processed faster if you first upload your library to your grooveshark library. Bits: " & Len(fulltxt) End Sub