WWW.ADICTOSALCINE.COM

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
Post Reply
DARTS501

WWW.ADICTOSALCINE.COM

Post by DARTS501 »

IS A VERY GOOD PAGES , WHO CAN MAKE AN SCRIPT??
THANK YOU
folgui
Posts: 113
Joined: 2003-02-04 19:15:03
Location: Madrid, Spain

Post by folgui »

Hello!

Here's the script. Alpha version, made on the fly, with copy/paste from others scripts. Sure it has bugs. Try and tell me what doesn't work.

Enjoy!

Code: Select all

(***************************************************

Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/

[Infos]
Authors=folgui (folgui@bigfoot.com)
Title=adictosalcine (ES)
Description=Movie importation script for adictosalcine
Site=http://www.adictosalcine.com
Language=ES
Version=0.1
Requires=3.5.0
Comments=Alpha version, made on the fly.
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=0&lan0&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
  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.');
  end else
  begin
    LineNr := FindLine('<strong>Título de la Película </strong>', 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 + '"');
    end else
    begin
      PickTreeClear;
      Line := TextBetween (Line, 'Se muestran un máximo de <strong>', '</strong> Resultados');
      PickTreeAdd('Encontrados ' + Line + ' resultados para "' + MovieName + '"', '');
      Line := Page.GetString(LineNr); 
      repeat
        MovieTitle := TextBetween (Line, 'class="menu" target="_top">', '</a></td>');
        HTMLDecode(MovieTitle);
        MovieAddress := TextBetween (Line, '<a href="', '" class="menu" ');
        PickTreeAdd(MovieTitle, BaseURL + MovieAddress);
        LineNr := LineNr + 7;
        Line := Page.GetString(LineNr);
      until Pos('<table', Line) > 0;
      if PickTreeExec(Address) then
        AnalyzeMoviePage(Address);
    end;
  end;
  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;
  Description: string;

begin
  Comments := '';
  Actors := '';
  Producers := '';
  Description := '';

  Page := TStringList.Create;
  Page.Text := GetPage(Address);

  //Genero
  LineNr := FindLine('<strong>Género:</strong>', Page, 0);
  Line := Page.GetString(LineNr);
  Item := TextBetween (Line, '<strong>Género:</strong>','<table width=');
  HTMLDecode(Item);
  SetField(fieldCategory, Trim(Item));

  //Valoracion
  LineNr := FindLine('<strong> Media:</strong>', Page, 0);
  Line := Page.GetString(LineNr+1);
  HTMLRemoveTags(Line);
  Item := IntToStr(Round(StrToInt(StrGet(Line, 1), 0)));
  SetField(fieldRating, Item); 

  //URL
  LineNr := FindLine('<b>Dirección:</b> ', Page, 0);
  Line := Page.GetString(LineNr);
  Item := TextBetween (Line, '</b> ','<br>');
  HTMLDecode(Item);
  SetField(fieldURL, Trim(Item));

  //Titulo
  LineNr := FindLine('<td width="100%" align="center" valign="top" bgcolor="#617D99"><font size="4" color="#FFFFFF">', Page, 0);
  Line := Page.GetString(LineNr);
  Item := TextBetween (Line, '<strong>', '</strong></font>');
  HTMLDecode(Item);
  SetField(fieldTranslatedTitle, Trim(Item));

  //Sinopsis
  LineNr := FindLine('<strong>Sinopsis', Page, 0);
  Line := Page.GetString(LineNr+1);
  Item := TextBetween (Line, '<font style="font-size: 12px;">', '</font></p>');
  HTMLDecode(Item);
  SetField(fieldDescription, Trim(Item));

  //Titulo Original
  LineNr := FindLine('<strong>TÍTULO ORIGINAL</strong></td>', Page, 0);
  Line := Page.GetString(LineNr+1);
  Item := TextBetween (Line, '<td width="100%" bgcolor="#EEEEEE">', '</td>');
  HTMLDecode(Item);
  SetField(fieldOriginalTitle, Trim(Item));

  //Country
  LineNr := FindLine('<td><strong>NACIONALIDAD</strong></td>', Page, 0);
  Line := Page.GetString(LineNr+2);
  Item := TextBetween (Line, '<a href="buscar.phtml?lan=8" class="azul">','</a><a href="buscar.phtml?lan=" class="azul"></a>');
  HTMLDecode(Item);
  SetField(fieldCountry, Trim(Item));

  //Director
  LineNr := FindLine('<td><strong>DIRECTOR</strong></td>', Page, 0);
  Line := Page.GetString(LineNr+3);
  Item := TextBetween (Line, '<a href="buscar.phtml?texto=','&tip=0"');
  HTMLDecode(Item);
  SetField(fieldDirector, Trim(Item));

  //Actores
  LineNr := FindLine('<td><strong>LISTA DE INTÉRPRETES</strong></td>', Page, 0);
  begin
    LineNr := LineNr + 3;
    Line := Page.GetString(LineNr);
    Actors := Actors + TextBetween (Line, '<a href="buscar.phtml?texto=', '&tip=0"') + ', ';
    LineNr := LineNr + 1;
    Line := Page.GetString(LineNr);
    while Pos ('</td></tr>', Line) = 0 do
     begin
      Actors := Actors + TextBetween (Line, '<a href="buscar.phtml?texto=', '&tip=0"') + ', ';
      LineNr := LineNr + 1;
      Line := Page.GetString(LineNr);  
     end;
    SetField(fieldActors, Copy(Actors, 1, Length(Actors)-2));
  end;

  //Año
  LineNr := FindLine('<td><strong>AÑO</strong></td>', Page, 0);
  Line := Page.GetString(LineNr+1);
  Item := TextBetween (Line, '<a href="buscar.phtml?year=','&orden=4"');
  HTMLDecode(Item);
  SetField(fieldYear, Trim(Item));

  //Duracion
  LineNr := FindLine('<td><strong>DURACIÓN</strong></td>', Page, 0);
  Line := Page.GetString(LineNr+1);
  Item := TextBetween (Line, '<td bgcolor="#EEEEEE">',' minutos</td>');
  HTMLDecode(Item);
  SetField(fieldLength, Trim(Item));

  // Productor
  LineNr := FindLine('<td><strong>PRODUCTOR</strong></td>', Page, 0);
  begin
    LineNr := LineNr + 3;
    Line := Page.GetString(LineNr);
    Producers := Producers + TextBetween (Line, '<a href="buscar.phtml?texto=', '&tip=0"') + ', ';
    LineNr := LineNr + 1;
    Line := Page.GetString(LineNr);
    while Pos ('</td></tr>', Line) = 0 do
     begin
      Producers := Producers + TextBetween (Line, '<a href="buscar.phtml?texto=', '&tip=0"') + ', ';
      LineNr := LineNr + 1;
      Line := Page.GetString(LineNr);  
     end;
    SetField(fieldProducer, Copy(Producers, 1, Length(Producers)-2));
    //Comments := Comments + 'Productor(es): ' + Copy(Producers, 1, Length(Producers)-2) + #13#10;
  end;

  //Guionista
  LineNr := FindLine('<td><strong>GUIONISTA</strong></td>', Page, 0);
  Line := Page.GetString(LineNr+3);
  Item := TextBetween (Line, '<a href="buscar.phtml?texto=','&tip=0"');
  HTMLDecode(Item);
  Comments := Comments + 'Guionista: ' + Item + #13#10;
  
  //Musica
  LineNr := FindLine('<td><strong>MÚSICA</strong></td>', Page, 0);
  Line := Page.GetString(LineNr+3);
  Item := TextBetween (Line, '<a href="buscar.phtml?texto=','&tip=0"');
  HTMLDecode(Item);
  Comments := Comments + 'Música: ' + Item + #13#10;  

  //Fotografia
  LineNr := FindLine('<td><strong>FOTOGRAFIA</strong></td>', Page, 0);
  Line := Page.GetString(LineNr+3);
  Item := TextBetween (Line, '<a href="buscar.phtml?texto=','&tip=0"');
  HTMLDecode(Item);
  Comments := Comments + 'Fotografía: ' + Item + #13#10; 

  //Montaje
  LineNr := FindLine('<td><strong>MONTAJE</strong></td>', Page, 0);
  Line := Page.GetString(LineNr+3);
  Item := TextBetween (Line, '<a href="buscar.phtml?texto=','&tip=0"');
  HTMLDecode(Item);
  Comments := Comments + 'Montaje: ' + Item + #13#10;

  HTMLDecode(Comments);
  SetField(fieldComments, Comments);
end;

begin
  if CheckVersion(3,5,0) then
  begin
    MovieName := GetField(fieldTranslatedTitle);
    if MovieName = '' then
      MovieName := GetField(fieldOriginalTitle);
    if Input('Importar de Adictos al Cine', 'Introduzca el titulo de la pelicula:', MovieName) then
    begin
      AnalyzePage(SearchInitialURL + UrlEncode(MovieName) + SearchFinalURL);
    end;
  end
  else
    ShowMessage('Este script requiere una version mas reciente de Ant Movie Catalog (por lo menos la version 3.5.0)');
end. 
darts501

ok

Post by darts501 »

it works pefectly
folgui
Posts: 113
Joined: 2003-02-04 19:15:03
Location: Madrid, Spain

Post by folgui »

The only thing it doesn't get is the picture, but i think that the one they provide is very small. Better to import from another script.

Regards, folgui
Post Reply