(*************************************************** Ant Movie Catalog importation script www.antp.be/software/moviecatalog/ [Infos] Authors=Hubert Kosior, KaraGarga, Chetan Rao, Donna Huffman, R_V, Fulvio53s03 Title=All Movie Guide Description=All Movie Guide detailed info import with picture Site=https://www.allmovie.com Language=EN Version=1.2 / Marzo 2024 Requires=3.5.0 Comments=a bug corrected by Antoine Potten|completely rewritten again for the AllRovi site by Chetan Rao.|Reworked March 2009 for changes to AllMovieGuide by Donna Huffman|Rewritten for Allmovie.com by R_V (V 0.7.0 <-> 0.7.2 Feb 2014)|Updated by Fulvio53s03 on 27 feb 2021 and 17 march 2024 License=This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. | GetInfo=1 RequiresMovies=1 [Options] CategoryOptions=3|3|1=Only import first category|2=Import all categories and divide by "/"|3=Import all categories and divide by "," ProducerOptions=0|0|0=Import Production Companies into Producer Field|1=Import Releaser Company into Producer Field SynopsisOptions=1|1|1=Import into Description Field|2=Import into Comments Field|0=DO NOT import Synopsis ReviewOptions=2|2|1=Import into Description Field|2=Import into Comments Field|0=DO NOT import Review AwardsOptions=2|2|1=Import into Description Field|2=Import into Comments Field|0=DO NOT import Awards List CastOptions=3|3|1=Import Cast divided by ";"|2=Import Cast as a list (AMG Default)|3=Import Cast as a list (like IMDB)|4=Import Cast as a list within paranthesis|5=Import Cast within paranthesis FieldforCredits=2|2|0=DO NOT import Production Credits|1=Import Production Credits into Description Field|2=Import Production Credits into Comments Field CreditsOptions=2|2|1=Import Credits as a list (like AMG)|2=Import Credits as a list (like IMDB)|3=Import Credits as a list (within paranthesis) CharacteristicsOptions=1|1|0=DO NOT import Characteristics|1=Import into Description Field Picture=1|1|1=Big|2=Small MaxResults=5000|5000|100=Maximum search results returned|200=|5000=|8000= BatchMode=0|0|0=Normal working mode|1=Batch mode: if the URL field is filled, it imports from that page instead of asking for a title [Parameters] ***************************************************) program AllMovie; uses StringUtils1; const crlf = #13#10; // carriage return/line feed tab = #9; var MovieName: string; PageURL: string; PageReview, initchar, endchar: string; UpdateFile: TStringList; // simple string procedures function StringReplaceAll(S, Old, New: string): string; begin while Pos(Old, S) > 0 do S := StringReplace(S, Old, New); Result := S; end; function RemoveWhiteSpace(S : string) : string; begin Result := StringReplaceAll(S, tab, ''); Result := StringReplaceAll(Result, crlf, ''); Result := Trim(Result); end; function GetStringFromList(Content, Delimiter: string): string; var Data : string; begin while(true) do begin Data := TextBetween(Content, '">', ''); if (Length(Data) = 0) then break; HTMLRemoveTags(Data); Data := RemoveWhiteSpace(Data); Result := Result + Data + Delimiter + ' '; Content := TextAfter(Content, ''); end; // remove trailing delimiter Result := Trim(Result); if (Copy(Result, Length(Result), 1) = Delimiter) then Result := Copy(Result, 0, Length(Result) - 1); end; function GetStringFromTable(Content, Delimiter, ColDelim : string): string; // for actors var Data, cast_role : string; ColLen : Integer; begin ColLen := Length(ColDelim); Result := ''; Content := TextBetween(Content, '
', ('
' + CRLF)); //2021-02-28 stacca paragrafi value := StringReplace(value, './n', ('.' + CRLF)); //2021-02-28 stacca paragrafi HTMLRemoveTags(Value); Value := 'AMG SYNOPSIS: ' + fulltrim(Value) + ' -- ' + fulltrim(Dummy); if GetOption('SynopsisOptions') = 1 then SetField(fieldDescription, Value); if GetOption('SynopsisOptions') = 2 then SetField(fieldComments, Value); end; // Characteristics if (CanSetField(fieldComments)) and (GetOption('CharacteristicsOptions') > 0) then begin Value := TextBetween(Page, '
'; endchar := ''; Content := initchar + TextBetween(Content, initchar, endchar); Content := RemoveSpaces(Content, True); Content := StringReplace(Content, '
', ('
' + CRLF)); value := StringReplace(value, './n', ('.' + CRLF)); //2021-02-28 stacca paragrafi HTMLRemoveTags(Content); HTMLDecode(Content); Value := UTF8Decode(Content); if (Length(Value) > 0) then Value := Fulltrim(Value) + ' -- ' + Dummy + CRLF + CRLF; if GetOption('ReviewOptions') = 1 then begin //if (GetOption('SynopsisOptions')= 1) or (GetOption('AwardsOptions')= 1) or (GetOption('FieldforCredits')= 1) then Value := 'AMG REVIEW: ' + Value; SetField(fieldDescription, Value); end; if GetOption('ReviewOptions') = 2 then begin //if (GetOption('SynopsisOptions')= 2) or (GetOption('AwardsOptions')= 2) or (GetOption('FieldforCredits')= 2) then Value := 'AMG REVIEW: ' + Value; SetField(fieldComments, Value) end; end; // Awards -> description if (CanSetField(fieldComments) or CanSetField(fieldDescription)) and (GetOption('AwardsOptions') > 0) and (Pos('