All Movie Guide Script
All Movie Guide Script
Just getting started with this very cool software, and so far I like the data returned by All Movie Guide (www.allmovie.com) the best. The script seems to work fine EXCEPT it does not retrieve the LENGTH (Run Time) field data. I've looked at the script and at the web page and I don't see the difference between the YEAR field and the RUN TIME field, yet the YEAR is downloaded fine but the RUN TIME is blank--with every movie.
Can anyone help with this script? Thanks.
Can anyone help with this script? Thanks.
Insert a second space before 'min', else this space will be part of the length variable, which makes it impossible to be imported.
Change
to
Change
Code: Select all
Value := GetStringFromHTML(Value, 'class="formed-sub">', 'class="formed-sub">', ' min');
Code: Select all
Value := GetStringFromHTML(Value, 'class="formed-sub">', 'class="formed-sub">', ' min');
Adding the space works IF the movie is 100 minutes or longer. But if it's 99 mins or less nothing is imported--for example:
http://www.allmovie.com/cg/avg.dll?p=avg&sql=1:313721
http://www.allmovie.com/cg/avg.dll?p=avg&sql=1:284796
How can I modify the script to work for "2-digit" time entries? Thanks VERY much for your help!
<<Brad>>
http://www.allmovie.com/cg/avg.dll?p=avg&sql=1:313721
http://www.allmovie.com/cg/avg.dll?p=avg&sql=1:284796
How can I modify the script to work for "2-digit" time entries? Thanks VERY much for your help!
<<Brad>>
You're right, sorry. The few films I used for testing had a length > 100 min., so I couldn't see that problem.
In this case it might be better to use the original line and add an extra line that simply deletes the spaces from variable value.
Something like this should work:
or
In this case it might be better to use the original line and add an extra line that simply deletes the spaces from variable value.
Something like this should work:
Code: Select all
Value := GetStringFromHTML(Value, 'class="formed-sub">', 'class="formed-sub">', ' min');
Value := TextBefore(Value, ' ', '');
Code: Select all
Value := GetStringFromHTML(Value, 'class="formed-sub">', 'class="formed-sub">', ' min');
Value := StringReplace(Value, ' ', '');
Didn't try the second version but the first one works fine--perfect! Thanks again for your help. I'll try to spend a little time studying what you did so I can understand and hopefully be able to fix it if they change the web site format.
How can we get your code inserted into the "official" script that new users download so everyone can benefit from the fix?
How can we get your code inserted into the "official" script that new users download so everyone can benefit from the fix?
If the script should no longer be supported by its authors (it seems to be quite old) simply release the updated version here on forum. As it is only a small fix, you can instead ask antp to do the changes directly on the current script from his server, I guess.
In both cases be sure that the fix is well tested with a couple of movies.. the more, the better - but at least some more than I tested
In both cases be sure that the fix is well tested with a couple of movies.. the more, the better - but at least some more than I tested

While you're playing Jedi Master of Scripts, maybe you can spot why some listings on All Movie Guide (only some) import the director's name twice--once into the Director field (which is correct of course) and again into the Translated Title field. Here are some examples:
http://www.allmovie.com/cg/avg.dll?p=av ... n|Hiver~T1
http://www.allmovie.com/cg/avg.dll?p=av ... leaming~T1
http://www.allmovie.com/cg/avg.dll?p=av ... |Raider~T1
Most movies import correctly with your script corrections, but maybe 1 out of 10 does the weird Director to Translated Title bug. Do you see why with the examples above? Thanks again.
http://www.allmovie.com/cg/avg.dll?p=av ... n|Hiver~T1
http://www.allmovie.com/cg/avg.dll?p=av ... leaming~T1
http://www.allmovie.com/cg/avg.dll?p=av ... |Raider~T1
Most movies import correctly with your script corrections, but maybe 1 out of 10 does the weird Director to Translated Title bug. Do you see why with the examples above? Thanks again.
This bug is not related to the previous correction. As I said before, the script seems quite old (from 2006), so there might be more problems because of website changes. It seems to import director into fieldTranslatedTitle if there are "AKA" titles on the website. For "AKA" the script tries to import a single line instead of a list and so misses correct start and end tags - and the next single line value is director which instead of aka titles is imported to fieldTranslatedTitle.
This should fix the problem, but maybe you should consider using a newer script which is updated regularly..?
Code: Select all
// AKA -> translated title
if CanSetField(fieldTranslatedTitle) then
begin
Value := TextAfter(Content, '<span>AKA</span>');
Value := TextBetween(Value, '<ul>', '</ul>');
Value := StringReplace(Value, '<li></li>', ' ');
Value := GetStringFromList(Value, ';');
SetField(fieldTranslatedTitle, Value);
end;
I'll give this a try, with my thanks. But where do I find a newer script? I looked on the web site and did not see a newer version--maybe I'm looking in the wrong place? Also, in your opinion is there a better web site to be importing data from that has a good comprehensive synopsis and a "professional" review?
Finally, sorry this is unrelated, but is there a way to generate a list or report within the program so that the word "The" is disregarded and the titles are alphabetized correctly? Thanks.
Finally, sorry this is unrelated, but is there a way to generate a list or report within the program so that the word "The" is disregarded and the titles are alphabetized correctly? Thanks.
With "newer" I meant a current version of any other script, not a newer version of this script. You will find latest scripts on http://update.antp.be/amc/scripts or using the "Update Scripts" script. Maybe IMDB is an option for you, but I cannot really recommend any other script, as I don't use english scripts myselfk9bm wrote:But where do I find a newer script? I looked on the web site and did not see a newer version--maybe I'm looking in the wrong place? Also, in your opinion is there a better web site to be importing data from that has a good comprehensive synopsis and a "professional" review?

Tools -> Preferences -> Movie List -> Title formattingFinally, sorry this is unrelated, but is there a way to generate a list or report within the program so that the word "The" is disregarded and the titles are alphabetized correctly? Thanks.
It will affect the look of the movie list and the virtual field fieldFormattedTitle contains this variable (e.g. for printing reports you can use [FormattedTitle] ). Click on the "Title" header of the movie list to sort in alphabetical order.