
Is there a posibility that I get a & in my URL??
Code: Select all
program batch;
const
// Set the following constants to True to import field, or False to skip field
ImportURL = false;
ImportOriginalTitle = false;
ImportTranslatedTitle = false;
LeaveOriginalTitle = True; // True will get Translated Title, yet Original Title field will remain same
ImportYear = false;
ImportRating = false;
ImportPicture = True;
ImportLargePicture = true; // If set to False small pic will be imported
ImportDirector = false;
ImportActors = false;
ImportCountry = false;
ImportCategory = false;
ImportDescription = false;
UseLongestDescription = False; // If set to False shortest description available will be imported
ImportComments = false;
ImportLength = True;
ImportLanguage = false;
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();
var
Line, value: string;
Page: TStringList;
LineNr: Integer ;
MovieTitle, MovieAddress: string;
StartPos, beginpos, endpos, endp: Integer;
MovieURL: String;
begin
MovieName := GetField(fieldOriginalTitle);
Page := Tstringlist.create;
Page.Text := GetPage('http://www.allposters.com/GetThumb.asp?txtSearch=' + UrlEncode(MovieName));
//showMessage(Page.Text);
LineNr:= FindLine('<title>AllPosters.com Thumbnails', Page, LineNr);
// if LineNr = 0 then
//begin
LineNr := 0;
LineNr := FindLine('<a href="GetThumb.asp?c=c&search=', Page, LineNr);
Line := Page.GetString(LineNr);
//showMessage(Line);
StartPos := pos('<a href="GetThumb.', Line)+9;
endp := pos('search=', Line)+12 ;
if StartPos > 0 then
begin
Startpos := Startpos ;
MovieAddress := copy(Line, StartPos, endp - startpos );
//showMessage(MovieAddress)
//StartPos := pos('">', Line) + 2;
//MovieTitle := copy(Line, StartPos, pos('</A>', Line) - StartPos);
// HTMLDecode(Movietitle);
//if Length(Result) <= 0 then
MovieURL :=MovieAddress;
showMessage(MovieURL);
begin
// Picture
Page.Text := GetPage(MovieURL) ;
ShowMessage(Page.Text);
// end else
LineNr := 0 ;
LineNr := FindLine('<img src="http://imagecache2.allposters.com/images/', Page, 0);
if LineNr < 0 then
LineNr := FindLine('<img alt="cover" align="left" src="http://images.amazon.com/', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
ShowMessage(Line);
BeginPos := pos('<img src="http://imagecache2.allposters.com/images/', Line) + 9;
Delete(Line, 1, BeginPos);
EndPos := pos('"', Line);
Value := copy(Line, 1, EndPos - 1);
showMessage(Value);
// GetPicture(Value, False); // False = do not store picture externally ; store it in the catalog file
end;
end ;
end;
end;
begin
if CheckVersion(3,4,0) then
begin
MovieName := GetField(fieldOriginalTitle);
if MovieName = '' then
MovieName := GetField(fieldTranslatedTitle);
if MovieName = '' then
MovieName := Input('IMDb Import', 'Enter the title of the movie:', MovieName);
if MovieName <> '' then
begin
// AnalyzePage('http://us.imdb.com/Tsearch?title='+UrlEncode(MovieName)+'&restrict=Movies+only');
AddMoviesTitles();
//ShowMessage('http://www.allposters.com/GetThumb.asp?txtSearch='+UrlEncode(MovieName));
end;
end else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.0)');
end.
Code: Select all
LineNr := FindLine('<a href="GetThumb.asp?c=c&search=', Page, LineNr);
Line := Page.GetString(LineNr);
//showMessage(Line);
StartPos := pos('<a href="GetThumb.', Line)+9;
endp := pos('search=', Line)+12 ;
if StartPos > 0 then
begin
Startpos := Startpos ;
MovieAddress := copy(Line, StartPos, endp - startpos );
//showMessage(MovieAddress)
//StartPos := pos('">', Line) + 2;
//MovieTitle := copy(Line, StartPos, pos('</A>', Line) - StartPos);
// HTMLDecode(Movietitle);
//if Length(Result) <= 0 then
MovieURL :='www.allposters.com/gallery.asp?c=c&search=' +movieAddress;
showMessage(MovieURL);
Code: Select all
begin
// Picture
Page.Text := GetPage(MovieURL) ;
ShowMessage(Page.Text);
Code: Select all
// end else
LineNr := 0 ;
LineNr := FindLine('<img src="http://imagecache2.allposters.com/images/', Page, 0);
if LineNr < 0 then
LineNr := FindLine('<img alt="cover" align="left" src="http://images.amazon.com/', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
ShowMessage(Line);
BeginPos := pos('<img src="http://imagecache2.allposters.com/images/', Line) + 9;
Delete(Line, 1, BeginPos);
EndPos := pos('"', Line);
Value := copy(Line, 1, EndPos - 1);
showMessage(Value);