I Would Like create a scripts other two spanish pages

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
iNoT
Posts: 11
Joined: 2004-03-17 10:15:09

I Would Like create a scripts other two spanish pages

Post by iNoT »

Hello,

My english it's poor, sorry

I Would like create two new scripts other two spanish database films one is carteles.metropoliglobal.com and other is a dvd shop, www.dvdgo.com but i understand all scripts code, i need help,

Someone can help me? spanish prefer :)
micmic

Post by micmic »

Here you are, this is for carteles (with spanish messages) ;)

Code: Select all

// GETINFO SCRIPTING
// Carteles-Metropoli v1.0 by micmic.ifs

program micmic;
var
  MovieName: string;
const
  Base = 'http://carteles.metropoliglobal.com/';
  BaseURL = 'http://carteles.metropoliglobal.com/4resultados.php?titulo=';
  BaseURL2 = '&director=&interpretes=&Submit=Buscar';

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 AnalyzePage(Address: string);
var
  Page: TStringList;
  LineNr: Integer;
  PosIni, PosFin: Integer;
  Line, SubLine: string;
  Title, DirURL: string;
  txtTemp: string;
begin
  Page := TStringList.Create;
  Page.Text := GetPage(Address);
  if Pos('No se han encontrado resultados', Page.Text) > 0 then
  begin
    ShowMessage('No se ha encontrado ningún artículo por título.');
  end else
  begin
    PickTreeClear;
    PickTreeAdd('Resultados de la búsqueda para "' + MovieName + '":', '');
    
    // buscamos los resultados
    LineNr := 0;

    while LineNr < Page.Count do
    begin
      SubLine := Page.GetString(LineNr);
      txtTemp := '<td width="92%"><font size="2" face="Arial, Helvetica, sans-serif"><strong><a href="';
      PosIni := pos(txtTemp, SubLine);
      if PosIni > 0 then
      begin
        SubLine := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
        
        txtTemp := '">';
        PosFin := pos(txtTemp, SubLine);
        DirURL := Base + Copy(SubLine, 1, PosFin - 1);
        
        SubLine := Copy(SubLine, PosFin + Length(txtTemp), Length(SubLine));
        txtTemp := '</a>';
        PosFin := pos(txtTemp, SubLine);
        Title := Copy(SubLine, 1, PosFin - 1);

        //ShowMessage(Title + '-->' + DirURL);
        PickTreeAdd(Title, DirURL);
      end;
      LineNr := LineNr + 1;
    end;

    Page.Free;
    if PickTreeExec(Address) then
      AnalyzeMoviePage(Address);
  end;
end;


procedure AnalyzeMoviePage(Address: string);
var
  Page: TStringList;
  PosIni, PosFin: Integer;
  dirBase: string;
  txtTemp: string;
  txtAux: string;
  campo, valor: string;
  LineNr: Integer;
  Line, SubLine: string;
  Imagen: string;
  Comentarios: string;
