IPB

Welcome Guest ( Log In | Register )

32 Pages V  « < 21 22 23 24 25 > »   
Reply to this topicStart new topic
[Not my release] Biography view
romor
post Feb 19 2013, 12:49
Post #551





Group: Members
Posts: 668
Joined: 16-January 09
Member No.: 65630



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


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
marc2003
post Feb 20 2013, 10:40
Post #552





Group: Members
Posts: 4440
Joined: 27-January 05
From: England
Member No.: 19379



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. tongue.gif

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.
Go to the top of the page
+Quote Post
romor
post Feb 20 2013, 11:08
Post #553





Group: Members
Posts: 668
Joined: 16-January 09
Member No.: 65630



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.


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
marc2003
post Feb 20 2013, 11:39
Post #554





Group: Members
Posts: 4440
Joined: 27-January 05
From: England
Member No.: 19379



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

This post has been edited by marc2003: Feb 20 2013, 11:54
Go to the top of the page
+Quote Post
romor
post Feb 20 2013, 11:54
Post #555





Group: Members
Posts: 668
Joined: 16-January 09
Member No.: 65630



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


This post has been edited by romor: Feb 20 2013, 12:05


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
marc2003
post Feb 20 2013, 12:04
Post #556





Group: Members
Posts: 4440
Joined: 27-January 05
From: England
Member No.: 19379



QUOTE (romor @ Feb 20 2013, 10:54) *
In json response, new line is escaped with '\n'


in theory, yes. but take a look at the raw source.

http://developer.echonest.com/api/v4/artis...=jennifer+lopez

they are there in the wikipedia segment but not the last.fm... tongue.gif

This post has been edited by marc2003: Feb 20 2013, 12:04
Go to the top of the page
+Quote Post
romor
post Feb 20 2013, 12:07
Post #557





Group: Members
Posts: 668
Joined: 16-January 09
Member No.: 65630



That's rendered by browser, try:

CODE
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
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

This post has been edited by romor: Feb 20 2013, 12:25


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
romor
post Feb 20 2013, 13:51
Post #558





Group: Members
Posts: 668
Joined: 16-January 09
Member No.: 65630



QUOTE (marc2003 @ Feb 20 2013, 13:04) *
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):



This post has been edited by romor: Feb 20 2013, 14:25


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
mire777
post Feb 20 2013, 17:13
Post #559





Group: Members
Posts: 328
Joined: 9-June 12
Member No.: 100550



Amazing, thanks Romor, works perfectly smile.gif 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 biggrin.gif

This post has been edited by mire777: Feb 20 2013, 17:14
Go to the top of the page
+Quote Post
romor
post Feb 20 2013, 20:12
Post #560





Group: Members
Posts: 668
Joined: 16-January 09
Member No.: 65630



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?


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
mire777
post Feb 20 2013, 21:13
Post #561





Group: Members
Posts: 328
Joined: 9-June 12
Member No.: 100550



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?
Go to the top of the page
+Quote Post
romor
post Feb 21 2013, 03:11
Post #562





Group: Members
Posts: 668
Joined: 16-January 09
Member No.: 65630



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


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
marc2003
post Feb 21 2013, 11:34
Post #563





Group: Members
Posts: 4440
Joined: 27-January 05
From: England
Member No.: 19379



QUOTE (romor @ Feb 20 2013, 12:51) *
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.

This post has been edited by marc2003: Feb 21 2013, 11:38
Go to the top of the page
+Quote Post
mire777
post Feb 21 2013, 12:22
Post #564





Group: Members
Posts: 328
Joined: 9-June 12
Member No.: 100550



QUOTE (romor @ Feb 21 2013, 04:11) *
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 smile.gif
Go to the top of the page
+Quote Post
mire777
post Feb 21 2013, 20:03
Post #565





Group: Members
Posts: 328
Joined: 9-June 12
Member No.: 100550



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...
Go to the top of the page
+Quote Post
Timothy
post Feb 21 2013, 20:15
Post #566





Group: Members
Posts: 3
Joined: 22-January 12
Member No.: 96618



QUOTE (romor @ Feb 20 2013, 13:51) *



Thanks for this nice workaround, is it possible to get last.fm bio via script in german language?

tim
Go to the top of the page
+Quote Post
marc2003
post Feb 22 2013, 11:59
Post #567





Group: Members
Posts: 4440
Joined: 27-January 05
From: England
Member No.: 19379



QUOTE (mire777 @ Feb 21 2013, 19:03) *
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
%artist%


on your command line with

CODE
$replace(%artist%,&,'%26)


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

This post has been edited by marc2003: Feb 22 2013, 12:00
Go to the top of the page
+Quote Post
neons
post Feb 23 2013, 19:45
Post #568





Group: Members
Posts: 11
Joined: 23-February 13
Member No.: 106833



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.

This post has been edited by neons: Feb 23 2013, 19:54
Go to the top of the page
+Quote Post
romor
post Feb 23 2013, 21:59
Post #569





Group: Members
Posts: 668
Joined: 16-January 09
Member No.: 65630



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


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
neons
post Feb 24 2013, 15:29
Post #570





Group: Members
Posts: 11
Joined: 23-February 13
Member No.: 106833



QUOTE (romor @ Feb 23 2013, 21:59) *
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 smile.gif

This post has been edited by neons: Feb 24 2013, 15:29
Go to the top of the page
+Quote Post
mire777
post Feb 24 2013, 20:13
Post #571





Group: Members
Posts: 328
Joined: 9-June 12
Member No.: 100550



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 smile.gif

This is my script:

CODE
      
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


This post has been edited by mire777: Feb 24 2013, 20:18
Go to the top of the page
+Quote Post
romor
post Feb 24 2013, 22:07
Post #572





Group: Members
Posts: 668
Joined: 16-January 09
Member No.: 65630



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


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
mire777
post Feb 25 2013, 01:22
Post #573





Group: Members
Posts: 328
Joined: 9-June 12
Member No.: 100550



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...
Go to the top of the page
+Quote Post
kjllmeplz
post Feb 25 2013, 05:55
Post #574





Group: Members
Posts: 30
Joined: 7-January 13
Member No.: 105671



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



Go to the top of the page
+Quote Post
marc2003
post Feb 25 2013, 10:34
Post #575





Group: Members
Posts: 4440
Joined: 27-January 05
From: England
Member No.: 19379



QUOTE (romor @ Feb 23 2013, 20:59) *
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. tongue.gif
Go to the top of the page
+Quote Post

32 Pages V  « < 21 22 23 24 25 > » 
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 1st August 2014 - 10:23