Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: [Not my release] Biography view (Read 492205 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[Not my release] Biography view

Reply #550
On a side note, if resource investigated can be validated as XML, i.e. XHTML, there is no need for "API", as that's already webservice in a manner of speaking. That of course, purposely, is not the case here, nor on discogs, allmusic ...

It seems that last.fm biography can however be accessed from third party webservice, like echonest: http://developer.echonest.com/api/v4/artis...=jennifer+lopez

[Not my release] Biography view

Reply #551
it's nothing like a webservice. it's not documented and is subject to change at any time without notification. also there is the issue of copyright and it's usually slower as well.

and i've looked at echonest before and i can't use it. there are no line breaks which makes large articles pretty much unreadable.

[Not my release] Biography view

Reply #552
Yeah, subject to change like we are witnessing. You get notified by user complaint.
It could be slower if you are accessing HTML DOM, while XHTML as XML is at as same speed as your "API webservices", because it's same technology.

Echonest response does have line breaks. Perhaps you can't see it rendered by XML style sheet in your browser, if you just clicked above link.

[Not my release] Biography view

Reply #553
it's not that - i tested the JSON response in a script some time ago when i discovered no line breaks. i'll take another look though....

edit: found my old post from august 2011 about it here: http://www.hydrogenaudio.org/forums/index....st&p=767576

edit2: tested again and still not usable. screenshot shows last.fm on the left and wikipedia on the right....

http://dl.dropbox.com/u/22801321/lastfm%20wiki.png

[Not my release] Biography view

Reply #554
In json response, new line is escaped with '\n'
Also double quotes are escaped with '\"'

Edit: On screenshot right perhaps there is issue as that content source was table perhaps. And that's also for wikipedia article, which is not needed as wikipedia can be accessed natively with their werservice


[Not my release] Biography view

Reply #556
That's rendered by browser, try:

Code: [Select]
curl "http://developer.echonest.com/api/v4/artist/biographies?api_key=BJZA2W0VD8EFHZELS&license=cc-by-sa&format=json&name=jennifer+lopez" > out.json


Edit: but also in browser (Firefox) I see "\n" in your link

Edit 2: Here is raw "run external script" command for Biography View, which uses xmllint (can be replace by any tool that supports basic XPath)

Code: [Select]
cmd /c "xmllint --xpath "/response/biographies/biography/text[../site='last.fm']/text'()'" --encode utf-8 --noent "http://developer.echonest.com/api/v4/artist/biographies?api_key=BJZA2W0VD8EFHZELS&license=cc-by-sa&format=xml&name=$replace($meta(artist,0),' ',+)""


Until someone feels like writing a script it can be used to display full last.fm biography

[Not my release] Biography view

Reply #557
they are there in the wikipedia segment but not the last.fm...


After seeing the content in biography view processed with xmllint, it seems like they use new lines on last.fm contents to format additional information, like History, Musical style etc., while biography text new lines are stripped. These stripped new lines can be "recovered" by replacing dot followed by two spaces with dot followed by two CRLF, i.e ".  " -> ".\r\n\r\n". I'll do that later today and provide script, as there is no "sed" equivalent on Windows.

Edit: Sooner than later, here is 6 line vbscript that renders as expected full last.fm bio: https://gist.github.com/aa2ada8bdc93144abd03

How to use it (if script is placed in foobar root folder):


[Not my release] Biography view

Reply #558
Amazing, thanks Romor, works perfectly  if not asking too much perhaps you could combine, your previous script foo_shout.vbs with this. So that we can have, short preview album,tracklist and now playing with biography together.
However, THANKS, THANKS, THANKS Romor

[Not my release] Biography view

Reply #559
Mire, you are welcome

I don't understand your foo_shout.vbs concern
Can't you use it as external script in album tab and lastfm_bio.vbs in artist tab?

[Not my release] Biography view

Reply #560
I thought if it is possible to merge two scripts into one. But I encountered a problem with lastfm_bio.vbs. Script don't read the full name of artist.. It reads only the first part of the name. And so for all artist... Example: for Robbie Williams, Biography text is: ''Robbie is a synthpop musician hailing from Virginia.''
Or something I'm not set correctly?

[Not my release] Biography view

Reply #561
Mire, enclose artist in double quotes. Just follow screenshot literally

 

[Not my release] Biography view

Reply #562
These stripped new lines can be "recovered" by replacing dot followed by two spaces with dot followed by two CRLF, i.e ".  " -> ".\r\n\r\n".


just done that, thanks. for anyone who uses my WSH panel mod script, i've released a mod version in the other thread.

it does make me wonder if echonest cache data forever or whether last.fm supplies them with the full info? but for now, it's fine.

[Not my release] Biography view

Reply #563
Mire, enclose artist in double quotes. Just follow screenshot literally


Ok, now work. I had to copy quotes from the script. If i manualy write quotes, it does not work.
Thank's

[Not my release] Biography view

Reply #564
Something I noticed, echonest, does not recognize ''&'' carakter, so if you have a song with that character, you must change it in  ''and'' carakter . fortunately i don't have a lot of those songs...


[Not my release] Biography view

Reply #566
echonest, does not recognize ''&'' carakter


it does when you properly encode these kind of characters before making a request.

as a workaround you try replacing

Code: [Select]
%artist%


on your command line with

Code: [Select]
$replace(%artist%,&,'%26)


@Timothy, there is no language support with this version.

[Not my release] Biography view

Reply #567
Romor, your script works fine for me. Is it possible to add other possibilities. I'd like to download biography, and save it in a file, as it did foo_uie_biography earlier.And then if biography already exists in the folder, script will read that file.
If you have time to do this. Thank's.


[Not my release] Biography view

Reply #569
I encoded ampersand, thanks Marc

@neons: try this: https://gist.github.com/rornor/e8adee2d94cac17840b3

You should change first line - 'folder' variable to point to desired and existing folder


It was really fast. Works great, I've changed the ''txt'' extension in ''lfml'' , maybe if last.fm reverse his decision, biography can be readable again.Now everything works as before the change.Thank's Romor

[Not my release] Biography view

Reply #570
I tried the new script. One problem, if you turn off the network, and play song, script would make an empty biography file, because it does not provide the test network. And later when you turn on your network, the script will not overwrite that file.
I changed something and I was able to prevent this behavior, but I don't understand how it works, and whether it is well written, so can you update, thanks

This is my script:

Code: [Select]
       
Dim WshShell
Set WshShell = createobject("wscript.shell")
strURL = "www.google.com"
set png = WshShell.exec("ping -n 1 " & strURL)
do until png.status = 1
wscript.sleep 50
loop
strPing = lcase(png.stdout.readall)
Select Case True
     Case InStr(strPing, "reply from") > 1

folder = "C:\Users\mire\Desktop\foobar2000 xch4\lyrics\biography"
On Error resume Next
With CreateObject("Scripting.FileSystemObject")
If Not .FileExists(folder & "\" & WScript.Arguments.Item(0) & ".txt") Then
Set xml = CreateObject("MSXML2.DOMDocument.6.0")
xml.async = false
xml.load("http://developer.echonest.com/api/v4/artist/biographies?api_key=PKDMY7Z0SGFBW" & UCase(Right("denial", 4)) & "&license=cc-by-sa&format=xml&name=" & Replace(WScript.Arguments.Item(0), "&", "%26"))
.OpenTextFile(folder & "\" & WScript.Arguments.Item(0) & ".txt", 2, 1).Write(Replace(Replace(xml.selectSingleNode("/response/biographies/biography/text[../site='last.fm']").text, ". ", "." & vbCrLf & vbCrLf), ". ", "." & vbCrLf & vbCrLf) & vbCrLf & vbCrLf & "WIKIPEDIA BIO:" & vbCrLf & vbCrLf & Replace(Replace(xml.selectSingleNode("/response/biographies/biography/text[../site='wikipedia']").text, ". ", "." & vbCrLf & vbCrLf), ". ", "." & vbCrLf & vbCrLf))
End If
WScript.Echo .OpenTextFile(folder & "\" & WScript.Arguments.Item(0) & ".txt").ReadAll
End With
End Select

[Not my release] Biography view

Reply #571
Mire, I updated script not to create empty files, like in scenario when user looses connection

[Not my release] Biography view

Reply #572
Ok thanks. It's a good idea to save biography in case that something happens with the site. I hope it will not happen again...

[Not my release] Biography view

Reply #573
romor : thanks for the script.
But it still does not recognize ''&''.




[Not my release] Biography view

Reply #574
I encoded ampersand, thanks Marc


oh sorry, i didn't even look at your script. i just assumed it didn't based on the problem that was reported and the fact that mine works ok.