hi
just found great source for large cover images. Could anybody please make a script fot it?
thanks
http://www.dvdlister.com/[/url]
script for http://www.dvdlister.com/
Code: Select all
// GETINFO SCRIPTING
// Imports large picture from dvdlister
// Dmitry501
program DVDLister_com;
const
BaseAddress = 'http://www.dvdlister.com/';
var
MovieName: string;
function FindLine(Pattern: string; List: TStringList; StartAt: Integer): Integer;
var
i: Integer;
begin
result := -1;
if StartAt < 0 then
StartAt := 0;
for i := StartAt to List.Count-1 do
if Pos(Pattern, List.GetString(i)) <> 0 then
begin
result := i;
Break;
end;
end;
procedure AddMoviesTitles(Page: TStringList; var LineNr: Integer);
var
Line, Line1: string;
MovieTitle, MovieAddress: string;
BeginPos,EndPos,AddPos: Integer;
begin
Line := Page.GetString(LineNr);
EndPos := pos('Popular titles', Line);
Delete(Line,EndPos,Length(Line));
repeat
BeginPos := pos('<span class="title">', Line);
If BeginPos > 0 then
begin
EndPos := pos('</span>', Line);
MovieTitle:=copy(Line,BeginPos,EndPos - BeginPos);
Line1 := MovieTitle;
HTMLRemoveTags(MovieTitle);
BeginPos := pos ('HREF="',Line1);
AddPos := pos('/">', Line1);
MovieAddress:=copy(Line1,BeginPos+6,AddPos - BeginPos - 5);
PickTreeAdd(MovieTitle, MovieAddress);
Delete(Line,1,EndPos);
end;
until BeginPos <= 0;
end;
procedure AnalyzePage(Address: string);
var
Page: TStringList;
LineNr : Integer;
Params : String;
begin
Page := TStringList.Create;
Page.Text := GetPage(Address);
PickTreeClear;
LineNr := 0;
LineNr := FindLine('results for title containing', Page, LineNr);
if LineNr > -1 then
begin
PickTreeAdd('Search: '+MovieName,'');
AddMoviesTitles(Page, LineNr);
end;
if PickTreeExec(Address) then
begin
AnalyzeMoviePage(Address);
end
end;
procedure AnalyzeMoviePage(Address: String);
var
Page: TStringList;
LineNr : Integer;
Line, Value : String;
BeginPos, EndPos : Integer;
begin
Page := TStringList.Create;
Page.Text := GetPage(Address);
// Picture
LineNr := FindLine('View front cover', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('href="', Line);
EndPos := pos('">View front cover', Line);
Value := copy(Line, BeginPos+6, EndPos - BeginPos-6);
Address := Value;
Page.Text := GetPage(Address);
LineNr := FindLine('Front cover DVD', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('src="', Line);
EndPos := pos('" alt="Front cover DVD"', Line);
Value := copy(Line, BeginPos+5, EndPos - BeginPos-5);
GetPicture(Value, True); // NOT WORKING!!! GETPICTURE filesize=0!
end;
end;
DisplayResults;
end;
begin
if CheckVersion(3,4,0) then
begin
MovieName := GetField(fieldOriginalTitle);
if MovieName = '' then
MovieName := GetField(fieldTranslatedTitle);
if Input('Import picture from www.dvdlister.com', 'Enter the title of the movie:', MovieName) then
begin
AnalyzePage('http://www.dvdlister.com/search.dvd?type=T&searchvalue='+UrlEncode(MovieName));
end;
end else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.0)');
end.