Skip to main content

Topic: [Not my release] Biography view (Read 326692 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • romor
  • [*][*][*][*][*]
[Not my release] Biography view
Reply #475
None of those commands produce an error here.

For you first command: For some reason, allmusic returns empty result for that album: http://www.allmusic.com/search/album/No%20Age%20%5BSST%5D
Excluding "[sst]" from album name returns correct review text

For your second command: If you correct your artist name (tip: look for it in the album link you provided) review text should show

  • godrick
  • [*][*][*][*]
[Not my release] Biography view
Reply #476
mjm716, I generally get poor results from allmusic searches whenever I have parentheses or brackets in an album name, so per Romor's suggestions in post #422, I replace the following in the latest script to eliminate everything within and including trailing parentheses in what is used by the script without altering my files' tag fields.  If you have brackets or leading parentheses in your album names, you can expand on concept by altering the second new line below:

Replace:
URL = "http://www.allmusic.com/search/albums/" & LCase(Replace(ARG(1), " ", "+"))

With:
  If InStr(ARG(1),"(")>0 Then
    ALBUM = Trim(Mid(ARG(1),1,InStr(ARG(1),"(")-1))
    Else
      ALBUM = ARG(1)
  End If
URL = "http://www.allmusic.com/search/albums/" & LCase(Replace(ALBUM, " ", "+"))
  • Last Edit: 14 July, 2012, 06:13:20 PM by godrick

  • doniwko
  • [*]
[Not my release] Biography view
Reply #477


Can you please tell  why, when playing the album in *.flac, cover is not stored in a folder ? Biography of it is loaded, but it remains only an empty folder with the name of the album in folder album instead of the cover
  • Last Edit: 11 August, 2012, 10:04:24 AM by doniwko

  • romor
  • [*][*][*][*][*]
[Not my release] Biography view
Reply #478
New script for showing stream track info: view download

Initially I was doing script for shoutcast streams with 7.html trick, but after testing later it turned out it was unnecessary because soon as stream track changes, biography view is notified about the change (dynamic artist and title), but I leave function commented at bottom as reference.
So basically it is now showing selected last.fm info for provided artist and title, when such info may be desired and unknown, as while listening streams
It also "exposes" MBIDs: artist_mbid, album_mbid and track_mbid, so can be tweaked trivially further

Usage: cscript //nologo foo_shout.vbs "%artist%" "%title%"

Example showing all info (artist short bio and album tracklisting can be disabled):
  • Last Edit: 18 August, 2012, 01:04:04 PM by romor

  • Daeron
  • [*][*][*][*][*]
[Not my release] Biography view
Reply #479
Can you please tell  why, when playing the album in *.flac, cover is not stored in a folder ? Biography of it is loaded, but it remains only an empty folder with the name of the album in folder album instead of the cover

What if you do not use brackets? If %album% is empty it probably won't be queried anyway, so it's pointless to have those. If that doesn't help what if you use a static filename? Try these:

Code: [Select]
$replace(%path%,%filename_ext%,%album%)
$replace(%path%,%filename_ext%,cover)

  • romor
  • [*][*][*][*][*]
[Not my release] Biography view
Reply #480
just a note that allmusic script is updated due to minor changes on their site

  • godrick
  • [*][*][*][*]
[Not my release] Biography view
Reply #481
Works great - thanks for catching this and updating so quickly!  I've learned a lot from the elegant approach you took with your May version, and the few changes needed to keep up with allmusic's latest changes certainly shows the flexibility of your script.

  • romor
  • [*][*][*][*][*]
[Not my release] Biography view
Reply #482
Thanks godrick

Changes were really minor, unlike their previous revamp
And their portals (rovi) look really nice, functional too, I doubt they'll do major change in near future

[Not my release] Biography view
Reply #483
I am, quite honestly, fairly confused about how to set-up the 3 tabs under the last.fm section of Biography so that I can download album art.
I've put some stuff in, and album art seems to be downloading into a folder in my Foobar2000 folder, but I'm not entirely sure if I'm doing this correctly.
Here are the 3 tabs under last.fm for me.







I'm also curious as to whether the album art that is downloaded will transfer over to my iPod when synced.

Any help or advice would be appreciated.

EDIT: It seems that it's only downloading album art for albums I've visited. Is there any way to make it search through all my albums by itself?
  • Last Edit: 15 October, 2012, 10:11:47 PM by SaintAckbar

  • romor
  • [*][*][*][*][*]
[Not my release] Biography view
Reply #484
just a note that allmusic script is updated due to minor changes on their site

sorry for poor update
updated again, hopefully better this time

  • marc2003
  • [*][*][*][*][*]
[Not my release] Biography view
Reply #485
^that is definitely much better. thanks.

  • romor
  • [*][*][*][*][*]
[Not my release] Biography view
Reply #486
Eh marc2003, you are fast
I noticed later that exit loops improve performance and additionally updated again (30min ago)
Nothing critical thou

  • romor
  • [*][*][*][*][*]
[Not my release] Biography view
Reply #487
I updated allmusic script yet again, this time to add new feature while rest stays simple as was

I added caching, as Biography View caching mechanism works just for built-in last.fm service, and dislike the idea of re-requesting while using HTML DOM object, for several reasons
New version caches data in XML file (optional), located in folder where script is called from, with this kind of scheme:

Code: [Select]
<Items> 
    <Item
        Id="xs:string [md5(artist & album)]"
        ArtistId="xs:string [Rovi Music ID]"
        AlbumId="xs:string [Rovi Music ID]">
        <!-- artist // album -->
            <bio> xs:string </bio>
            <review> xs:string </review>
    </Item>
</Items>

Actual simple DTD, to validate upon possible problem is here (thou who will need it?): http://db.tt/8vpR4pKJ

Artist biography caching is tied to album combination, for obvious reasons, and for other obvious reason artist and album titles are stored in XML comment and identified by md5 hash

  • godrick
  • [*][*][*][*]
[Not my release] Biography view
Reply #488
Romor, my powers of observation failed me in not seeing with the script update last week that my biography panel was failing over to last.fm results rather than displaying allmusic results.  I still think this is great work even if I can't determine at times when it's working or not! 

Since I have a few mods to the basic script, I typically edit my script to add the changes and run it via a cmd window to get better feedback than available in the panel as I make changes, and once working in the cmd window, I try it in the panel and it works and I'm done.  That process normally works well, except this time - I get different results from the same script running in the cmd window than with the panel!

More specifically, I never could get the unaltered version just before the caching change (which I named "17.vbs") to work.  It bombs with the error message
" 17.vbs(12, 5) Microsoft VBScript runtime error: Object required: 'content' "

Lines 11 and 12, respectively of the script are:
    Set content = HTM.getElementById("content")
    Set rows = content.getElementsByTagName("tr")

...which seem fine.  I tweaked them anyway to try to get beyond this error but just got other errors.  I finally gave up and just ran it in the panel, and the panel does not error on this - it works just fine in the panel.  I haven't tried the version with the caching capability, but given the nature of that change I don't expect any impact on this mystery.

I've never encountered a situation before where this (or any other) script works in either the cmd window or the panel, but not the other.  I'm running Windows 7 32bit.  Since the script works in the panel that's all that really matters, but if there is any explanation for this so I can rely on the cmd window results in the future, any explanation or advice is appreciated.
  • Last Edit: 18 October, 2012, 01:00:47 PM by godrick

  • romor
  • [*][*][*][*][*]
[Not my release] Biography view
Reply #489
If command lines are same you should get same output

Try to dump HTM object output: "WScript.Echo HTM.body.innerHTML" before setting content and maybe deduce the problem
In any case, if script got to that point, you should have html with id="content" inside

If you have more questions, feel free to PM me

  • godrick
  • [*][*][*][*]
[Not my release] Biography view
Reply #490
Thanks for the tip - it was indeed erroring because there was nothing in HTM via the cmd window.  A reboot seemed to solve it - very strange, but just glad the script continues to work great in the panel.

One of the mods I add is no longer effective given the website changes.  With the previous website design, search results were paged, and I could search beyond the first page with a simple change.  I have a number of albums that have common names ("Greatest Hits") for artists not as common (James Taylor), such that the searched album was typically 7 or 8 pages deep in the results.  Thus, if searching the first page of results was unsuccessful, my modded script conducted another search of several more pages by appending /all/10 or another multiple of 10 to the original search string.  I enclosed the core search code lines within a very simple loop:

    If album_link = "" Then
      For n = 10 To 200 Step 10
        URL = "http://www.allmusic.com/search/albums/" & LCase(Replace((ARG(1), " ", "+")) & "/all/" & n 
        (rest of core search portion of script)
    End If   

...but this no longer works because of Rovi's scroll-triggered addition of search results without reloading the page.  Certainly not a big deal and definitely not worth anything beyond a minimal effort, but if there is a similarly clever and almost painless way to expose additional search results, I'd like to do it.  I googled "screen scraping" and jQuery, but nothing popped out at me that I could recognize as appropriate.  Any tips, references or better googling keywords appreciated!
  • Last Edit: 18 October, 2012, 08:26:31 PM by godrick

  • romor
  • [*][*][*][*][*]
[Not my release] Biography view
Reply #491
godrick, use this instead:

Code: [Select]
URL = "http://www.allmusic.com/search/ajax_results/albums/" & LCase(Replace((ARG(1), " ", "+")) & "/all/" & n




  • godrick
  • [*][*][*][*]
[Not my release] Biography view
Reply #492
Romor, thanks for the tip.  That code line returned a web page of search results that is the same as the results returned by the URL of a normal search, and ignores the "/all/" & n portion, so every time the loop iterates, I get a search page of the same first 20 results.

So unless there is a another mod to the search string to ask for more results, it seems the only way to get more results is to virtually trigger the scroll down function in some way.  Upon a more careful look at the source page for a search I conduct via the browser, when a user manually scrolls down the source page does indeed update to contain the additional search results.

What I tried: I created a new version of Function Request (URL), which I call Function Request2 (URL), and just before 
Code: [Select]
Request = HTTP.responseText
I added 
Code: [Select]
HTTP.SendKeys "{PGDN}"
to try to simulate what a user would do.  The script bombed with the error "Object doesn't support this property or method: 'HTTP.Sendkeys'"

My experimenting showed that SendKeys doesn't error out when I attempt this:
Code: [Select]
Set objShell=CreateObject("WScript.Shell")
objShell.SendKeys "{PGUP}"


It feels like I'm close for better or worse.  I can't tell if I'm sending the command incorrectly, need a different command, haven't and perhaps can't ensure that focus is maintained on the desired object, or if this just isn't possible given the nature of the object I'm trying to control.

Falstaff, I saw that you were trying to use SendKey here, so if you succeeded and have any advice for good or bad on this, it's appreciated.


  • romor
  • [*][*][*][*][*]
[Not my release] Biography view
Reply #493
Romor, thanks for the tip.  That code line returned a web page of search results that is the same as the results returned by the URL of a normal search, and ignores the "/all/" & n portion, so every time the loop iterates, I get a search page of the same first 20 results.

Really?

http://www.allmusic.com/search/ajax_result...test+hits/all/0
http://www.allmusic.com/search/ajax_result...est+hits/all/20
http://www.allmusic.com/search/ajax_result...est+hits/all/40

  • godrick
  • [*][*][*][*]
[Not my release] Biography view
Reply #494
aha! Such a simple check that I didn't do  - I just relied on what was echoing in my cmd window - thanks!  It tells me that I've got a problem in my secondary search loop, and in addition to that all I was doing was echoing the results of the first search when I thought I was seeing search results of the secondary search.

I can figure it out from here, or if I can't, I don't deserve to further inflict my inability on anyone else to get it done.  Thanks again!

  • romor
  • [*][*][*][*][*]
[Not my release] Biography view
Reply #495
Apologies to users of allmusic script, but I made another update which may be of interest

While trying to improve performance, as I was feeling that something must be wrong when it takes 4-5 seconds to retrieve the data while similar scheme in other scripting language is executed in less then second, I falsely suspected Htmlfile object and tried to remove it with regex.
Luckily I did the timings, and problem was pointing to Request function and it turned out that using "Msxml2.ServerXMLHTTP" was offender, which I corrected, and now script is back on track - result in second or two

Why is recommended "Msxml2.ServerXMLHTTP" slower then "Msxml2.XMLHTTP" I don't know, but here is a link: http://msdn.microsoft.com/en-us/library/wi...p/ms762278.aspx

[Not my release] Biography view
Reply #496
@ romor,

Thanks for your scripts.
I have a very "noob-ish" question  but is it possible to execute your script if foo_allmusic.vbs is in "C:\Users\...\AppData\Roaming\foobar2000\" folder instead of in "C:\Program Files (x86)\foobar2000" ?
Decalicatan Decalicatan

  • romor
  • [*][*][*][*][*]
[Not my release] Biography view
Reply #497
If it's not in your foobar folder, then just enter full path to it:

cscript //nologo "C:\Users\...\AppData\Roaming\foobar2000\foo_allmusic.vbs" "%album artist%" "%album%" review

  • PeteG
  • [*][*][*]
[Not my release] Biography view
Reply #498
@romor
@godrick

Sadly, I have had some trouble with marc2003's allmusic script suite (WSH Panel Mod) recently and decided to give your solution a try.
And ... this is indeed convincing stuff! romor, you've got a new member in your fan club!
And thanks to godrick for having asked the right questions over time, especially about accented letters. Without your inspiring dialogs with romor I would probably have been lost  .
Initially I made a local copy of those AMG biographies and reviews that matches the rhythmic part of my Media Library:
Cache = 1 was left untouched in the latest installment of foo_allmusic.vbs.
A simple foobar2000 filter - %tracknumber% IS 01 AND %discnumber% IS 1 - produced a playlist with 4,300 items.
The Preview component was activated (Preview Length = 15 seconds, a lesser value is probably okay, but better safe than sorry).
Some 18-19 hours (!) later the harvesting was done, yielding a single 20 MB XML file. And all was pure joy!
Except of course all those times where I disagree with AMG's (inconsistent) naming of artists and albums resulting in nothing ...
E.g.: I have 27 Magma albums (the French zeuhl outfit). AMG has 11 reviews. Only a few landed in my basket.
In the case of the 'Ẁurdah Ïtah' album (AMG gives it two names: 'Wurdah Ïtah/Tristan et Iseult' resp. 'Wurdah Ïtah') I may have found a primitive solution. If the solution is feasible, I'll send another post. It might be of some use in other situations.

I have a few questions. If they are stupid just ignore them, I'm a foobar2000, vbs, and xml newbie - and expect to be the laughing stock from time to time.

1. Why is it necessary to use UTF-16 in the Server settings (UTF-8 isn't good, and ANSI is worse), when your script generates UTF-8?

Code: [Select]
If Not oFS.FileExists("romor\foo_allmusic.xml") Then
      oXml.loadXML "<?xml version='1.0' encoding='UTF-8'?><Items></Items>"
      oXml.save "romor\foo_allmusic.xml"
    Else

I use this

Code: [Select]
cscript //U //Nologo romor\foo_allmusic.vbs "%album artist%" "%album%" bio|review

The //U option only tells cscript to "Use Unicode for redirected I/O from the console" as far as I can tell, not the encoding type.
Or is the answer to my question blowin' in the cyberspace?

2. I suppose my little lump of gold - the 20 MB all_music.xml file - is more or less static?
The cache never expires. If AMG makes a change in an artist bio (or, more unlikely, in a review) it won't be downloaded. New artists and/or albums in my collection will of course get an entry in the file, when AMG has produced some text.
romor, is it beyond the scope of your very compact and streamlined script to make some sort of date check and make an AMG lookup accordingly? I imagine something like this:

Code: [Select]
<!ELEMENT Items (Item+)>
<!ELEMENT Item ((review?, bio?) | (bio?, review?))>
<!ATTLIST Item
    Id CDATA #REQUIRED
    DateId CDATA #REQUIRED
    ArtistId CDATA #REQUIRED
    AlbumId CDATA #REQUIRED
>
<!ELEMENT review (#PCDATA)>
<!ELEMENT bio (#PCDATA)>

If I load an artist in fb2k with an excisting AMG bio in the xml file, the script performs a check: if DateId is expired then make a request to AMG. Or is this either gibberish or impossible? The evident alternative for me is of course to perform a harvest like the above say every 90 days, that's not a problem at all.

3. If I interpret the script correctly the whole xml file is loaded into memory - and stays there - at the first request?

Code: [Select]
oXml.loadXML "<?xml version='1.0' encoding='UTF-8'?><Items></Items>"

I have not encountered any performance issues, that's very, very nice! Even on and old Vista PC with 3½ cylinders. In the actual implementation there is some inevitable redundancy. I have over 50 albums with Frank Zappa. All the reviews has the biography appended to them in the file; I suppose this is a contributing factor to the short load times in the Bio View panel or is it without relevance?
  • Last Edit: 22 October, 2012, 10:13:13 PM by PeteG

  • romor
  • [*][*][*][*][*]
[Not my release] Biography view
Reply #499
Glad to have you PeteG

I may have found a primitive solution. If the solution is feasible, I'll send another post. It might be of some use in other situations.

What is it?

1. Yes //U option outputs UTF-16 encoded stream which UTF-8 option can't catch. Use default if you don't care about accents or your code page provides support. Even if data in XML cache is stored as UTF-8 you output UTF-16 with //U option

2. That is good idea. I don't know if they change reviewes thou, but as datetime is easy in vbs, maybe I'll add it.

3. File is loaded async by default, by XML parser. Snippet you quoted just adds contents to new cache file, if it doesn't exist.

There are many artists with same names, and pairing artist with album solves couple of problems in one turn
Also you could aggregate cache file from command line