Note that it works only with AMC's user agent, so the link above does not return anything if used in a web browser (except if you change the user agent).
Yeah, it could use both, IMDB Number, and Title. The title isn't the best option because the API throws to most recent movie with that name. Let me know if you want to leave just the IMDB option (the old script use both).
If you use IMDB for the title search within the script I guess it is more reliable then, since IMDB's search engine is quite good.
Else, for the title, you may try to encode it with UrlEncode before passing it to GetPage function.
NOTE: If someone really needs to search by Movie Name let me know to implement this to the script, just remember that the MPDB API only throws the last movie made with that name, so isn't very realiable to use this method.
(***************************************************
Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/
[Infos]
Authors=Necrocter, daws0n
Title=MoviePosterDB
Description=Download posters from MoviePosterDB
Site=www.movieposterdb.com
Language=?
Version=0.2
Requires=3.5.1
Comments=The script needs a valid IMDB URL.
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
GetInfo=1
[Options]
***************************************************)
program MoviePosterDB;
uses
StringUtils1;
var
IMDB: string; // Stores the imdb number
KEY: string; // Stores the key to use the API
MPDBURL: string; // Stores the url to parse
procedure AnalyzePage(Address: string);
var
PageText: string;
Value: string;
begin
PageText := GetPage(Address);
if Pos('{"errors":["No parameters found..."]}', PageText) > 0 then
begin
ShowMessage('No movie found for this search');
Exit;
end
Value := TextBetween(PageText, '"image_location":"', '"}');
Value := StringReplace(Value, '\', '');
GetPicture(Value);
end;
//** The main rutine **/
begin
if CheckVersion(3,5,0) then
begin
IMDB := '';
IMDB := GetField(fieldURL);
if Pos('imdb', IMDB) > 0 then
begin
IMDB := TextAfter(IMDB, 'title/tt');
IMDB := IntToStr(StrToInt(IMDB,0));
KEY := GetPage('http://update.antp.be/amc/scripts/services/movieposterdb.php?id=' + IMDB);
MPDBURL := 'http://api.movieposterdb.com/json?imdb_code=' + IMDB + '&api_key=antmovcat&secret=' + KEY + '&width=300&callback=process';
AnalyzePage(MPDBURL);
end
else
begin
ShowMessage('You need a valid IMDB URL in the URL field to use this script.');
end
end
else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.5.0)');
end.