For some months I have been away from Ant Movie Archive, and now I'm back it don't work. When I try to use the IMBd script I just get a cryptic Italian answer with the words "Risultati Ricerca", say "Risultati Ricerca per Apocalypse Now". I've hit "update scripts" but it didn't help any. Do anyone know what is wrong ?
Cheers
Morten Levy, Denmark
IMDb script doesn't work
-
- Posts: 764
- Joined: 2007-04-28 05:46:43
- Location: Italy
Re: IMDb script doesn't work
Are You sure to execute IMDB script? It's a really unexpected message....mortenl wrote:... When I try to use the IMBd script I just get a cryptic Italian answer with ...
Morten Levy, Denmark
Could You copy and paste the script code you are executing?
Which movie informations are You looking For?
Fulvio53s03, Italy

Thank you for your reply.
I would have sent the information you ask for as attached files with screen dumps etc, but I cannot find a way to do that, so, instead I have to just tell you. I searched for "Apocalypse now" and just got 'Risultati Ricerca per "Apocalypse now" ' . Then I tried with URL, searched for "http://www.imdb.com/find?q=apocalypse+now&s=all" , and got 'Risultati Ricerca per "http://www.imdb.com/find?q=apocalypse+now&s=all" '.
The text of the IMDB script is quoted below as a PS.
Regards
Morten Levy
PS.
program IMDB;
uses
StringUtils1;
// ***** Manually set UserCountry to your required Classification Country below *****
const
//UserCountry = '';
{ Delete the line above and remove the "//" in front of one the
following lines, or add your country if it is not listed }
UserCountry = 'USA';
//UserCountry = 'Canada';
//UserCountry = 'Mexico';
//UserCountry = 'Brazil';
//UserCountry = 'Argentina';
//UserCountry = 'Australia';
//UserCountry = 'India';
//UserCountry = 'Italy';
//UserCountry = 'Spain';
//UserCountry = 'Portugal';
//UserCountry = 'France';
//UserCountry = 'Germany';
//UserCountry = 'Netherlands';
//UserCountry = 'UK';
//UserCountry = 'Ireland';
//UserCountry = 'Finland';
//UserCountry = 'Norway';
//UserCountry = 'Sweden';
//UserCountry = 'Switzerland';
PopularTitleSearchURL = 'http://www.imdb.com/find?tt=1;q=';
FullTitleSearchURL = 'http://www.imdb.com/find?more=tt;q=';
EpisodeTitleSearchURL = 'http://www.imdb.com/find?s=tt;ttype=ep;q=';
var
MovieName: string;
MovieURL: string;
MovieNumber: string;
UpdateFile: TStringList;
function ConvertToASCII(AText: string): string;
begin
Result := AText;
if GetOption('ConvertToASCII') = 1 then
begin
if StringUtils1_Version > 5 then
Result := Cp1252ToASCII(AText)
else
ShowMessage('The "ConvertToASCII" option requires a newer version of StringUtils1.pas (at least version 6).' + #13#10 + 'Run the "Update Scripts" script to get it.');
end;
end;
// ***** analyzes IMDB's results page that asks to select a movie from a list *****
procedure AnalyzeResultsPage(Address: string);
var
PageText: string;
Value: string;
begin
PageText := ConvertToASCII(GetPage(Address));
if pos('<title>IMDb', PageText) = 0 then
begin
AnalyzeMoviePage(PageText)
end else
begin
if Pos('<b>No Matches.</b>', PageText) > 0 then
begin
if GetOption('BatchMode') = 0 then
ShowMessage('No movie found for this search.');
Exit;
end;
if GetOption('BatchMode') = 0 then
begin
PickTreeClear;
repeat
Value := TextBefore(PageText, '</b> (Displaying', '<p><b>');
if Value <> '' then
begin
HTMLRemoveTags(Value);
HTMLDecode(Value);
PickTreeAdd(Value, '');
end;
Value := TextBetween(PageText, '<table><tr>', '</table>');
PageText := RemainingText;
until not AddMovieTitles(Value);
Value := TextBefore(PageText, '"><b>more titles</b></a>', '<a href="');
if Value <> '' then
PickTreeMoreLink('http://www.imdb.com' + Value);
if GetOption('EpisodeTitleSearch') > 0 then
PickTreeMoreLink(EpisodeTitleSearchURL + UrlEncode(MovieName));
if PickTreeExec(Address) then
AnalyzeResultsPage(Address);
end
else
begin
Value := TextBetween(PageText, '.</td><td valign="top">', '</a>');
if Value <> '' then
AnalyzeResultsPage('http://www.imdb.com' + TextBetween(Value, '<a href="', '" onclick="'));
end;
end;
end;
// ***** analyzes Google's results page that asks to select a movie from a list *****
procedure AnalyzeGooglesResultsPage(GoogleAddress: string);
var
PageText: string;
Value: string;
Address: string;
begin
PageText := GetPage(GoogleAddress);
Address := '';
if Pos('did not match any documents', PageText) > 0 then
begin
ShowMessage('No movie found for this search');
Exit;
end;
if GetOption('BatchMode') = 0 then
begin
PickTreeClear;
PickTreeAdd('Google`s search results for "' + MovieName + '" on IMDB:', '');
repeat
Value := TextBetween(PageText, '<h3 class=r>', '</a>');
PageText := RemainingText;
Address := TextBetween(Value, '<a href="', 'maindetails"');
if (GetOption('AllActors') = 1) or (GetOption('Producer') = 1) then
if Address <> '' then
Address := Address + 'combined';
HTMLRemoveTags(Value);
HTMLDecode(Value);
if (Pos(') - ', Value) = 0) and (Value <> '') and (Address <> '') then
PickTreeAdd(Value, Address);
until Value = '';
if PickTreeExec(GoogleAddress) then
AnalyzeResultsPage(GoogleAddress);
end
else
begin
Value := TextBetween(PageText, '<h3 class=r>', '</a>');
Address := TextBetween(Value, '<a href="', 'maindetails"');
if (GetOption('AllActors') = 1) or (GetOption('Producer') = 1) then
if Address <> '' then
Address := Address + 'combined';
if Address <> '' then
AnalyzeResultsPage(Address);
end;
end;
// ***** adds the movie titles found on IMDB's results page *****
function AddMovieTitles(List: string): Boolean;
var
Value: string;
Address: string;
begin
Result := False;
Value := TextBetween(List, '.</td><td valign="top">', '</td>');
if GetOption('HideAkaTitles') = 1 then
Value := StringReplace(Value, TextAfter(Value, '<p class="find-aka">'), '')
else
Value := StringReplace(Value, 'aka', ' | aka');
List := RemainingText;
while Value <> '' do
begin
Address := TextBetween(Value, '<a href="/title/tt', '/');
// ##########
// if (GetOption('AllActors') = 1) or (GetOption('Producer') = 1) then
// Address := Address + '/combined'
// else
// Address := Address + '/';
Address := Address + '/combined';
// ##########
HTMLRemoveTags(Value);
HTMLDecode(Value);
// if GetOption('HideAkaTitles') = 1 then
// Value := Value + ')';
PickTreeAdd(Value, 'http://www.imdb.com/title/tt' + Address);
Result := True;
Value := TextBetween(List, '.</td><td valign="top">', '</td>');
if GetOption('HideAkaTitles') = 1 then
Value := StringReplace(Value, TextAfter(Value, '<br> '), '')
else
Value := StringReplace(Value, 'aka', ' | aka');
List := RemainingText;
end;
end;
// ***** analyzes the page containing movie information *****
procedure AnalyzeMoviePage(PageText: string);
var
Value, Value2, Value3, FullValue: string;
p, Count: Integer;
begin
MovieNumber := TextBetween(PageText, '<input type="hidden" name="auto" value="legacy/title/tt', '/');
if MovieNumber = '' then
MovieNumber := TextBetween(PageText, '<input type="hidden" name="auto" value="legacy/title/tt', '/combined"');
if MovieNumber = '' then
MovieNumber := TextBetween(PageText, '<link rel="canonical" href="http://www.imdb.com/title/tt', '/');
// #########
// if ((GetOption('AllActors') = 1) or (GetOption('Producer') = 1)) and (Pos('<div id="tn15" class="maindetails">', PageText) > 0) then
// PageText := ConvertToASCII(GetPage('http://www.imdb.com/title/tt' + MovieNumber + '/combined'));
if Pos('/combined"', TextBetween(PageText, '<link rel="canonical"', '/>')) = 0 then
PageText := ConvertToASCII(GetPage('http://www.imdb.com/title/tt' + MovieNumber + '/combined'));
// #########
MovieURL := 'http://imdb.com/title/tt' + MovieNumber;
// URL
if CanSetField(fieldURL) then
SetField(fieldURL, MovieURL);
// OriginalTitle & Year
if CanSetField(fieldOriginalTitle) or CanSetField(fieldYear) then
begin
Value := TextBetween(PageText, '<title>', '</title>');
p := Pos(' (1', Value);
if p = 0 then
p := Pos(' (2', Value);
Value2 := Copy(Value, 0, p-1);
Value := Copy(Value, p+2, Length(Value));
HTMLDecode(Value2);
if CanSetField(fieldOriginalTitle) then
SetField(fieldOriginalTitle, Value2);
if Pos('/', Value) > 0 then
Value2 := TextBefore(Value, '/', '')
else
Value2 := TextBefore(Value, ')', '');
if CanSetField(fieldYear) then
SetField(fieldYear, Value2);
end;
// Picture
if CanSetPicture then
begin
case GetOption('ImageKind') of
2: if not ImportSmallPicture(PageText) then
ImportPictureNotAvailable(PageText);
3: if not ImportLargePicture(PageText) then
if not ImportSmallPicture(PageText) then
ImportPictureNotAvailable(PageText);
4: if not ImportMerchandisingPicture then
if not ImportDvdDetailsPicture then
ImportSmallPicture(PageText);
5: if not ImportDvdDetailsPicture then
if not ImportMerchandisingPicture then
ImportSmallPicture(PageText);
else
ImportSmallPicture(PageText);
end;
end;
// Director
if CanSetField(fieldDirector) then
begin
Value := TextBetween(PageText, '<h5>Director:', '</div>');
if Value = '' then
Value := TextBetween(PageText, '<h5>Director', '</div>');
if Pos(':<', Value) > 0 then
Value := '<' + TextAfter(Value, ':<');
if Pos('<p>', Value) > 0 then
Value := TextBetween(Value, '<p>', '</p>');
Value := StringReplace(Value, '<br/>', ',');
HTMLRemoveTags(Value);
HTMLDecode(Value);
Value := StringReplace(Value, ', more', '');
Value := StringReplace(Value, ', (more)', '');
Value := StringReplace(Value, ' ', '');
Value := StringReplace(Value, #13, '');
Value := StringReplace(Value, #10, '');
Value := StringReplace(Value, #9, '');
Value := StringReplace(Value, ',', ', ');
if Copy(Value, Length(Value) - 1, 2) = ', ' then
Value := Copy(Value, 0, Length(Value) - 2);
SetField(fieldDirector, Value);
end;
// Actors
if CanSetField(fieldActors) then
begin
Value := FullTrim(TextBetween(PageText, '<table class="cast">', '</table>'));
if Value <> '' then
begin
FullValue := '';
Count := 0;
case GetOption('ActorsLayout') of
0, 1:
while Pos('<tr', Value) > 0 do
begin
Value2 := TextBetween(Value, '<tr', '</tr>');
Value := RemainingText;
if Pos('rest of cast', Value2) > 0 then
Continue;
if FullValue <> '' then
FullValue := FullValue + #13#10;
TextBefore(Value2, '</td>', '');
Value2 := FullTrim(TextBetween(Value2, '<td class="nm">', '</td>'));
HTMLRemoveTags(Value2);
if Value2 <> '' then
begin
FullValue := FullValue + Value2;
Count := Count + 1;
end;
// ###
if (Count = 15) and (GetOption('AllActors') = 0) then
Break;
// ###
if (Count = 10) and (GetOption('AllActors') = 2) then
Break;
end;
2, 3:
while Pos('<tr', Value) > 0 do
begin
Value2 := TextBetween(Value, '<tr', '</tr>');
Value := RemainingText;
if Pos('rest of cast', Value2) > 0 then
Continue;
if FullValue <> '' then
FullValue := FullValue + #13#10;
TextBefore(Value2, '</td>', '');
Value2 := FullTrim(TextBetween(Value2, '<td class="nm">', '</td>'));
HTMLRemoveTags(Value2);
if Value2 <> '' then
begin
FullValue := FullValue + Value2;
Value2 := FullTrim(TextBetween(RemainingText, '"char">', '</td>'));
if Value2 <> '' then
FullValue := FullValue + ' (as ' + Value2 + ')';
Count := Count + 1;
// ###
if (Count = 15) and (GetOption('AllActors') = 0) then
Break;
// ###
if (Count = 10) and (GetOption('AllActors') = 2) then
Break;
end;
end;
4:
begin
FullValue := Value;
FullValue := StringReplace(FullValue, ' <tr><td align="center" colspan="4"><small>rest of cast listed alphabetically:</small></td></tr>', '');
FullValue := StringReplace(FullValue, '> <', '><');
FullValue := StringReplace(FullValue, '</tr>', #13#10);
end;
end;
HTMLRemoveTags(FullValue);
HTMLDecode(FullValue);
case GetOption('ActorsLayout') of
0, 2:
FullValue := StringReplace(FullValue, #13#10, ', ');
end;
SetField(fieldActors, FullValue);
end;
end;
//Country
if CanSetField(fieldCountry) then
begin
SetField(fieldCountry, ImportList(PageText, GetOption('MultipleValuesCountry'), '/country/'));
end;
//Category
if CanSetField(fieldCategory) then
begin
SetField(fieldCategory, ImportList(PageText, GetOption('MultipleValuesCategory'), '/Genres/'));
end;
// Language
if CanSetField(fieldLanguages) then
begin
SetField(fieldLanguages, ImportList(PageText, GetOption('MultipleValuesLanguages'), '/language/'));
end;
// Audio Format
if CanSetField(fieldAudioFormat) then
begin
SetField(fieldAudioFormat, ImportList(PageText, GetOption('MultipleValuesAudioFormat'), '/search/title?sound_mixes='));
end;
// Aspect Ratio
begin
Value := '';
Value := TextBetween(PageText, '<h5>Aspect Ratio:</h5>', '</div>');
if Pos('<p>', Value) > 0 then
Value := TextBetween(Value, '<p>', '</p>');
if Pos('<a ', Value) > 0 then
Value := TextBefore(Value, '<a ', '');
HTMLRemoveTags(Value);
HTMLDecode(Value);
Value := FullTrim(Value);
Value := StringReplace(Value, ', more', '');
Value := StringReplace(Value, ', (more)', '');
Value := StringReplace(Value, ' more', '');
if (CanSetField(fieldVideoFormat)) and (GetOption('AspectRatio') = 1) then
SetField(fieldVideoFormat, Value);
if (CanSetField(fieldResolution)) and (GetOption('AspectRatio') = 2) then
SetField(fieldResolution, Value);
end;
// Description
if CanSetField(fieldDescription) then
begin
Value := TextBetween(PageText, '<h5>Plot:</h5>', '</div>');
if Value = '' then
Value := TextBetween(PageText, '<h5>Plot Summary:</h5>', '</div>');
if Pos('<p>', Value) > 0 then
Value := TextBetween(Value, '<p>', '</p>');
Value := StringReplace(Value, '<div class="info-content">', '');
Value := StringReplace(Value, Textbetween(Value, '| <a class="tn15more inline" href="synopsis">', '</a>'), '');
Value := StringReplace(Value, Textbetween(Value, '<a class="tn15more inline" href="synopsis">', '</a>'), '');
Value := StringReplace(Value, '| <a class="tn15more inline" href="synopsis"></a>', '');
Value := StringReplace(Value, '<a class="tn15more inline" href="synopsis"></a>', '');
Value := StringReplace(Value, '»', '');
if (Value = #13#10 + #13#10) or (Value = #13#10) then
Value := '';
if (GetOption('DescriptionSelection') = 0) and (Pos('<a class="tn15more inline"', Value) > 0) then
Value := TextAfter(Value, #13#10);
if Value <> '' then
SetField(fieldDescription, ImportSummary(Value));
end;
// Length
if CanSetField(fieldLength) then
begin
Value := TextBetween(PageText, '<h5>Runtime:</h5>', '</div>');
if Pos('<p>', Value) > 0 then
Value := TextBetween(Value, '<p>', '</p>');
Value := TextBefore(Value, ' min', '');
HTMLRemoveTags(Value);
Value := FullTrim(Value);
if Value <> '' then
begin
if Pos(':', Value) > 0 then
SetField(fieldLength, TextAfter(Value, ':'))
else
SetField(fieldLength, Value);
end;
end;
// Writer (Producer Field)
if CanSetField(fieldProducer) then
begin
if GetOption('Producer') = 1 then
begin
Value := TextBetween(PageText, 'Produced by</a></h5>', '</table>');
FullValue := '';
Value2 := TextBetween(Value, '<a href="/name/', '</a>');
while Value2 <> '' do
begin
Value := RemainingText;
Value2 := TextAfter(Value2, '">');
if FullValue <> '' then
FullValue := FullValue + ', ';
FullValue := FullValue + Value2;
Value2 := TextBetween(Value, '<a href="/name/', '</a>');
end;
HTMLDecode(FullValue);
SetField(fieldProducer, FullValue);
end
else
begin
Value := TextBetween(PageText, '<h5>Writer', '</div>');
if Pos(':<', Value) > 0 then
Value := '<' + TextAfter(Value, ':<');
if Pos('<p>', Value) > 0 then
Value := TextBetween(Value, '<p>', '</p>');
Value := StringReplace(Value, '<br/>', ',');
Value := StringReplace(Value, '>more<', '><');
HTMLRemoveTags(Value);
HTMLDecode(Value);
if Value <> '' then
begin
Value := StringReplace(Value, '..., more', '');
Value := StringReplace(Value, ', more', '');
Value := StringReplace(Value, '...', '');
Value := StringReplace(Value, ' &', '');
Value := StringReplace(Value, ' ', '');
Value := StringReplace(Value, #13, '');
Value := StringReplace(Value, #10, '');
Value := StringReplace(Value, #9, '');
Value := StringReplace(Value, ',', ', ');
Value := FullTrim(StringReplace(Value, ' and, ', ', '));
if Value <> '' then
while StrGet(Value, Length(Value)) = ',' do
begin
Delete(Value, Length(Value), 1);
Value := FullTrim(Value);
end;
SetField(fieldProducer, Value);
end;
end;
end;
// AKA Name
if CanSetField(fieldTranslatedTitle) then
begin
Value := TextBetween(PageText, '<h5>Also Known As:</h5>', '</div></div>');
if Value <> '' then
begin
Value := StringReplace(Value, 'See more', '');
Value := StringReplace(Value, '»', '');
Value := FullTrim(StringReplace(Value, '<br>', ', '));
HTMLRemoveTags(Value);
HTMLDecode(Value);
Value := FullTrim(Value);
if Value <> '' then
if StrGet(Value, Length(Value)) = ',' then
Delete(Value, Length(Value), 1);
SetField(fieldTranslatedTitle, Value)
end;
end;
// Comments
if CanSetField(fieldComments) then
begin
if (GetOption('CommentType') = 1) then
begin
Value := TextAfter(PageText,'/rg/title-nav-item/usercomments/');
if (Value <> '') or (Pos('href="usercomments" class="link"', PageText) > 0) then
begin
Value2 := '';
FullValue := ConvertToASCII(GetPage(MovieURL+'/usercomments'));
FullValue := TextAfter(FullValue, 'review useful:</small><br>');
while FullValue <> '' do
begin
Value := TextBetween(FullValue, '<b>', '<div');
Value2 := Value2 + #13#10 + #13#10 + TextBefore(Value, '</b>', '');
Value := RemainingText;
Value2 := Value2 + #13#10 + 'Date: ' + TextBetween(Value, '<small>', '</small>');
Value := RemainingText;
Value := 'Author: ' + TextBetween(Value, 'comments">', '<br>');
HtmlRemoveTags(Value);
Value2 := Value2 + #13#10 + Value;
Value := RemainingText;
Value := TextBetween(Value, '<p>' + #13#10, #13#10 + '</p>');
Value := StringReplace(Value, #13#10, ' ');
Value := StringReplace(Value, '<br><br>', #13#10);
Value := StringReplace(Value, '<br>', #13#10);
HtmlDecode(Value);
Value2 := Value2 + #13#10 + #13#10 + FullTrim(Value);
FullValue := TextAfter(FullValue, 'review useful:</small><br>');
end;
HTMLRemoveTags(Value2);
HTMLDecode(Value2);
SetField(fieldComments, 'USER COMMENTS:' + Value2 + #13#10);
end;
end
else
if (GetOption('CommentType') = 0) then
begin
Value := TextAfter(PageText, '/comments">');
if Value <> '' then
begin
Value := TextBetween(Value, '<p>', '</p>');
Value := StringReplace(Value, #13#10, ' ');
Value := StringReplace(Value, '<br>', #13#10);
HTMLRemoveTags(Value);
HTMLDecode(Value);
Value := FullTrim(Value);
while Pos(' ', Value) > 0 do
Value := StringReplace(Value, ' ', ' ');
while Pos(#13#10, Value) = 1 do
Delete(Value, 1, 2);
SetField(fieldComments, Value + #13#10);
end;
end
else
if (GetOption('CommentType') = 2) then
SetField(fieldComments, '');
end;
// TagLine
if GetOption('GetTagline') > 0 then
begin
Value := TextBetween(PageText, '<h5>Tagline:</h5>', '</div>');
if Pos('<p>', Value) > 0 then
Value := TextBetween(Value, '<p>', '</p>');
if Pos('<a', Value) > 0 then
Value := TextBefore(Value, '<a', '');
Value := TextAfter(Value, #13#10);
HTMLRemoveTags(Value);
HTMLDecode(Value);
Value := FullTrim(Value);
if Value <> '' then
begin
if StrGet(Value, 1) <> '"' then
Value := '"' + Value + '"';
case GetOption('GetTagline') of
1:
begin
if GetField(fieldDescription) <> '' then
Value := Value + #13#10 + #13#10 + GetField(fieldDescription);
SetField(fieldDescription, Value);
end;
2:
begin
if GetField(fieldComments) <> '' then
Value := Value + #13#10 + #13#10 + GetField(fieldComments);
SetField(fieldComments, Value);
end;
end;
end;
end;
// Trivia
if GetOption('Trivia') > 0 then
begin
sleep(50);
Value := MovieUrl;
FullValue := ConvertToASCII(GetPage(Value+'/trivia'));
case GetOption('Trivia') of
1,2:
Value := TextBetween(FullValue, '<div class="sodatext">', '<br>');
3,4:
Value := TextBetween(FullValue, 'class="soda">', #13#10 + #13#10 + #13#10 + '<!--');
end;
if Value <> '' then
begin
Value := StringReplace(Value, #13#10, '');
while Pos(' ', Value) > 0 do
Value := StringReplace(Value, ' ', '');
Value := StringReplace(Value, 'Link this trivia', '');
Value := StringReplace(Value, '<div class="sodatext">', #13#10 + '- ');
HTMLRemoveTags(Value);
HTMLDecode(Value);
case GetOption('Trivia') of
1,3:
begin
if GetField(fieldDescription) <> '' then
Value := GetField(fieldDescription) + #13#10 + #13#10 + 'IMDB TRIVIA: ' + Value
else
Value := 'IMDB TRIVIA: ' + Value;
SetField(fieldDescription, Value);
end;
2,4:
begin
if GetField(fieldComments) <> '' then
Value := GetField(fieldComments) + #13#10 + #13#10 + 'IMDB TRIVIA: ' + Value
else
Value := 'IMDB TRIVIA: ' + Value;
SetField(fieldComments, Value);
end;
end;
end;
end;
// Awards
if (GetOption('Awards') > 0) then
begin
ImportAwards();
end;
// Rating
if CanSetField(fieldRating) then
begin
// (Remove the "//" of the next two lines beginning with "Value" and add "//" to the following two lines beginning with Value
// if you would like to import arithmetic ratings instead of IMDB's user ratings)
// Value := ConvertToASCII(GetPage(MovieURL + '/ratings'));
// Value := TextBetween(Value, 'Arithmetic mean = ', '. ');
Value := TextBetween(PageText, '<h5>User Rating:</h5>', '</b>');
Value := TextBetween(Value, '<b>', '/');
if Value <> '' then
SetField(fieldRating, Value);
end;
if GetOption('UserRatings') > 0 then
begin
Value := TextBetween(PageText, '<a href="ratings" class="tn15more">', '</a>');
if Value <> '' then
Value := 'User Rating: ' + GetField(fieldRating) + ' out of 10 (with ' + Value + ')';
if (GetOption('UserRatings') = 1) and (Value <> '') and (CanSetField(fieldMediaType)) then
SetField(fieldMediaType, Value);
if (GetOption('UserRatings') = 2) and (Value <> '') then
SetField(fieldComments, GetField(fieldComments) + #13#10 + #13#10 + Value);
end;
// Classification
if GetOption('Classification') > 0 then
begin
if UserCountry = '' then
ShowMessage('Country not set for classification selection - Click "Editor" tab in the scripting window, then select your country by modifying the required line as explained in the first lines of the code')
else
begin
Value := TextBetween(PageText, '<a href="/search/title?certificates=', '</div>');
Value := TextBetween(Value, UserCountry + ':', '</a>'); if Value <> '' then
begin
if GetOption('Classification') = 1 then
SetField(fieldMediaType, Value)
else
SetField(fieldComments, GetField(fieldComments) + #13#10 + #13#10 + 'Classification: ' + Value);
end;
end;
end;
// MPAA rating
if (GetOption('MPAA') > 0) then
begin
Value := FullTrim(TextBetween(PageText, '<h5><a href="/mpaa">MPAA</a>:</h5>', '</div>'));
if Pos('<p>', Value) > 0 then
Value := TextBetween(Value, '<p>', '</p>');
HTMLRemoveTags(Value);
Value := FullTrim(Value);
// Value := TextAfter(Value, #13#10);
if Value <> '' then
begin
if GetOption('MPAA') = 1 then
SetField(fieldMediaType, TextBetween(Value, 'Rated ', ' '))
else
SetField(fieldComments, GetField(fieldComments) + #13#10 + #13#10 + Value);
end;
end;
end;
// ***** Imports lists like Genre, Country, etc. depending of the selected option *****
function ImportList(PageText: string; MultipleValues: Integer; StartTag: string): string;
var
Value, Value2: string;
begin
if MultipleValues = 0 then
begin
Value := TextBetween(PageText, StartTag, '</a>');
Value2 := TextAfter(Value, '">');
end
else
begin
Value := TextBetween(PageText, StartTag, '</div>');
Value2 := TextBefore(Value, '<a class="tn15more inline"', '');
if Value2 = '' then
Value2 := Value;
Value2 := TextAfter(Value2, '">');
HTMLRemoveTags(Value2);
if MultipleValues = 1 then
Value2 := StringReplace(Value2, ' | ', ', ');
if MultipleValues = 2 then
Value2 := StringReplace(Value2, ' | ', ' / ');
if MultipleValues = 3 then
Value2 := '';
end;
Value2 := StringReplace(Value2, #13#10, '');
Value2 := StringReplace(Value2, ' , ', ', ');
HTMLDecode(Value2);
Result := FullTrim(Value2);
end;
// ***** functions to import the different pictures kinds, depending of the option selected by user *****
//Import small picture from IMDB movie main page
function ImportSmallPicture(PageText: string): Boolean;
var
Value: string;
begin
Result := False;
Value := TextBetween(PageText, '<div class="photo">', '</div>');
if (Value <> '') and (Pos('"Poster Not Submitted"', Value) = 0) then
begin
Value := TextBetween(Value, 'src="', '"');
if Value <> '' then
begin
GetPicture(Value);
Result := True;
end;
end;
end;
//Import large image from link on IMDB movie main page
function ImportLargePicture(PageText: string): Boolean;
var
Value: string;
begin
Result := False;
Value := TextBetween(PageText, '<div class="photo">', '</div>');
if (Value <> '') and (Pos('"Poster Not Submitted"', Value) = 0) and (Pos('<a name="poster" href="/rg/action-box-title/primary-photo', Value) > 0) then
begin
Value := TextBetween(Value, 'href="/rg/action-box-title/primary-photo', '"');
if Value <> '' then
begin
Value := 'http://www.imdb.com' + Value;
Value := GetPage(Value);
Value := TextBetween(Value, '<div class="primary">', '</div>');
if (Value <> '') and (Pos(' src="', Value) > 0) then
begin
Value := TextBetween(Value, ' src="', '"');
GetPicture(Value);
Result := True;
end;
end;
end;
end;
//Image not available, import "No Poster Available" icon
function ImportPictureNotAvailable(PageText: string): Boolean;
var
Value: string;
begin
Result := False;
Value := TextBetween(PageText, '<div class="photo">', '</div>');
if (Value <> '') and (Pos('"Poster Not Submitted"', Value) > 0) then
begin
Value := TextBetween(Value, 'src="', '"');
if Value <> '' then
begin
GetPicture(Value);
Result := True;
end;
end;
end;
//Image from DVD Details Page
function ImportDvdDetailsPicture: Boolean;
var
Value, PageText: string;
begin
Result := False;
PageText := ConvertToASCII(GetPage(MovieUrl+'/dvd'));
Value := TextBefore(PageText, '.jpg alt="', '<table class="dvd_section" cellpadding="10"><tr>');
if Value <> '' then
begin
Value := TextBetween(Value, '<a href="', '">');
if Value <> '' then
Result := ImportFromAmazonRedirect('http://www.imdb.com' + Value);
end;
end;
//Image from Merchandising Links (/sales) Page
function ImportMerchandisingPicture: Boolean;
var
Value, PageText: string;
begin
Result := False;
PageText := ConvertToASCII(GetPage(MovieUrl+'/sales'));
Value := TextBefore(PageText, '.jpg" width=', '<td class=w_rowtable_colcover><a href="');
if Value <> '' then
begin
Value := TextBefore(Value, '"><img', '');
if Value <> '' then
Result := ImportFromAmazonRedirect('http://www.imdb.com' + Value);
end;
end;
function ImportFromAmazonRedirect(Url: string): Boolean;
var
Value, PageText: string;
begin
Result := False;
PageText := ConvertToASCII(GetPage(Url));
Value := TextBetween(PageText, '<td id="prodImageCell"', '" id="prodImage"');
// Value := StringReplace(TextAfter(Value, ' src="'), '_AA240', '');
Value := StringReplace(Value, TextBetween(Value, '_AA', '_'), '');
Value := StringReplace(TextAfter(Value, ' src="'), '_AA', '');
if Value <> '' then
begin
GetPicture(Value);
Result := True;
end;
end;
// ***** Gets summaries for the movie, based on the plot outline given in parameter (that contains the URL to more summaries) *****
function ImportSummary(PlotText: string): string;
var
Address, Value, Value2, Value3, Value4, PageText, Longest: string;
begin
Address := TextBetween(PlotText, '<a class="tn15more inline" href="', '" ');
if (Address = '') or (GetOption('DescriptionSelection') = 0) or (GetOption('DescriptionSelection') = 3) then
begin
Value3 := FullTrim(TextBefore(PlotText, '<a class="tn15more inline"', ''));
if Value3 = '' then
Value3 := FullTrim(PlotText);
HTMLRemoveTags(Value3);
HTMLDecode(Value3);
end;
if (Address <> '') and (GetOption('DescriptionSelection') > 0) then
begin
PageText := ConvertToASCII(GetPage('http://www.imdb.com' + Address));
PickListClear;
Longest := '';
Value := TextBetween(PageText, '<p class="plotpar">', '</p>');
PageText := RemainingText;
while Value <> '' do
begin
Value := TextBefore(Value, '<i>', '');
Value := FullTrim(StringReplace(Value, #13#10, ' '));
Value := StringReplace(Value, '<br>', #13#10);
HTMLRemoveTags(Value);
HTMLDecode(Value);
while Pos(' ', Value) > 0 do
Value := StringReplace(Value, ' ', ' ');
if Length(Value) > Length(Longest) then
Longest := Value;
PickListAdd(FullTrim(Value));
Value := TextBetween(PageText, '<p class="plotpar">', '</p>');
PageText := RemainingText;
end;
if (GetOption('BatchMode') > 0) or (GetOption('DescriptionSelection') = 2) then
Value4 := Longest
else
begin
if not PickListExec('Select a description for "' + GetField(fieldOriginalTitle) + '"', Value4) then
Value4 := '';
end;
end;
if Value3 <> '' then
begin
if Value4 <> '' then
begin
Result := Value3 + #13#10 + #13#10 + Value4;
end
else
begin
Result := Value3;
end;
end
else
begin
Result := Value4;
end;
end;
// Import awards
procedure ImportAwards;
var
PageText, FullValue, Block, Value, Row: string;
Year, Result, Award, Category: string;
begin
sleep(50);
Value := MovieUrl;
PageText := ConvertToASCII(GetPage(Value+'/awards'));
PageText := TextBetween(PageText, '<table style=', '</table>');
FullValue := '';
while PageText <> '' do
begin
Block := TextBetween(PageText, '<big>', '<big>');
if Block = '' then
begin
Block := PageText;
PageText := '';
end
else
begin
Block := '<big>' + Block;
PageText := '<big>' + RemainingText;
end;
Value := TextBetween(Block, '<big>', '</big>');
Block := RemainingText;
HTMLRemoveTags(Value);
HTMLDecode(Value);
FullValue := FullValue + #13#10 + '- ' + Value;
Year := '';
Result := '';
repeat
Award := '';
Category := '';
Row := TextBetween(Block, '<tr>', '</tr>');
Block := RemainingText;
if (Pos('<th>Year</th><th>Result</th><th>Award</th><th>Category/Recipient(s)</th>', Row) = 0)
and (Pos('<td colspan="4"> </td>', Row) = 0) then
begin
if Pos('<a href="/Sections/Awards', Row) > 0 then
begin
Year := TextBetween(Row, '<a href="/Sections/Awards', '</a>');
Row := RemainingText;
Year := FullTrim(TextAfter(Year, '>'));
end;
if Pos('valign="middle"><b>', Row) > 0 then
begin
Result := TextBetween(Row, 'valign="middle"><b>', '</b></td>');
HTMLDecode(Result);
Row := RemainingText;
end;
if Pos('valign="middle">', Row) > 0 then
begin
Award := TextBetween(Row, 'valign="middle">', '</td>');
HTMLDecode(Award);
Row := RemainingText;
end;
if Award <> '' then
FullValue := FullValue + #13#10 + ' ' + Year + ' ' + Result + ' "' + Award + '"';
Category := TextBetween(Row, '<td valign="top">' + #13#10, '<br>');
if Pos('<a href="/name', Category) > 0 then
begin
RemainingText := Category;
Category := '';
end;
HTMLDecode(Category);
Category := FullTrim(Category);
Row := StringReplace(StringReplace(RemainingText, #13#10, ''), '<br>', ', ');
HTMLRemoveTags(Row);
HTMLDecode(Row);
Row := FullTrim(Row);
Row := StringReplace(Row, ' ', '');
Row := StringReplace(Row, ' ,', ',');
if Row = ',' then
Row := '';
if (Row <> '') or (Category <> '') then
begin
FullValue := FullValue + #13#10 + ' ' + Category;
if Row <> '' then
begin
while StrGet(Row, Length(Row)) = ',' do
begin
Delete(Row, Length(Row), 1);
Row := FullTrim(Row);
end;
if Category = '' then
FullValue := FullValue + Row
else
FullValue := FullValue + ': ' + Row;
end;
end;
end;
until Pos('</tr>', Block) = 0;
end;
if FullValue <> '' then
case GetOption('Awards') of
1:
begin
if GetField(fieldDescription) <> '' then
Value := GetField(fieldDescription) + #13#10 + #13#10 + 'AWARDS: ' + FullValue
else
Value := 'AWARDS: ' + FullValue;
SetField(fieldDescription, Value);
end;
2:
begin
if GetField(fieldComments) <> '' then
Value := GetField(fieldComments) + #13#10 + #13#10 + 'AWARDS: ' + FullValue
else
Value := 'AWARDS: ' + FullValue;
SetField(fieldComments, Value);
end;
end;
end;
// ***** beginning of the program *****
begin
// Check StringUtils1 version and update if < version 7
if StringUtils1_Version < 7 then
begin
if ShowWarning('Old version of file "Stringutils1.pas" detected: v'+IntToStr(StringUtils1_Version)+#13#10+'The script requires at least version 7.'+#13#10+'Download and install latest version now ?') = True then
begin
UpdateFile := TStringList.Create;
UpdateFile.Text := GetPage('http://update.antp.be/amc/scripts/StringUtils1.pas');
UpdateFile.SaveToFile(dirScripts + 'StringUtils1.pas');
UpdateFile.Free;
ShowInformation('StringUtils1 has been updated. Please restart IMDB script now. Thank you.');
Exit;
end
else
begin
ShowInformation('You can download latest version of "StringUtils1.pas" using script "update scripts" or via http://update.antp.be/amc/scripts');
Exit;
end;
end;
// Check for current AMC version
if CheckVersion(3,5,0) then
begin
MovieName := '';
if GetOption('BatchMode') = 2 then
begin
MovieName := GetField(fieldURL);
if Pos('imdb.com', MovieName) = 0 then
MovieName := '';
end;
if MovieName = '' then
MovieName := GetField(fieldOriginalTitle);
if MovieName = '' then
MovieName := GetField(fieldTranslatedTitle);
if GetOption('BatchMode') = 0 then
begin
if not Input('IMDB Import', 'Enter the title or the IMDB URL of the movie:', MovieName) then
Exit;
end
else
Sleep(500);
if MovieName <> '' then
begin
if Pos('imdb.com', MovieName) > 0 then
AnalyzeResultsPage(MovieName)
else
begin
MovieName := StringReplace(MovieName, '&', 'and');
if GetOption('GoogleSearch') = 1 then
AnalyzeGooglesResultsPage('http://www.google.com/search?num=30&q=s ... com/title/+' + UrlEncode(MovieName) + '+/maindetails')
else
if GetOption('GoogleSearch') = 2 then
AnalyzeGooglesResultsPage('http://www.google.com/search?num=30&q=s ... title/+%22' + UrlEncode(MovieName) + '%22+/maindetails')
else
begin
if (GetOption('BatchMode') > 0) or (GetOption('PopularSearches') = 1) then
AnalyzeResultsPage(PopularTitleSearchURL + UrlEncode(MovieName))
else
AnalyzeResultsPage(FullTitleSearchURL + UrlEncode(MovieName));
end;
end;
end;
end
else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.5.0)');
end.
I would have sent the information you ask for as attached files with screen dumps etc, but I cannot find a way to do that, so, instead I have to just tell you. I searched for "Apocalypse now" and just got 'Risultati Ricerca per "Apocalypse now" ' . Then I tried with URL, searched for "http://www.imdb.com/find?q=apocalypse+now&s=all" , and got 'Risultati Ricerca per "http://www.imdb.com/find?q=apocalypse+now&s=all" '.
The text of the IMDB script is quoted below as a PS.
Regards
Morten Levy
PS.
program IMDB;
uses
StringUtils1;
// ***** Manually set UserCountry to your required Classification Country below *****
const
//UserCountry = '';
{ Delete the line above and remove the "//" in front of one the
following lines, or add your country if it is not listed }
UserCountry = 'USA';
//UserCountry = 'Canada';
//UserCountry = 'Mexico';
//UserCountry = 'Brazil';
//UserCountry = 'Argentina';
//UserCountry = 'Australia';
//UserCountry = 'India';
//UserCountry = 'Italy';
//UserCountry = 'Spain';
//UserCountry = 'Portugal';
//UserCountry = 'France';
//UserCountry = 'Germany';
//UserCountry = 'Netherlands';
//UserCountry = 'UK';
//UserCountry = 'Ireland';
//UserCountry = 'Finland';
//UserCountry = 'Norway';
//UserCountry = 'Sweden';
//UserCountry = 'Switzerland';
PopularTitleSearchURL = 'http://www.imdb.com/find?tt=1;q=';
FullTitleSearchURL = 'http://www.imdb.com/find?more=tt;q=';
EpisodeTitleSearchURL = 'http://www.imdb.com/find?s=tt;ttype=ep;q=';
var
MovieName: string;
MovieURL: string;
MovieNumber: string;
UpdateFile: TStringList;
function ConvertToASCII(AText: string): string;
begin
Result := AText;
if GetOption('ConvertToASCII') = 1 then
begin
if StringUtils1_Version > 5 then
Result := Cp1252ToASCII(AText)
else
ShowMessage('The "ConvertToASCII" option requires a newer version of StringUtils1.pas (at least version 6).' + #13#10 + 'Run the "Update Scripts" script to get it.');
end;
end;
// ***** analyzes IMDB's results page that asks to select a movie from a list *****
procedure AnalyzeResultsPage(Address: string);
var
PageText: string;
Value: string;
begin
PageText := ConvertToASCII(GetPage(Address));
if pos('<title>IMDb', PageText) = 0 then
begin
AnalyzeMoviePage(PageText)
end else
begin
if Pos('<b>No Matches.</b>', PageText) > 0 then
begin
if GetOption('BatchMode') = 0 then
ShowMessage('No movie found for this search.');
Exit;
end;
if GetOption('BatchMode') = 0 then
begin
PickTreeClear;
repeat
Value := TextBefore(PageText, '</b> (Displaying', '<p><b>');
if Value <> '' then
begin
HTMLRemoveTags(Value);
HTMLDecode(Value);
PickTreeAdd(Value, '');
end;
Value := TextBetween(PageText, '<table><tr>', '</table>');
PageText := RemainingText;
until not AddMovieTitles(Value);
Value := TextBefore(PageText, '"><b>more titles</b></a>', '<a href="');
if Value <> '' then
PickTreeMoreLink('http://www.imdb.com' + Value);
if GetOption('EpisodeTitleSearch') > 0 then
PickTreeMoreLink(EpisodeTitleSearchURL + UrlEncode(MovieName));
if PickTreeExec(Address) then
AnalyzeResultsPage(Address);
end
else
begin
Value := TextBetween(PageText, '.</td><td valign="top">', '</a>');
if Value <> '' then
AnalyzeResultsPage('http://www.imdb.com' + TextBetween(Value, '<a href="', '" onclick="'));
end;
end;
end;
// ***** analyzes Google's results page that asks to select a movie from a list *****
procedure AnalyzeGooglesResultsPage(GoogleAddress: string);
var
PageText: string;
Value: string;
Address: string;
begin
PageText := GetPage(GoogleAddress);
Address := '';
if Pos('did not match any documents', PageText) > 0 then
begin
ShowMessage('No movie found for this search');
Exit;
end;
if GetOption('BatchMode') = 0 then
begin
PickTreeClear;
PickTreeAdd('Google`s search results for "' + MovieName + '" on IMDB:', '');
repeat
Value := TextBetween(PageText, '<h3 class=r>', '</a>');
PageText := RemainingText;
Address := TextBetween(Value, '<a href="', 'maindetails"');
if (GetOption('AllActors') = 1) or (GetOption('Producer') = 1) then
if Address <> '' then
Address := Address + 'combined';
HTMLRemoveTags(Value);
HTMLDecode(Value);
if (Pos(') - ', Value) = 0) and (Value <> '') and (Address <> '') then
PickTreeAdd(Value, Address);
until Value = '';
if PickTreeExec(GoogleAddress) then
AnalyzeResultsPage(GoogleAddress);
end
else
begin
Value := TextBetween(PageText, '<h3 class=r>', '</a>');
Address := TextBetween(Value, '<a href="', 'maindetails"');
if (GetOption('AllActors') = 1) or (GetOption('Producer') = 1) then
if Address <> '' then
Address := Address + 'combined';
if Address <> '' then
AnalyzeResultsPage(Address);
end;
end;
// ***** adds the movie titles found on IMDB's results page *****
function AddMovieTitles(List: string): Boolean;
var
Value: string;
Address: string;
begin
Result := False;
Value := TextBetween(List, '.</td><td valign="top">', '</td>');
if GetOption('HideAkaTitles') = 1 then
Value := StringReplace(Value, TextAfter(Value, '<p class="find-aka">'), '')
else
Value := StringReplace(Value, 'aka', ' | aka');
List := RemainingText;
while Value <> '' do
begin
Address := TextBetween(Value, '<a href="/title/tt', '/');
// ##########
// if (GetOption('AllActors') = 1) or (GetOption('Producer') = 1) then
// Address := Address + '/combined'
// else
// Address := Address + '/';
Address := Address + '/combined';
// ##########
HTMLRemoveTags(Value);
HTMLDecode(Value);
// if GetOption('HideAkaTitles') = 1 then
// Value := Value + ')';
PickTreeAdd(Value, 'http://www.imdb.com/title/tt' + Address);
Result := True;
Value := TextBetween(List, '.</td><td valign="top">', '</td>');
if GetOption('HideAkaTitles') = 1 then
Value := StringReplace(Value, TextAfter(Value, '<br> '), '')
else
Value := StringReplace(Value, 'aka', ' | aka');
List := RemainingText;
end;
end;
// ***** analyzes the page containing movie information *****
procedure AnalyzeMoviePage(PageText: string);
var
Value, Value2, Value3, FullValue: string;
p, Count: Integer;
begin
MovieNumber := TextBetween(PageText, '<input type="hidden" name="auto" value="legacy/title/tt', '/');
if MovieNumber = '' then
MovieNumber := TextBetween(PageText, '<input type="hidden" name="auto" value="legacy/title/tt', '/combined"');
if MovieNumber = '' then
MovieNumber := TextBetween(PageText, '<link rel="canonical" href="http://www.imdb.com/title/tt', '/');
// #########
// if ((GetOption('AllActors') = 1) or (GetOption('Producer') = 1)) and (Pos('<div id="tn15" class="maindetails">', PageText) > 0) then
// PageText := ConvertToASCII(GetPage('http://www.imdb.com/title/tt' + MovieNumber + '/combined'));
if Pos('/combined"', TextBetween(PageText, '<link rel="canonical"', '/>')) = 0 then
PageText := ConvertToASCII(GetPage('http://www.imdb.com/title/tt' + MovieNumber + '/combined'));
// #########
MovieURL := 'http://imdb.com/title/tt' + MovieNumber;
// URL
if CanSetField(fieldURL) then
SetField(fieldURL, MovieURL);
// OriginalTitle & Year
if CanSetField(fieldOriginalTitle) or CanSetField(fieldYear) then
begin
Value := TextBetween(PageText, '<title>', '</title>');
p := Pos(' (1', Value);
if p = 0 then
p := Pos(' (2', Value);
Value2 := Copy(Value, 0, p-1);
Value := Copy(Value, p+2, Length(Value));
HTMLDecode(Value2);
if CanSetField(fieldOriginalTitle) then
SetField(fieldOriginalTitle, Value2);
if Pos('/', Value) > 0 then
Value2 := TextBefore(Value, '/', '')
else
Value2 := TextBefore(Value, ')', '');
if CanSetField(fieldYear) then
SetField(fieldYear, Value2);
end;
// Picture
if CanSetPicture then
begin
case GetOption('ImageKind') of
2: if not ImportSmallPicture(PageText) then
ImportPictureNotAvailable(PageText);
3: if not ImportLargePicture(PageText) then
if not ImportSmallPicture(PageText) then
ImportPictureNotAvailable(PageText);
4: if not ImportMerchandisingPicture then
if not ImportDvdDetailsPicture then
ImportSmallPicture(PageText);
5: if not ImportDvdDetailsPicture then
if not ImportMerchandisingPicture then
ImportSmallPicture(PageText);
else
ImportSmallPicture(PageText);
end;
end;
// Director
if CanSetField(fieldDirector) then
begin
Value := TextBetween(PageText, '<h5>Director:', '</div>');
if Value = '' then
Value := TextBetween(PageText, '<h5>Director', '</div>');
if Pos(':<', Value) > 0 then
Value := '<' + TextAfter(Value, ':<');
if Pos('<p>', Value) > 0 then
Value := TextBetween(Value, '<p>', '</p>');
Value := StringReplace(Value, '<br/>', ',');
HTMLRemoveTags(Value);
HTMLDecode(Value);
Value := StringReplace(Value, ', more', '');
Value := StringReplace(Value, ', (more)', '');
Value := StringReplace(Value, ' ', '');
Value := StringReplace(Value, #13, '');
Value := StringReplace(Value, #10, '');
Value := StringReplace(Value, #9, '');
Value := StringReplace(Value, ',', ', ');
if Copy(Value, Length(Value) - 1, 2) = ', ' then
Value := Copy(Value, 0, Length(Value) - 2);
SetField(fieldDirector, Value);
end;
// Actors
if CanSetField(fieldActors) then
begin
Value := FullTrim(TextBetween(PageText, '<table class="cast">', '</table>'));
if Value <> '' then
begin
FullValue := '';
Count := 0;
case GetOption('ActorsLayout') of
0, 1:
while Pos('<tr', Value) > 0 do
begin
Value2 := TextBetween(Value, '<tr', '</tr>');
Value := RemainingText;
if Pos('rest of cast', Value2) > 0 then
Continue;
if FullValue <> '' then
FullValue := FullValue + #13#10;
TextBefore(Value2, '</td>', '');
Value2 := FullTrim(TextBetween(Value2, '<td class="nm">', '</td>'));
HTMLRemoveTags(Value2);
if Value2 <> '' then
begin
FullValue := FullValue + Value2;
Count := Count + 1;
end;
// ###
if (Count = 15) and (GetOption('AllActors') = 0) then
Break;
// ###
if (Count = 10) and (GetOption('AllActors') = 2) then
Break;
end;
2, 3:
while Pos('<tr', Value) > 0 do
begin
Value2 := TextBetween(Value, '<tr', '</tr>');
Value := RemainingText;
if Pos('rest of cast', Value2) > 0 then
Continue;
if FullValue <> '' then
FullValue := FullValue + #13#10;
TextBefore(Value2, '</td>', '');
Value2 := FullTrim(TextBetween(Value2, '<td class="nm">', '</td>'));
HTMLRemoveTags(Value2);
if Value2 <> '' then
begin
FullValue := FullValue + Value2;
Value2 := FullTrim(TextBetween(RemainingText, '"char">', '</td>'));
if Value2 <> '' then
FullValue := FullValue + ' (as ' + Value2 + ')';
Count := Count + 1;
// ###
if (Count = 15) and (GetOption('AllActors') = 0) then
Break;
// ###
if (Count = 10) and (GetOption('AllActors') = 2) then
Break;
end;
end;
4:
begin
FullValue := Value;
FullValue := StringReplace(FullValue, ' <tr><td align="center" colspan="4"><small>rest of cast listed alphabetically:</small></td></tr>', '');
FullValue := StringReplace(FullValue, '> <', '><');
FullValue := StringReplace(FullValue, '</tr>', #13#10);
end;
end;
HTMLRemoveTags(FullValue);
HTMLDecode(FullValue);
case GetOption('ActorsLayout') of
0, 2:
FullValue := StringReplace(FullValue, #13#10, ', ');
end;
SetField(fieldActors, FullValue);
end;
end;
//Country
if CanSetField(fieldCountry) then
begin
SetField(fieldCountry, ImportList(PageText, GetOption('MultipleValuesCountry'), '/country/'));
end;
//Category
if CanSetField(fieldCategory) then
begin
SetField(fieldCategory, ImportList(PageText, GetOption('MultipleValuesCategory'), '/Genres/'));
end;
// Language
if CanSetField(fieldLanguages) then
begin
SetField(fieldLanguages, ImportList(PageText, GetOption('MultipleValuesLanguages'), '/language/'));
end;
// Audio Format
if CanSetField(fieldAudioFormat) then
begin
SetField(fieldAudioFormat, ImportList(PageText, GetOption('MultipleValuesAudioFormat'), '/search/title?sound_mixes='));
end;
// Aspect Ratio
begin
Value := '';
Value := TextBetween(PageText, '<h5>Aspect Ratio:</h5>', '</div>');
if Pos('<p>', Value) > 0 then
Value := TextBetween(Value, '<p>', '</p>');
if Pos('<a ', Value) > 0 then
Value := TextBefore(Value, '<a ', '');
HTMLRemoveTags(Value);
HTMLDecode(Value);
Value := FullTrim(Value);
Value := StringReplace(Value, ', more', '');
Value := StringReplace(Value, ', (more)', '');
Value := StringReplace(Value, ' more', '');
if (CanSetField(fieldVideoFormat)) and (GetOption('AspectRatio') = 1) then
SetField(fieldVideoFormat, Value);
if (CanSetField(fieldResolution)) and (GetOption('AspectRatio') = 2) then
SetField(fieldResolution, Value);
end;
// Description
if CanSetField(fieldDescription) then
begin
Value := TextBetween(PageText, '<h5>Plot:</h5>', '</div>');
if Value = '' then
Value := TextBetween(PageText, '<h5>Plot Summary:</h5>', '</div>');
if Pos('<p>', Value) > 0 then
Value := TextBetween(Value, '<p>', '</p>');
Value := StringReplace(Value, '<div class="info-content">', '');
Value := StringReplace(Value, Textbetween(Value, '| <a class="tn15more inline" href="synopsis">', '</a>'), '');
Value := StringReplace(Value, Textbetween(Value, '<a class="tn15more inline" href="synopsis">', '</a>'), '');
Value := StringReplace(Value, '| <a class="tn15more inline" href="synopsis"></a>', '');
Value := StringReplace(Value, '<a class="tn15more inline" href="synopsis"></a>', '');
Value := StringReplace(Value, '»', '');
if (Value = #13#10 + #13#10) or (Value = #13#10) then
Value := '';
if (GetOption('DescriptionSelection') = 0) and (Pos('<a class="tn15more inline"', Value) > 0) then
Value := TextAfter(Value, #13#10);
if Value <> '' then
SetField(fieldDescription, ImportSummary(Value));
end;
// Length
if CanSetField(fieldLength) then
begin
Value := TextBetween(PageText, '<h5>Runtime:</h5>', '</div>');
if Pos('<p>', Value) > 0 then
Value := TextBetween(Value, '<p>', '</p>');
Value := TextBefore(Value, ' min', '');
HTMLRemoveTags(Value);
Value := FullTrim(Value);
if Value <> '' then
begin
if Pos(':', Value) > 0 then
SetField(fieldLength, TextAfter(Value, ':'))
else
SetField(fieldLength, Value);
end;
end;
// Writer (Producer Field)
if CanSetField(fieldProducer) then
begin
if GetOption('Producer') = 1 then
begin
Value := TextBetween(PageText, 'Produced by</a></h5>', '</table>');
FullValue := '';
Value2 := TextBetween(Value, '<a href="/name/', '</a>');
while Value2 <> '' do
begin
Value := RemainingText;
Value2 := TextAfter(Value2, '">');
if FullValue <> '' then
FullValue := FullValue + ', ';
FullValue := FullValue + Value2;
Value2 := TextBetween(Value, '<a href="/name/', '</a>');
end;
HTMLDecode(FullValue);
SetField(fieldProducer, FullValue);
end
else
begin
Value := TextBetween(PageText, '<h5>Writer', '</div>');
if Pos(':<', Value) > 0 then
Value := '<' + TextAfter(Value, ':<');
if Pos('<p>', Value) > 0 then
Value := TextBetween(Value, '<p>', '</p>');
Value := StringReplace(Value, '<br/>', ',');
Value := StringReplace(Value, '>more<', '><');
HTMLRemoveTags(Value);
HTMLDecode(Value);
if Value <> '' then
begin
Value := StringReplace(Value, '..., more', '');
Value := StringReplace(Value, ', more', '');
Value := StringReplace(Value, '...', '');
Value := StringReplace(Value, ' &', '');
Value := StringReplace(Value, ' ', '');
Value := StringReplace(Value, #13, '');
Value := StringReplace(Value, #10, '');
Value := StringReplace(Value, #9, '');
Value := StringReplace(Value, ',', ', ');
Value := FullTrim(StringReplace(Value, ' and, ', ', '));
if Value <> '' then
while StrGet(Value, Length(Value)) = ',' do
begin
Delete(Value, Length(Value), 1);
Value := FullTrim(Value);
end;
SetField(fieldProducer, Value);
end;
end;
end;
// AKA Name
if CanSetField(fieldTranslatedTitle) then
begin
Value := TextBetween(PageText, '<h5>Also Known As:</h5>', '</div></div>');
if Value <> '' then
begin
Value := StringReplace(Value, 'See more', '');
Value := StringReplace(Value, '»', '');
Value := FullTrim(StringReplace(Value, '<br>', ', '));
HTMLRemoveTags(Value);
HTMLDecode(Value);
Value := FullTrim(Value);
if Value <> '' then
if StrGet(Value, Length(Value)) = ',' then
Delete(Value, Length(Value), 1);
SetField(fieldTranslatedTitle, Value)
end;
end;
// Comments
if CanSetField(fieldComments) then
begin
if (GetOption('CommentType') = 1) then
begin
Value := TextAfter(PageText,'/rg/title-nav-item/usercomments/');
if (Value <> '') or (Pos('href="usercomments" class="link"', PageText) > 0) then
begin
Value2 := '';
FullValue := ConvertToASCII(GetPage(MovieURL+'/usercomments'));
FullValue := TextAfter(FullValue, 'review useful:</small><br>');
while FullValue <> '' do
begin
Value := TextBetween(FullValue, '<b>', '<div');
Value2 := Value2 + #13#10 + #13#10 + TextBefore(Value, '</b>', '');
Value := RemainingText;
Value2 := Value2 + #13#10 + 'Date: ' + TextBetween(Value, '<small>', '</small>');
Value := RemainingText;
Value := 'Author: ' + TextBetween(Value, 'comments">', '<br>');
HtmlRemoveTags(Value);
Value2 := Value2 + #13#10 + Value;
Value := RemainingText;
Value := TextBetween(Value, '<p>' + #13#10, #13#10 + '</p>');
Value := StringReplace(Value, #13#10, ' ');
Value := StringReplace(Value, '<br><br>', #13#10);
Value := StringReplace(Value, '<br>', #13#10);
HtmlDecode(Value);
Value2 := Value2 + #13#10 + #13#10 + FullTrim(Value);
FullValue := TextAfter(FullValue, 'review useful:</small><br>');
end;
HTMLRemoveTags(Value2);
HTMLDecode(Value2);
SetField(fieldComments, 'USER COMMENTS:' + Value2 + #13#10);
end;
end
else
if (GetOption('CommentType') = 0) then
begin
Value := TextAfter(PageText, '/comments">');
if Value <> '' then
begin
Value := TextBetween(Value, '<p>', '</p>');
Value := StringReplace(Value, #13#10, ' ');
Value := StringReplace(Value, '<br>', #13#10);
HTMLRemoveTags(Value);
HTMLDecode(Value);
Value := FullTrim(Value);
while Pos(' ', Value) > 0 do
Value := StringReplace(Value, ' ', ' ');
while Pos(#13#10, Value) = 1 do
Delete(Value, 1, 2);
SetField(fieldComments, Value + #13#10);
end;
end
else
if (GetOption('CommentType') = 2) then
SetField(fieldComments, '');
end;
// TagLine
if GetOption('GetTagline') > 0 then
begin
Value := TextBetween(PageText, '<h5>Tagline:</h5>', '</div>');
if Pos('<p>', Value) > 0 then
Value := TextBetween(Value, '<p>', '</p>');
if Pos('<a', Value) > 0 then
Value := TextBefore(Value, '<a', '');
Value := TextAfter(Value, #13#10);
HTMLRemoveTags(Value);
HTMLDecode(Value);
Value := FullTrim(Value);
if Value <> '' then
begin
if StrGet(Value, 1) <> '"' then
Value := '"' + Value + '"';
case GetOption('GetTagline') of
1:
begin
if GetField(fieldDescription) <> '' then
Value := Value + #13#10 + #13#10 + GetField(fieldDescription);
SetField(fieldDescription, Value);
end;
2:
begin
if GetField(fieldComments) <> '' then
Value := Value + #13#10 + #13#10 + GetField(fieldComments);
SetField(fieldComments, Value);
end;
end;
end;
end;
// Trivia
if GetOption('Trivia') > 0 then
begin
sleep(50);
Value := MovieUrl;
FullValue := ConvertToASCII(GetPage(Value+'/trivia'));
case GetOption('Trivia') of
1,2:
Value := TextBetween(FullValue, '<div class="sodatext">', '<br>');
3,4:
Value := TextBetween(FullValue, 'class="soda">', #13#10 + #13#10 + #13#10 + '<!--');
end;
if Value <> '' then
begin
Value := StringReplace(Value, #13#10, '');
while Pos(' ', Value) > 0 do
Value := StringReplace(Value, ' ', '');
Value := StringReplace(Value, 'Link this trivia', '');
Value := StringReplace(Value, '<div class="sodatext">', #13#10 + '- ');
HTMLRemoveTags(Value);
HTMLDecode(Value);
case GetOption('Trivia') of
1,3:
begin
if GetField(fieldDescription) <> '' then
Value := GetField(fieldDescription) + #13#10 + #13#10 + 'IMDB TRIVIA: ' + Value
else
Value := 'IMDB TRIVIA: ' + Value;
SetField(fieldDescription, Value);
end;
2,4:
begin
if GetField(fieldComments) <> '' then
Value := GetField(fieldComments) + #13#10 + #13#10 + 'IMDB TRIVIA: ' + Value
else
Value := 'IMDB TRIVIA: ' + Value;
SetField(fieldComments, Value);
end;
end;
end;
end;
// Awards
if (GetOption('Awards') > 0) then
begin
ImportAwards();
end;
// Rating
if CanSetField(fieldRating) then
begin
// (Remove the "//" of the next two lines beginning with "Value" and add "//" to the following two lines beginning with Value
// if you would like to import arithmetic ratings instead of IMDB's user ratings)
// Value := ConvertToASCII(GetPage(MovieURL + '/ratings'));
// Value := TextBetween(Value, 'Arithmetic mean = ', '. ');
Value := TextBetween(PageText, '<h5>User Rating:</h5>', '</b>');
Value := TextBetween(Value, '<b>', '/');
if Value <> '' then
SetField(fieldRating, Value);
end;
if GetOption('UserRatings') > 0 then
begin
Value := TextBetween(PageText, '<a href="ratings" class="tn15more">', '</a>');
if Value <> '' then
Value := 'User Rating: ' + GetField(fieldRating) + ' out of 10 (with ' + Value + ')';
if (GetOption('UserRatings') = 1) and (Value <> '') and (CanSetField(fieldMediaType)) then
SetField(fieldMediaType, Value);
if (GetOption('UserRatings') = 2) and (Value <> '') then
SetField(fieldComments, GetField(fieldComments) + #13#10 + #13#10 + Value);
end;
// Classification
if GetOption('Classification') > 0 then
begin
if UserCountry = '' then
ShowMessage('Country not set for classification selection - Click "Editor" tab in the scripting window, then select your country by modifying the required line as explained in the first lines of the code')
else
begin
Value := TextBetween(PageText, '<a href="/search/title?certificates=', '</div>');
Value := TextBetween(Value, UserCountry + ':', '</a>'); if Value <> '' then
begin
if GetOption('Classification') = 1 then
SetField(fieldMediaType, Value)
else
SetField(fieldComments, GetField(fieldComments) + #13#10 + #13#10 + 'Classification: ' + Value);
end;
end;
end;
// MPAA rating
if (GetOption('MPAA') > 0) then
begin
Value := FullTrim(TextBetween(PageText, '<h5><a href="/mpaa">MPAA</a>:</h5>', '</div>'));
if Pos('<p>', Value) > 0 then
Value := TextBetween(Value, '<p>', '</p>');
HTMLRemoveTags(Value);
Value := FullTrim(Value);
// Value := TextAfter(Value, #13#10);
if Value <> '' then
begin
if GetOption('MPAA') = 1 then
SetField(fieldMediaType, TextBetween(Value, 'Rated ', ' '))
else
SetField(fieldComments, GetField(fieldComments) + #13#10 + #13#10 + Value);
end;
end;
end;
// ***** Imports lists like Genre, Country, etc. depending of the selected option *****
function ImportList(PageText: string; MultipleValues: Integer; StartTag: string): string;
var
Value, Value2: string;
begin
if MultipleValues = 0 then
begin
Value := TextBetween(PageText, StartTag, '</a>');
Value2 := TextAfter(Value, '">');
end
else
begin
Value := TextBetween(PageText, StartTag, '</div>');
Value2 := TextBefore(Value, '<a class="tn15more inline"', '');
if Value2 = '' then
Value2 := Value;
Value2 := TextAfter(Value2, '">');
HTMLRemoveTags(Value2);
if MultipleValues = 1 then
Value2 := StringReplace(Value2, ' | ', ', ');
if MultipleValues = 2 then
Value2 := StringReplace(Value2, ' | ', ' / ');
if MultipleValues = 3 then
Value2 := '';
end;
Value2 := StringReplace(Value2, #13#10, '');
Value2 := StringReplace(Value2, ' , ', ', ');
HTMLDecode(Value2);
Result := FullTrim(Value2);
end;
// ***** functions to import the different pictures kinds, depending of the option selected by user *****
//Import small picture from IMDB movie main page
function ImportSmallPicture(PageText: string): Boolean;
var
Value: string;
begin
Result := False;
Value := TextBetween(PageText, '<div class="photo">', '</div>');
if (Value <> '') and (Pos('"Poster Not Submitted"', Value) = 0) then
begin
Value := TextBetween(Value, 'src="', '"');
if Value <> '' then
begin
GetPicture(Value);
Result := True;
end;
end;
end;
//Import large image from link on IMDB movie main page
function ImportLargePicture(PageText: string): Boolean;
var
Value: string;
begin
Result := False;
Value := TextBetween(PageText, '<div class="photo">', '</div>');
if (Value <> '') and (Pos('"Poster Not Submitted"', Value) = 0) and (Pos('<a name="poster" href="/rg/action-box-title/primary-photo', Value) > 0) then
begin
Value := TextBetween(Value, 'href="/rg/action-box-title/primary-photo', '"');
if Value <> '' then
begin
Value := 'http://www.imdb.com' + Value;
Value := GetPage(Value);
Value := TextBetween(Value, '<div class="primary">', '</div>');
if (Value <> '') and (Pos(' src="', Value) > 0) then
begin
Value := TextBetween(Value, ' src="', '"');
GetPicture(Value);
Result := True;
end;
end;
end;
end;
//Image not available, import "No Poster Available" icon
function ImportPictureNotAvailable(PageText: string): Boolean;
var
Value: string;
begin
Result := False;
Value := TextBetween(PageText, '<div class="photo">', '</div>');
if (Value <> '') and (Pos('"Poster Not Submitted"', Value) > 0) then
begin
Value := TextBetween(Value, 'src="', '"');
if Value <> '' then
begin
GetPicture(Value);
Result := True;
end;
end;
end;
//Image from DVD Details Page
function ImportDvdDetailsPicture: Boolean;
var
Value, PageText: string;
begin
Result := False;
PageText := ConvertToASCII(GetPage(MovieUrl+'/dvd'));
Value := TextBefore(PageText, '.jpg alt="', '<table class="dvd_section" cellpadding="10"><tr>');
if Value <> '' then
begin
Value := TextBetween(Value, '<a href="', '">');
if Value <> '' then
Result := ImportFromAmazonRedirect('http://www.imdb.com' + Value);
end;
end;
//Image from Merchandising Links (/sales) Page
function ImportMerchandisingPicture: Boolean;
var
Value, PageText: string;
begin
Result := False;
PageText := ConvertToASCII(GetPage(MovieUrl+'/sales'));
Value := TextBefore(PageText, '.jpg" width=', '<td class=w_rowtable_colcover><a href="');
if Value <> '' then
begin
Value := TextBefore(Value, '"><img', '');
if Value <> '' then
Result := ImportFromAmazonRedirect('http://www.imdb.com' + Value);
end;
end;
function ImportFromAmazonRedirect(Url: string): Boolean;
var
Value, PageText: string;
begin
Result := False;
PageText := ConvertToASCII(GetPage(Url));
Value := TextBetween(PageText, '<td id="prodImageCell"', '" id="prodImage"');
// Value := StringReplace(TextAfter(Value, ' src="'), '_AA240', '');
Value := StringReplace(Value, TextBetween(Value, '_AA', '_'), '');
Value := StringReplace(TextAfter(Value, ' src="'), '_AA', '');
if Value <> '' then
begin
GetPicture(Value);
Result := True;
end;
end;
// ***** Gets summaries for the movie, based on the plot outline given in parameter (that contains the URL to more summaries) *****
function ImportSummary(PlotText: string): string;
var
Address, Value, Value2, Value3, Value4, PageText, Longest: string;
begin
Address := TextBetween(PlotText, '<a class="tn15more inline" href="', '" ');
if (Address = '') or (GetOption('DescriptionSelection') = 0) or (GetOption('DescriptionSelection') = 3) then
begin
Value3 := FullTrim(TextBefore(PlotText, '<a class="tn15more inline"', ''));
if Value3 = '' then
Value3 := FullTrim(PlotText);
HTMLRemoveTags(Value3);
HTMLDecode(Value3);
end;
if (Address <> '') and (GetOption('DescriptionSelection') > 0) then
begin
PageText := ConvertToASCII(GetPage('http://www.imdb.com' + Address));
PickListClear;
Longest := '';
Value := TextBetween(PageText, '<p class="plotpar">', '</p>');
PageText := RemainingText;
while Value <> '' do
begin
Value := TextBefore(Value, '<i>', '');
Value := FullTrim(StringReplace(Value, #13#10, ' '));
Value := StringReplace(Value, '<br>', #13#10);
HTMLRemoveTags(Value);
HTMLDecode(Value);
while Pos(' ', Value) > 0 do
Value := StringReplace(Value, ' ', ' ');
if Length(Value) > Length(Longest) then
Longest := Value;
PickListAdd(FullTrim(Value));
Value := TextBetween(PageText, '<p class="plotpar">', '</p>');
PageText := RemainingText;
end;
if (GetOption('BatchMode') > 0) or (GetOption('DescriptionSelection') = 2) then
Value4 := Longest
else
begin
if not PickListExec('Select a description for "' + GetField(fieldOriginalTitle) + '"', Value4) then
Value4 := '';
end;
end;
if Value3 <> '' then
begin
if Value4 <> '' then
begin
Result := Value3 + #13#10 + #13#10 + Value4;
end
else
begin
Result := Value3;
end;
end
else
begin
Result := Value4;
end;
end;
// Import awards
procedure ImportAwards;
var
PageText, FullValue, Block, Value, Row: string;
Year, Result, Award, Category: string;
begin
sleep(50);
Value := MovieUrl;
PageText := ConvertToASCII(GetPage(Value+'/awards'));
PageText := TextBetween(PageText, '<table style=', '</table>');
FullValue := '';
while PageText <> '' do
begin
Block := TextBetween(PageText, '<big>', '<big>');
if Block = '' then
begin
Block := PageText;
PageText := '';
end
else
begin
Block := '<big>' + Block;
PageText := '<big>' + RemainingText;
end;
Value := TextBetween(Block, '<big>', '</big>');
Block := RemainingText;
HTMLRemoveTags(Value);
HTMLDecode(Value);
FullValue := FullValue + #13#10 + '- ' + Value;
Year := '';
Result := '';
repeat
Award := '';
Category := '';
Row := TextBetween(Block, '<tr>', '</tr>');
Block := RemainingText;
if (Pos('<th>Year</th><th>Result</th><th>Award</th><th>Category/Recipient(s)</th>', Row) = 0)
and (Pos('<td colspan="4"> </td>', Row) = 0) then
begin
if Pos('<a href="/Sections/Awards', Row) > 0 then
begin
Year := TextBetween(Row, '<a href="/Sections/Awards', '</a>');
Row := RemainingText;
Year := FullTrim(TextAfter(Year, '>'));
end;
if Pos('valign="middle"><b>', Row) > 0 then
begin
Result := TextBetween(Row, 'valign="middle"><b>', '</b></td>');
HTMLDecode(Result);
Row := RemainingText;
end;
if Pos('valign="middle">', Row) > 0 then
begin
Award := TextBetween(Row, 'valign="middle">', '</td>');
HTMLDecode(Award);
Row := RemainingText;
end;
if Award <> '' then
FullValue := FullValue + #13#10 + ' ' + Year + ' ' + Result + ' "' + Award + '"';
Category := TextBetween(Row, '<td valign="top">' + #13#10, '<br>');
if Pos('<a href="/name', Category) > 0 then
begin
RemainingText := Category;
Category := '';
end;
HTMLDecode(Category);
Category := FullTrim(Category);
Row := StringReplace(StringReplace(RemainingText, #13#10, ''), '<br>', ', ');
HTMLRemoveTags(Row);
HTMLDecode(Row);
Row := FullTrim(Row);
Row := StringReplace(Row, ' ', '');
Row := StringReplace(Row, ' ,', ',');
if Row = ',' then
Row := '';
if (Row <> '') or (Category <> '') then
begin
FullValue := FullValue + #13#10 + ' ' + Category;
if Row <> '' then
begin
while StrGet(Row, Length(Row)) = ',' do
begin
Delete(Row, Length(Row), 1);
Row := FullTrim(Row);
end;
if Category = '' then
FullValue := FullValue + Row
else
FullValue := FullValue + ': ' + Row;
end;
end;
end;
until Pos('</tr>', Block) = 0;
end;
if FullValue <> '' then
case GetOption('Awards') of
1:
begin
if GetField(fieldDescription) <> '' then
Value := GetField(fieldDescription) + #13#10 + #13#10 + 'AWARDS: ' + FullValue
else
Value := 'AWARDS: ' + FullValue;
SetField(fieldDescription, Value);
end;
2:
begin
if GetField(fieldComments) <> '' then
Value := GetField(fieldComments) + #13#10 + #13#10 + 'AWARDS: ' + FullValue
else
Value := 'AWARDS: ' + FullValue;
SetField(fieldComments, Value);
end;
end;
end;
// ***** beginning of the program *****
begin
// Check StringUtils1 version and update if < version 7
if StringUtils1_Version < 7 then
begin
if ShowWarning('Old version of file "Stringutils1.pas" detected: v'+IntToStr(StringUtils1_Version)+#13#10+'The script requires at least version 7.'+#13#10+'Download and install latest version now ?') = True then
begin
UpdateFile := TStringList.Create;
UpdateFile.Text := GetPage('http://update.antp.be/amc/scripts/StringUtils1.pas');
UpdateFile.SaveToFile(dirScripts + 'StringUtils1.pas');
UpdateFile.Free;
ShowInformation('StringUtils1 has been updated. Please restart IMDB script now. Thank you.');
Exit;
end
else
begin
ShowInformation('You can download latest version of "StringUtils1.pas" using script "update scripts" or via http://update.antp.be/amc/scripts');
Exit;
end;
end;
// Check for current AMC version
if CheckVersion(3,5,0) then
begin
MovieName := '';
if GetOption('BatchMode') = 2 then
begin
MovieName := GetField(fieldURL);
if Pos('imdb.com', MovieName) = 0 then
MovieName := '';
end;
if MovieName = '' then
MovieName := GetField(fieldOriginalTitle);
if MovieName = '' then
MovieName := GetField(fieldTranslatedTitle);
if GetOption('BatchMode') = 0 then
begin
if not Input('IMDB Import', 'Enter the title or the IMDB URL of the movie:', MovieName) then
Exit;
end
else
Sleep(500);
if MovieName <> '' then
begin
if Pos('imdb.com', MovieName) > 0 then
AnalyzeResultsPage(MovieName)
else
begin
MovieName := StringReplace(MovieName, '&', 'and');
if GetOption('GoogleSearch') = 1 then
AnalyzeGooglesResultsPage('http://www.google.com/search?num=30&q=s ... com/title/+' + UrlEncode(MovieName) + '+/maindetails')
else
if GetOption('GoogleSearch') = 2 then
AnalyzeGooglesResultsPage('http://www.google.com/search?num=30&q=s ... title/+%22' + UrlEncode(MovieName) + '%22+/maindetails')
else
begin
if (GetOption('BatchMode') > 0) or (GetOption('PopularSearches') = 1) then
AnalyzeResultsPage(PopularTitleSearchURL + UrlEncode(MovieName))
else
AnalyzeResultsPage(FullTitleSearchURL + UrlEncode(MovieName));
end;
end;
end;
end
else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.5.0)');
end.
-
- Posts: 764
- Joined: 2007-04-28 05:46:43
- Location: Italy
You might want to try agb's script update from this thread: viewtopic.php?p=32525#32525
Probably your problem is from IMDB not detecting your local country correct and giving italien results (just a guess). What language do you get when going to imdb.com and searching for the movie there via browser ?
Probably your problem is from IMDB not detecting your local country correct and giving italien results (just a guess). What language do you get when going to imdb.com and searching for the movie there via browser ?