(***************************************************
Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/
[Infos]
Authors=folgui (folgui@bigfoot.com), gilistico
Title=AdictosAlCine (ES)
Description=Movie importation script for adictosalcine
Site=http://www.adictosalcine.com
Language=ES
Version=0.4 (04/03/2007)
Requires=3.5.0
Comments=
License=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.|
GetInfo=1
[Options]
***************************************************)
program adictosalcine;
uses
StringUtils1;
const
SearchInitialURL = 'http://www.adictosalcine.com/buscar.phtml?letra=&year=&texto=';
SearchFinalURL = '&tip=1&lan=&cat=&orden=4';
BaseURL = 'http://www.adictosalcine.com/';
var
MovieName: string;
MovieURL: string;
//------------------------------------------------------------------------------------
procedure AnalyzePage(Address: string);
var
Page: TStringList;
LineNr: Integer;
Line: string;
MovieTitle, MovieAddress: string;
begin
PickTreeClear;
Page := TStringList.Create;
Page.Text := GetPage(Address);
if Pos('Resultados de la búsqueda', Page.Text) = 0 then
begin
ShowMessage('No se ha podido establecer la conexion.');
Page.Free;
exit;
end;
LineNr := FindLine('Título de la Película ', Page, 0);
LineNr := LineNr + 7;
Line := Page.GetString(LineNr);
if Pos ('No se han encontrado coincidencias', Line) <> 0 then
begin
ShowMessage('No se han encontrado resultados para "' + MovieName + '"');
Page.Free;
exit;
end;
LineNR := 0;
while TRUE do
begin
LineNr := FindLine('&titulo=', Page, LineNR+1);
if LineNR = -1 then
break;
Line := Page.GetString(LineNr);
MovieTitle := TextBetween (Line, 'class="menu" target="_top">', '');
HTMLDecode(MovieTitle);
MovieAddress := TextBetween (Line, '', '') + ')';
PickTreeAdd(MovieTitle, BaseURL + MovieAddress);
end;
if PickTreeExec(Address) then
AnalyzeMoviePage(Address);
Page.Free;
end;
procedure AnalyzeMoviePage(Address: string);
var
Page: TStringList;
LineNr, aux: Integer;
Line: string;
Item: string;
Comments: string;
Actors: string;
Producers: string;
Directors: string;
Writers: string;
Description: string;
begin
Comments := '';
Actors := '';
Writers := '';
Producers := '';
Description := '';
Page := TStringList.Create;
Page.Text := GetPage(UrlEncode(Address));
//Genero
LineNr := FindLine('GÉNERO', Page, 0);
if LineNR <> -1 then
begin
Line := Page.GetString(LineNr+1);
Item := TextBetween (Line, 'class="azul">','');
HTMLDecode(Item);
SetField(fieldCategory, Trim(Item));
end;
//Valoracion
LineNr := FindLine(' Media:', Page, 0);
if LineNR <> -1 then
begin
Line := Page.GetString(LineNr+1);
HTMLRemoveTags(Line);
Item := IntToStr(Round(StrToInt(StrGet(Line, 1), 0)));
SetField(fieldRating, Item);
end;
//URL
LineNr := FindLine('Dirección: ', Page, 0);
if LineNR <> -1 then
begin
Line := Page.GetString(LineNr);
Item := TextBetween (Line, ' ','
');
HTMLDecode(Item);
SetField(fieldURL, Trim(Item));
end;
//Titulo
LineNr := FindLine('