@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?
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
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:
<!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?
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?