This is a script for XXX movies.
Fields are fill with french information (french site).
----------------------------------------------------------------
Import DVD X.ifs
Code: Select all
// GETINFO SCRIPTING
// Import DVD X import with picture
(***************************************************
* Movie importation script for: *
* importdvdx.com, http://www.importdvdx.com *
* *
* (c) 2002 Rincevent *
* *
* www.ant.be.tf/moviecatalog ··· www.buypin.com *
* *
* The source code of the script can be used in *
* another program only if full credits to *
* script author and a link to Ant Movie Catalog *
* website are given in the About box or in *
* the documentation of the program *
***************************************************)
program importdvdx;
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;
function DelFirstBlank(line: string): string;
begin
while ( (pos(' ', line) = 1)
or (pos(#13, line) = 1)
or (pos(#09, line) = 1)
or (pos(#10, line) = 1) ) do
Delete(line, 1, 1);
result := line;
end;
procedure AnalyzePage(Address: string);
var
Page: TStringList;
LineNr: Integer;
MovieTitle,MovieAddress: string;
Line: string;
BeginPos, EndPos: Integer;
begin
Line := GetPage(Address);
if Pos('Best DVD X', Line) > 0 then
begin
PickTreeClear;
BeginPos := pos('style="color:#FF0000">', Line);
while (BeginPos > 0) do
begin
//titre := Page.GetString(LineNr);
Delete(Line, 1, BeginPos + 20);
MovieTitle := copy(Line, pos('>', Line) + 1, pos('</td>', Line) - 1);
HTMLRemoveTags(MovieTitle);
BeginPos := pos('rubriques/infos.php4?code=', Line);
Delete(Line, 1, BeginPos -1);
MovieAddress := copy(Line, 1, pos('&', Line) -1 );
PickTreeAdd(MovieTitle, 'http://www.importdvdx.com/' + MovieAddress);
BeginPos := pos('style="color:#FF0000">', Line);
end;
if PickTreeExec(Address) then
begin
Line := GetPage(Address);
SetField(fieldURL, Address);
AnalyzeMoviePage(Line);
end
end;
end;
procedure AnalyzeMoviePage(PageContents: string);
var
Line, Value: string;
LineNr, BeginPos, EndPos: Integer;
Page: TStringList;
begin
//Titre
BeginPos := Pos('id="gd">', PageContents);
delete(PageContents,1,BeginPos+7);
//SetField(fieldComments,PageContents );
// Titles traduit
EndPos := Pos('</font>', PageContents);
Value := copy(PageContents, 0, EndPos);
Value :=StringReplace(Value, '<center>', ' ');
HTMLRemoveTags(Value);
//Value :=StringReplace(Value, #09, '');
//Value :=StringReplace(Value, #13#10 , '');
SetField(fieldOriginalTitle, Value);
// Year
BeginPos := Pos('id="sl">', PageContents);
delete(PageContents,1,BeginPos+4);
EndPos := Pos(')', PageContents);
Value := copy(PageContents, Pos('(', PageContents), EndPos -1);
//Value :=StringReplace(Value, ' ' , '');
HTMLRemoveTags(Value);
Value :=StringReplace(Value, '(' , '');
Value :=StringReplace(Value, ')' , '');
SetField(fieldYear, Value);
// Producer
BeginPos := Pos('Studio :', PageContents);
delete(PageContents,1,BeginPos+7);
EndPos := Pos('</a>', PageContents);
Value := copy(PageContents, 0, EndPos);
//Value :=StringReplace(Value, ' ' , '');
HTMLRemoveTags(Value);
Value := DelFirstBlank(Value);
SetField(fieldProducer, Value);
// Category
BeginPos := Pos('Genre :', PageContents);
delete(PageContents,1,BeginPos+6);
EndPos := Pos('</a>', PageContents);
Value := copy(PageContents, 0, EndPos);
Value :=StringReplace(Value, ' ' , '');
HTMLRemoveTags(Value);
if (Pos(Value,'GENERAL') >0) then
Value := 'Film X'
else
Value := 'Film X - ' + Value;
SetField(fieldCategory, Value);
// Picture
BeginPos := Pos('src="/fiches_produits/images_site/images_fiches2/', PageContents);
delete(PageContents,1,BeginPos - 1);
delete(PageContents,1, Pos('2/', PageContents) +1);
EndPos := Pos('.jpg', PageContents);
Value := Copy(PageContents, 1, EndPos + 3);
GetPicture('http://www.importdvdx.com/fiches_produits/images_site/images_fiches/' + Value, False);
//SetField(fieldComments, 'http://www.importdvdx.com/fiches_produits/images_site/images_fiches/' + Value);
//NAME=scenario
BeginPos := Pos('id="sp">', PageContents);
delete(PageContents,1,BeginPos + 7);
EndPos := Pos('<font', PageContents);
Value := copy(PageContents, 0, EndPos-1);
HTMLRemoveTags(Value);
HTMLDecode(Value);
Value := DelFirstBlank(Value);
SetField(fieldDescription, Value);
//Realisateur
BeginPos := Pos('Réalisé par :', PageContents);
delete(PageContents,1,BeginPos + 26);
EndPos := Pos('</a>', PageContents);
Value := copy(PageContents, 0, EndPos);
HTMLRemoveTags(Value);
Value := DelFirstBlank(Value);
SetField(fieldDirector, Value);
// Acteurs
BeginPos := Pos('id="sp">Avec :', PageContents);
delete(PageContents,Pos(':', PageContents),BeginPos + 13);
EndPos := Pos('<font', PageContents);
Value := copy(PageContents, 0, EndPos -1);
HTMLRemoveTags(Value);
Value :=StringReplace(Value, ', ' , ',');
Value :=StringReplace(Value, ',' , #13#10);
SetField(fieldActors, Value);
// Length
BeginPos := Pos('id="spl">Durée :', PageContents);
delete(PageContents,1,BeginPos+19);
delete(PageContents,1,Pos(':', PageContents)+1);
EndPos := Pos('mn', PageContents);
Value := copy(PageContents, 1, EndPos -1);
Value :=StringReplace(Value, ' ' , '');
HTMLRemoveTags(Value);
SetField(fieldLength, Value);
DisplayResults;
end;
begin
if CheckVersion(3,4,1) then
begin
MovieName := GetField(fieldOriginalTitle);
if MovieName = '' then
MovieName := GetField(fieldTranslatedTitle);
if Input('importdvdx.com Import', 'Entrez le titre du film :', MovieName) then
begin
AnalyzePage('http://www.importdvdx.com/indexSite.fan?rub=DVD&pro=1&News=2&Precos=1&ban=2&Power=rubrique&categ=1&rubrik=1&motscles='+UrlEncode(MovieName)+'&zero=1&triMC=1');
//MovieName := 'http://www.importdvdx.com/rubriques/infos.php4?code=2202';
//AnalyzeMoviePage(MovieName);
end;
end else
// ShowMessage('Ce script requiert la version 3.4.1 ou supérieure de Ant Movie Catalog.');
end.