begin
  //ShowMessage(Address);
  Page := TStringList.Create;
  Page.Text := StringReplace(GetPage(Address), '<br>', #13#10);
  
  // buscamos los campos
  Comentarios := '';
  Imagen := '';
  LineNr := 0;
  while LineNr < Page.Count do
  begin
    SubLine := Page.GetString(LineNr);
    
    txtTemp := '<title>';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos('</title>', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if campo <> '' then SetField(fieldTranslatedTitle, campo);
    end;
    
    txtTemp := '<td valign="TOP" bgcolor="#FFFFFF"><div align="right"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos(':', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);

      LineNr := LineNr + 2;
      SubLine := Page.GetString(LineNr);
      txtTemp := '<td valign="TOP" bgcolor="#F5F5F5"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">';
      PosIni := pos(txtTemp, SubLine);
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos('</font></td>', txtAux);
      valor := Copy(txtAux, 1, PosFin - 1);

      if campo = 'AÑO' then SetField(fieldYear, valor);
      if campo = 'NACIONALIDAD' then SetField(fieldCountry, valor);
      if campo = 'DIRECTOR' then SetField(fieldDirector, valor);
      if campo = 'INTÉRPRETES' then SetField(fieldActors, valor);

      if campo = 'DURACION' then Comentarios := Comentarios + 'Duración: ' + valor + #13#10;
      if campo = 'GUIÓN' then Comentarios := Comentarios + 'Guión: ' + valor + #13#10;
      if campo = 'FOTOGRAFÍA' then Comentarios := Comentarios + 'Fotografía: ' + valor + #13#10;
      if campo = 'MÚSICA' then Comentarios := Comentarios + 'Música: ' + valor + #13#10;

      //ShowMessage(campo + '-->' + valor);
    end;
    
    txtTemp := '/cpp/albums/userpics/';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni, Length(SubLine));
      PosFin := pos('" width="', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if Imagen = '' then Imagen := Base + campo;
    end;
    
    LineNr := LineNr + 1;
  end;
  
  if Comentarios <> '' then SetField(fieldComments, Comentarios);
  if Imagen <> '' then GetPicture(Imagen, False);

  Page.Free;
  DisplayResults;
end;

// bmicmic: Bucle Principal
begin
  if CheckVersion(3,4,0) then
  begin
    MovieName := GetField(fieldOriginalTitle);
    if MovieName = '' then
      MovieName := GetField(fieldTranslatedTitle);
    Input('Importar de Carteles.Metropoli', 'Introduce el Titulo de la Pelicula:', MovieName);
    AnalyzePage(BaseURL + UrlEncode(MovieName) + BaseURL2);
   
  end else
       ShowMessage('Este script necesita una versión superior de Ant Movie Catalog (al menos la version 3.4.0)');
end.
Guest

Post by Guest »

ou really nice, I´M impresionated, now, I would like ask new question,

the sinopsis don't found, and playtime if possible?

or combinated with culturalia, or imdb, for the fields blank?

i like very much your work thnks!
iNoT
Posts: 11
Joined: 2004-03-17 10:15:09

Post by iNoT »

sorry the guest i am , but i don't no apareance my nick,

my english is poor , if you understand spanish i talk you in spanish , thanks for your work!
Guest

Post by Guest »

ups... sorry for the sinopsis (I forgot it), this is the new script with sinopsis:

Code: Select all

// GETINFO SCRIPTING
// Carteles-Metropoli v1.0 by micmic.ifs

program micmic;
var
  MovieName: string;
const
  Base = 'http://carteles.metropoliglobal.com/';
  BaseURL = 'http://carteles.metropoliglobal.com/4resultados.php?titulo=';
  BaseURL2 = '&director=&interpretes=&Submit=Buscar';

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 AnalyzePage(Address: string);
var
  Page: TStringList;
  LineNr: Integer;
  PosIni, PosFin: Integer;
  Line, SubLine: string;
  Title, DirURL: string;
  txtTemp: string;
begin
  Page := TStringList.Create;
  Page.Text := GetPage(Address);
  if Pos('No se han encontrado resultados', Page.Text) > 0 then
  begin
    ShowMessage('No se ha encontrado ningún artículo por título.');
  end else
  begin
    PickTreeClear;
    PickTreeAdd('Resultados de la búsqueda para "' + MovieName + '":', '');
    
    // buscamos los resultados
    LineNr := 0;

    while LineNr < Page.Count do
    begin
      SubLine := Page.GetString(LineNr);
      txtTemp := '<td width="92%"><font size="2" face="Arial, Helvetica, sans-serif"><strong><a href="';
      PosIni := pos(txtTemp, SubLine);
      if PosIni > 0 then
      begin
        SubLine := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
        
        txtTemp := '">';
        PosFin := pos(txtTemp, SubLine);
        DirURL := Base + Copy(SubLine, 1, PosFin - 1);
        
        SubLine := Copy(SubLine, PosFin + Length(txtTemp), Length(SubLine));
        txtTemp := '</a>';
        PosFin := pos(txtTemp, SubLine);
        Title := Copy(SubLine, 1, PosFin - 1);

        //ShowMessage(Title + '-->' + DirURL);
        PickTreeAdd(Title, DirURL);
      end;
      LineNr := LineNr + 1;
    end;

    Page.Free;
    if PickTreeExec(Address) then
      AnalyzeMoviePage(Address);
  end;
end;


procedure AnalyzeMoviePage(Address: string);
var
  Page: TStringList;
  PosIni, PosFin: Integer;
  dirBase: string;
  txtTemp: string;
  txtAux: string;
  campo, valor: string;
  LineNr: Integer;
  Line, SubLine: string;
  Imagen: string;
  Comentarios: string;
begin
  //ShowMessage(Address);
  Page := TStringList.Create;
  Page.Text := StringReplace(GetPage(Address), '<br>', #13#10);
  
  // buscamos los campos
  Comentarios := '';
  Imagen := '';
  LineNr := 0;
  while LineNr < Page.Count do
  begin
    SubLine := Page.GetString(LineNr);
    
    txtTemp := '<title>';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos('</title>', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if campo <> '' then SetField(fieldTranslatedTitle, campo);
    end;
    
    txtTemp := '<td valign="TOP" bgcolor="#FFFFFF"><div align="right"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos(':', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);

      LineNr := LineNr + 2;
      SubLine := Page.GetString(LineNr);
      txtTemp := '<td valign="TOP" bgcolor="#F5F5F5"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">';
      PosIni := pos(txtTemp, SubLine);
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos('</font></td>', txtAux);
      valor := Copy(txtAux, 1, PosFin - 1);

      if campo = 'AÑO' then SetField(fieldYear, valor);
      if campo = 'NACIONALIDAD' then SetField(fieldCountry, valor);
      if campo = 'DIRECTOR' then SetField(fieldDirector, valor);
      if campo = 'INTÉRPRETES' then SetField(fieldActors, valor);

      if campo = 'DURACION' then Comentarios := Comentarios + 'Duración: ' + valor + #13#10;
      if campo = 'GUIÓN' then Comentarios := Comentarios + 'Guión: ' + valor + #13#10;
      if campo = 'FOTOGRAFÍA' then Comentarios := Comentarios + 'Fotografía: ' + valor + #13#10;
      if campo = 'MÚSICA' then Comentarios := Comentarios + 'Música: ' + valor + #13#10;

      //ShowMessage(campo + '-->' + valor);
    end;
    
    txtTemp := '/cpp/albums/userpics/';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni, Length(SubLine));
      PosFin := pos('" width="', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if Imagen = '' then Imagen := Base + campo;
    end;
    
    txtTemp := '<td valign="TOP" colspan="2"><font size="1" face="Arial, Helvetica, sans-serif">';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos('</font></td>', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if campo <> '' then SetField(fieldDescription, campo);
    end;
    
    LineNr := LineNr + 1;
  end;
  
  if Comentarios <> '' then SetField(fieldComments, Comentarios);
  if Imagen <> '' then GetPicture(Imagen, False);

  Page.Free;
  DisplayResults;
end;

// bmicmic: Bucle Principal
begin
  if CheckVersion(3,4,0) then
  begin
    MovieName := GetField(fieldOriginalTitle);
    if MovieName = '' then
      MovieName := GetField(fieldTranslatedTitle);
    Input('Importar de Carteles.Metropoli', 'Introduce el Titulo de la Pelicula:', MovieName);
    AnalyzePage(BaseURL + UrlEncode(MovieName) + BaseURL2);
   
  end else
       ShowMessage('Este script necesita una versión superior de Ant Movie Catalog (al menos la version 3.4.0)');
end.
PD: I'm spanish and my english is so bad, but this site is english/french and there are more people that can help you in more lenguajes.

PD2: about duration... "no pidas peras al olmo" ;) (it's a spanish "joke")
micmic
Posts: 24
Joined: 2004-03-21 13:36:45
Location: Mi casa
Contact:

Post by micmic »

hey... I'm the Guest... problem with logon, sorry
iNoT
Posts: 11
Joined: 2004-03-17 10:15:09

Post by iNoT »

xDDD "no pidas peras al olmo!" really nice

thnks for your work! i like it

The Duration and genre can get on imdb? its possible?


testing the scripts! you hace news for me later...

thnks
micmic
Posts: 24
Joined: 2004-03-21 13:36:45
Location: Mi casa
Contact:

Post by micmic »

Using the script I found some films where the picture don't run. I modify the script in this way:

Code: Select all

    txtTemp := '/cpp/albums/userpics/';
    PosIni := pos(txtTemp, SubLine);
    if ((PosIni > 0) and (Imagen = '')) then
    begin
      txtAux := Copy(SubLine, PosIni, Length(SubLine));
      PosFin := pos('" width="', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if Imagen = '' then Imagen := Base + campo;
    end;
//this is the other directory I found
    txtTemp := '/c/';
    PosIni := pos(txtTemp, SubLine);
    if ((PosIni > 0) and (Imagen = '')) then
    begin
      txtAux := Copy(SubLine, PosIni, Length(SubLine));
      PosFin := pos('" width="', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if Imagen = '' then Imagen := Base + campo;
    end;
I'm testing too
iNoT
Posts: 11
Joined: 2004-03-17 10:15:09

Post by iNoT »

hello , news :)

if possible that in the search when list all films appears :

title ( original tittle ) [year]


and if possible that the url appears in the database??


thnks for your help
micmic
Posts: 24
Joined: 2004-03-21 13:36:45
Location: Mi casa
Contact:

Post by micmic »

iNoT wrote:if possible that in the search when list all films appears :
title ( original tittle ) [year]
Ups, I think it's impossible, because when you search the first page is very simple and this information doesn't appear (example: http://carteles.metropoliglobal.com/4re ... mit=Buscar)
iNoT wrote:and if possible that the url appears in the database??
Here the new script complete: two folders for possible images, original tittle and the url

Code: Select all

// GETINFO SCRIPTING
// Carteles-Metropoli v1.0 by micmic.ifs

(***************************************************
 *  Author: micmic (micmic@dieznet.com)            *
 *  Script for the importation of pictures from    *
 *  carteles.metropoliglobal.com                   *
 *                                                 *
 *  For use with Ant Movie Catalog 3.4.0           *
 *  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 micmic;
var
  MovieName: string;
const
  Base = 'http://carteles.metropoliglobal.com/';
  BaseURL = 'http://carteles.metropoliglobal.com/4resultados.php?titulo=';
  BaseURL2 = '&director=&interpretes=&Submit=Buscar';

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 AnalyzePage(Address: string);
var
  Page: TStringList;
  LineNr: Integer;
  PosIni, PosFin: Integer;
  Line, SubLine: string;
  Title, DirURL: string;
  txtTemp: string;
begin
  Page := TStringList.Create;
  Page.Text := GetPage(Address);
  if Pos('No se han encontrado resultados', Page.Text) > 0 then
  begin
    ShowMessage('No se ha encontrado ningún artículo por título.');
  end else
  begin
    PickTreeClear;
    PickTreeAdd('Resultados de la búsqueda para "' + MovieName + '":', '');
   
    // buscamos los resultados
    LineNr := 0;

    while LineNr < Page.Count do
    begin
      SubLine := Page.GetString(LineNr);
      txtTemp := '<td width="92%"><font size="2" face="Arial, Helvetica, sans-serif"><strong><a href="';
      PosIni := pos(txtTemp, SubLine);
      if PosIni > 0 then
      begin
        SubLine := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
       
        txtTemp := '">';
        PosFin := pos(txtTemp, SubLine);
        DirURL := Base + Copy(SubLine, 1, PosFin - 1);
       
        SubLine := Copy(SubLine, PosFin + Length(txtTemp), Length(SubLine));
        txtTemp := '</a>';
        PosFin := pos(txtTemp, SubLine);
        Title := Copy(SubLine, 1, PosFin - 1);

        //ShowMessage(Title + '-->' + DirURL);
        PickTreeAdd(Title, DirURL);
      end;
      LineNr := LineNr + 1;
    end;

    Page.Free;
    if PickTreeExec(Address) then
      AnalyzeMoviePage(Address);
  end;
end;


procedure AnalyzeMoviePage(Address: string);
var
  Page: TStringList;
  PosIni, PosFin: Integer;
  dirBase: string;
  txtTemp: string;
  txtAux: string;
  campo, valor: string;
  LineNr: Integer;
  Line, SubLine: string;
  Imagen: string;
  Comentarios: string;
begin
  //ShowMessage(Address);
  
  SetField(fieldURL, Address);
  
  Page := TStringList.Create;
  Page.Text := StringReplace(GetPage(Address), '<br>', #13#10);
 
  // buscamos los campos
  Comentarios := '';
  Imagen := '';
  LineNr := 0;
  while LineNr < Page.Count do
  begin
    SubLine := Page.GetString(LineNr);
   
    txtTemp := '<title>';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos('</title>', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if campo <> '' then SetField(fieldTranslatedTitle, campo);
    end;
    
    txtTemp := '<td width="68%" valign="TOP" bgcolor="#F5F5F5"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos('</font></td>', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if campo <> '' then SetField(fieldOriginalTitle, campo);
    end;
    
    txtTemp := '<td valign="TOP" bgcolor="#FFFFFF"><div align="right"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos(':', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);

      LineNr := LineNr + 2;
      SubLine := Page.GetString(LineNr);
      txtTemp := '<td valign="TOP" bgcolor="#F5F5F5"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">';
      PosIni := pos(txtTemp, SubLine);
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos('</font></td>', txtAux);
      valor := Copy(txtAux, 1, PosFin - 1);

      if campo = 'AÑO' then SetField(fieldYear, valor);
      if campo = 'NACIONALIDAD' then SetField(fieldCountry, valor);
      if campo = 'DIRECTOR' then SetField(fieldDirector, valor);
      if campo = 'INTÉRPRETES' then SetField(fieldActors, valor);

      if campo = 'DURACION' then Comentarios := Comentarios + 'Duración: ' + valor + #13#10;
      if campo = 'GUIÓN' then Comentarios := Comentarios + 'Guión: ' + valor + #13#10;
      if campo = 'FOTOGRAFÍA' then Comentarios := Comentarios + 'Fotografía: ' + valor + #13#10;
      if campo = 'MÚSICA' then Comentarios := Comentarios + 'Música: ' + valor + #13#10;

      //ShowMessage(campo + '-->' + valor);
    end;
   
    txtTemp := '/cpp/albums/userpics/';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni, Length(SubLine));
      PosFin := pos('" width="', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if Imagen = '' then Imagen := Base + campo;
    end;
//this is the other directory I found
    txtTemp := '/c/';
    PosIni := pos(txtTemp, SubLine);
    if ((PosIni > 0) and (Imagen = '')) then
    begin
      txtAux := Copy(SubLine, PosIni, Length(SubLine));
      PosFin := pos('" width="', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if Imagen = '' then Imagen := Base + campo;
    end;
   
    txtTemp := '<td valign="TOP" colspan="2"><font size="1" face="Arial, Helvetica, sans-serif">';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos('</font></td>', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if campo <> '' then SetField(fieldDescription, campo);
    end;
   
    LineNr := LineNr + 1;
  end;
 
  if Comentarios <> '' then SetField(fieldComments, Comentarios);
  if Imagen <> '' then GetPicture(Imagen, False);

  Page.Free;
  DisplayResults;
end;

// bmicmic: Bucle Principal
begin
  if CheckVersion(3,4,0) then
  begin
    MovieName := GetField(fieldOriginalTitle);
    if MovieName = '' then
      MovieName := GetField(fieldTranslatedTitle);
    Input('Importar de Carteles.Metropoli', 'Introduce el Titulo de la Pelicula:', MovieName);
    AnalyzePage(BaseURL + UrlEncode(MovieName) + BaseURL2);
   
  end else
       ShowMessage('Este script necesita una versión superior de Ant Movie Catalog (al menos la version 3.4.0)');
end.
:D
iNoT
Posts: 11
Joined: 2004-03-17 10:15:09

Post by iNoT »

you are my crackman! that's a lot for your work i test it, and apears the web link really nice, but i understand you about two folders for possible images.


and now, the big poster if possible captured?

i see that you say about of search , it's imposible i think soo

mmmm i see now one bug, the duration of films isen't captured you see that?
Guest

Post by Guest »

iNoT wrote:you are my crackman! that's a lot for your work i test it, and apears the web link really nice, but i understand you about two folders for possible images.
;)
iNoT wrote:and now, the big poster if possible captured?
arggg... you wise, I do: a selection box with two alternatives: the little and the big... here you are the new script:

Code: Select all

// GETINFO SCRIPTING
// Carteles-Metropoli v1.0 by micmic.ifs

(***************************************************
 *  Author: micmic (micmic@dieznet.com)            *
 *  Script for the importation of pictures from    *
 *  carteles.metropoliglobal.com                   *
 *                                                 *
 *  For use with Ant Movie Catalog 3.4.0           *
 *  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 micmic;
var
  MovieName: string;
const
  Base = 'http://carteles.metropoliglobal.com/';
  BaseURL = 'http://carteles.metropoliglobal.com/4resultados.php?titulo=';
  BaseURL2 = '&director=&interpretes=&Submit=Buscar';

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 AnalizaBigImagePage(ImagenURL: string): string;
var
  Page: TStringList;
  LineNr: Integer;
  PosIni, PosFin: Integer;
  Line, SubLine: string;
  txtTemp: string;
begin
  Page := TStringList.Create;
  Page.Text := GetPage(ImagenURL);
  
  txtTemp := '<td bgcolor="#FFFFFF"><div align="center"><img src="';
  LineNr := FindLine(txtTemp, Page, 0);
  if LineNr > 0 then
  begin
    Line := Page.GetString(LineNr);

    PosIni := pos(txtTemp, Line);
    SubLine := Copy(Line, PosIni + Length(txtTemp), Length(Line));

    txtTemp := '"';
    PosFin := pos(txtTemp, SubLine);

    txtTemp := Copy(SubLine, 1, PosFin - 1);
  end else
    txtTemp := '';
    
  Page.Free;

  result := txtTemp;
end;

procedure AnalyzePage(Address: string);
var
  Page: TStringList;
  LineNr: Integer;
  PosIni, PosFin: Integer;
  Line, SubLine: string;
  Title, DirURL: string;
  txtTemp: string;
begin
  Page := TStringList.Create;
  Page.Text := GetPage(Address);
  if Pos('No se han encontrado resultados', Page.Text) > 0 then
  begin
    ShowMessage('No se ha encontrado ningún artículo por título.');
  end else
  begin
    PickTreeClear;
    PickTreeAdd('Resultados para "' + MovieName + '" en ' + Base + ':', '');
   
    // buscamos los resultados
    LineNr := 0;

    while LineNr < Page.Count do
    begin
      SubLine := Page.GetString(LineNr);
      txtTemp := '<td width="92%"><font size="2" face="Arial, Helvetica, sans-serif"><strong><a href="';
      PosIni := pos(txtTemp, SubLine);
      if PosIni > 0 then
      begin
        SubLine := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
       
        txtTemp := '">';
        PosFin := pos(txtTemp, SubLine);
        DirURL := Base + Copy(SubLine, 1, PosFin - 1);
       
        SubLine := Copy(SubLine, PosFin + Length(txtTemp), Length(SubLine));
        txtTemp := '</a>';
        PosFin := pos(txtTemp, SubLine);
        Title := Copy(SubLine, 1, PosFin - 1);

        //ShowMessage(Title + '-->' + DirURL);
        PickTreeAdd(Title, DirURL);
      end;
      LineNr := LineNr + 1;
    end;

    Page.Free;
    if PickTreeExec(Address) then
      AnalyzeMoviePage(Address);
  end;
end;

procedure AnalyzeMoviePage(Address: string);
var
  Page: TStringList;
  PosIni, PosFin: Integer;
  dirBase: string;
  txtTemp: string;
  txtAux: string;
  campo, valor: string;
  LineNr: Integer;
  Line, SubLine: string;
  ImagenPeqSRC, ImagenURL, ImagenGrandeSRC: string;
  Comentarios: string;
begin
  //ShowMessage(Address);
  
  SetField(fieldURL, Address);
  
  Page := TStringList.Create;
  Page.Text := StringReplace(GetPage(Address), '<br>', #13#10);
 
  // buscamos los campos
  Comentarios := '';
  ImagenPeqSRC := '';
  ImagenURL := '';
  ImagenGrandeSRC := '';
  LineNr := 0;
  while LineNr < Page.Count do
  begin
    SubLine := Page.GetString(LineNr);
   
    txtTemp := '<title>';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos('</title>', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if campo <> '' then SetField(fieldTranslatedTitle, campo);
    end;
    
    txtTemp := '<td width="68%" valign="TOP" bgcolor="#F5F5F5"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos('</font></td>', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if campo <> '' then SetField(fieldOriginalTitle, campo);
    end;
    
    txtTemp := '<td valign="TOP" bgcolor="#FFFFFF"><div align="right"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos(':', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);

      LineNr := LineNr + 2;
      SubLine := Page.GetString(LineNr);
      txtTemp := '<td valign="TOP" bgcolor="#F5F5F5"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">';
      PosIni := pos(txtTemp, SubLine);
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos('</font></td>', txtAux);
      valor := Copy(txtAux, 1, PosFin - 1);

      if campo = 'AÑO' then SetField(fieldYear, valor);
      if campo = 'NACIONALIDAD' then SetField(fieldCountry, valor);
      if campo = 'DIRECTOR' then SetField(fieldDirector, valor);
      if campo = 'INTÉRPRETES' then SetField(fieldActors, valor);

      if campo = 'DURACION' then Comentarios := Comentarios + 'Duración: ' + valor + #13#10;
      if campo = 'GUIÓN' then Comentarios := Comentarios + 'Guión: ' + valor + #13#10;
      if campo = 'FOTOGRAFÍA' then Comentarios := Comentarios + 'Fotografía: ' + valor + #13#10;
      if campo = 'MÚSICA' then Comentarios := Comentarios + 'Música: ' + valor + #13#10;

      //ShowMessage(campo + '-->' + valor);
    end;
   
    txtTemp := '/cpp/albums/userpics/';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni, Length(SubLine));
      PosFin := pos('" width="', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if ImagenPeqSRC = '' then ImagenPeqSRC := Base + campo;
    end;
//this is the other directory I found
    txtTemp := '/c/';
    PosIni := pos(txtTemp, SubLine);
    if ((PosIni > 0) and (ImagenPeqSRC = '')) then
    begin
      txtAux := Copy(SubLine, PosIni, Length(SubLine));
      PosFin := pos('" width="', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if ImagenPeqSRC = '' then ImagenPeqSRC := Base + campo;
    end;
    
    //now the big image
    txtTemp := 'pgrande.php?image_id=';
    PosIni := pos(txtTemp, SubLine);
    if ((PosIni > 0) and (ImagenURL = '')) then
    begin
      txtAux := Copy(SubLine, PosIni, Length(SubLine));
      PosFin := pos('">', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if ImagenURL = '' then ImagenURL := Base + campo;
    end;

    txtTemp := '<td valign="TOP" colspan="2"><font size="1" face="Arial, Helvetica, sans-serif">';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos('</font></td>', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if campo <> '' then SetField(fieldDescription, campo);
    end;
   
    LineNr := LineNr + 1;
  end;
 
  if Comentarios <> '' then SetField(fieldComments, Comentarios);
  
  if ImagenURL <> '' then ImagenGrandeSRC := Base + AnalizaBigImagePage(ImagenURL);
  
  //ShowMessage(ImagenGrandeSRC + '<--' + ImagenPeqSRC);

  If (ImagenGrandeSRC <> '') or (ImagenPeqSRC <> '') then
  begin
    PickTreeClear;
    PickTreeAdd('Imagenes para  "' + MovieName + '" en ' + Base + ':', '');

    If (ImagenPeqSRC <> '') then PickTreeAdd('Pequeña', ImagenPeqSRC);
    If (ImagenGrandeSRC <> '') then PickTreeAdd('Grande', ImagenGrandeSRC);

    if PickTreeExec(Address) then GetPicture(Address, False);

  end;

  Page.Free;
  DisplayResults;
end;

// bmicmic: Bucle Principal
begin
  if CheckVersion(3,4,0) then
  begin
    MovieName := GetField(fieldOriginalTitle);
    if MovieName = '' then
      MovieName := GetField(fieldTranslatedTitle);
    Input('Importar de ' + Base, 'Introduce el Titulo de la Pelicula:', MovieName);
    AnalyzePage(BaseURL + UrlEncode(MovieName) + BaseURL2);
   
  end else
       ShowMessage('Este script necesita una versión superior de Ant Movie Catalog (al menos la version 3.4.0)');
end.
iNoT wrote:mmmm i see now one bug, the duration of films isen't captured you see that?
I know, but the page code for the duration is different and I don't know how capture... thinking....
:D
micmic
Posts: 24
Joined: 2004-03-21 13:36:45
Location: Mi casa
Contact:

Post by micmic »

Guest = micmic logoff :/ Sorry
iNoT
Posts: 11
Joined: 2004-03-17 10:15:09

Post by iNoT »

sorry I'm very bored I know but thnks for your time.


I testing that.....


I thnk about the duration Bug!
iNoT
Posts: 11
Joined: 2004-03-17 10:15:09

Post by iNoT »

my good friend micmic really nice....

the poster ouuu its lovely your best creation

now only 4 fields apears in white

Calification : it's imposible in this web
Produccer : it's Imposible in this web
genre : it's imposible in this web, no apears info about genre
Duration : ....

I think, that this info can get in IMDB?

ufff I do more and more testing with this script I love the script , the poster its great...

My crackmen!
micmic
Posts: 24
Joined: 2004-03-21 13:36:45
Location: Mi casa
Contact:

Post by micmic »

iNoT wrote:Calification : it's imposible in this web
I use an 1...5 scale like the page:

Code: Select all

    txtTemp := '<img src="galeriaforo/images/rating';
    PosIni := pos(txtTemp, SubLine);
    if PosIni > 0 then
    begin
      txtAux := Copy(SubLine, PosIni + Length(txtTemp), Length(SubLine));
      PosFin := pos('.', txtAux);
      campo := Copy(txtAux, 1, PosFin - 1);
      if campo <> '' then SetField(fieldRating, campo);
    end;
Add this code after the "<title>" paragraph.

Everything is possible :D
iNoT
Posts: 11
Joined: 2004-03-17 10:15:09

Post by iNoT »

are you sure? :)

genre? it's possible?


jejejejej
Post Reply