Hello again mire777. Do you have a similar script for album info...? The one for artist works just fine. Thanks.
Yes. Try this, script works with last.fm API. As i remmember, should be better than default - has more info.
Shows Album tracks also.
DisplayAlbumTracks = 1
Set ARG = WScript.Arguments
If ARG.Count <> 2 Then
WScript.Echo "Usage: cscript //nologo lastfm_album.vbs ""%artist%"" ""%title%"""
WScript.Quit()
Else
If Arg(0) <> "?" And Arg(1) <> "?" Then
LfmInfo ARG(0), ARG(1)
End If
End If
Function LfmInfo(artist, track)
Set XML = CreateObject("MSXML2.DOMDocument.6.0")
ws = "http://ws.audioscrobbler.com/2.0/?method="
api = StrReverse("9c8f955632698c23323d4b2c7a77030") & Chr(100) : q = Chr(34)
XML.loadXML(Request(ws & "track.getinfo&api_key=" &_
api & "&artist=" & artist & "&track=" & track))
Set X = XML.selectSingleNode("lfm/track/album/title")
If Not X Is Nothing Then album = X.text : rel = "Artist: " & q & artist & q & vbCrLf & "Album: " & q & album & q & vbCrLf End If
Set X = XML.selectSingleNode("lfm/track/mbid")
If Not X Is Nothing Then track_mbid = X.text End If
Set X = XML.selectSingleNode("lfm/track/artist/mbid")
If Not X Is Nothing Then artist_mbid = X.text End If
If album <> "" Then
XML.loadXML(Request(ws & "album.getinfo&api_key=" &_
api & "&artist=" & artist & "&album=" & album))
Set X = XML.selectSingleNode("lfm/album/mbid")
If Not X Is Nothing Then album_mbid = X.text End If
Set X = XML.selectSingleNode("lfm/album/releasedate")
If Not X Is Nothing Then
If X.text <> "" Then
rel = Left(rel, Len(rel)-2) & vbCrLf & "Released on " & Mid(X.text, 1, InStr(X.text, ",")-1) & vbCrLf
End If
End If
Set X = XML.selectSingleNode("lfm/album/wiki/content")
If Not X Is Nothing Then
If X.text <> "" Then rel = rel & vbCrLf & "ALBUM INFO:" & vbCrLf & DropHtml(X.text) & vbCrLf End If
End If
End If
If DisplayAlbumTracks Then
Set X = XML.selectNodes("lfm/album/tracks/track")
If Not X Is Nothing Then
For Each t In X
If LCase(track) = LCase(t.selectSingleNode("name").text) Then p = "*" Else p = " " End If
trklst = trklst & p & Space(Len(t.getAttribute("rank")) mod 2) & t.getAttribute("rank") & ". " &_
t.selectSingleNode("name").text & vbCrLf
Next
If trklst <> "" Then trklst = "ALBUM TRACKLIST: " & vbCrLf & trklst End If
End If
End If
If DisplayAlbumTracks Then rel = rel & vbCrLf & trklst End If
WScript.Echo "" & rel
End Function
Function DropHtml(s)
Set HTML = CreateObject("HtmlFile")
HTML.write s
DropHtml = HTML.body.innerText
End Function
Function Request(url)
Set HTTP = CreateObject("MSXML2.ServerXMLHTTP")
HTTP.open "GET", url, 0
HTTP.send ""
If Err.number <> 0 then
WScript.Echo "Error: " & HTTP.parseError.url & vbCrLf & HTTP.parseError.Reason
WScript.Quit()
End If
Request = HTTP.responseText
End Function
Save this as ''lastfm_album.vbs''.
Put script in main foobar folder.
Go to Preferences>tools>Run External Script>Album
On Command line enter this text:
cscript //nologo lastfm_album.vbs "%artist%" "%title%"
Set Character Code to: utf8
Click ''Add New'' > Apply.
In Preferences>Tools>Biography server
''Run External Script'' should be first in list.
I can't test this, i'm on work now.
So, Try it yourself.