[ES] Cineol (+Culturalia) (ES) FIXED (+Alpacine)

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.
peque
Posts: 23
Joined: 2009-02-02 23:53:20

[ES] Cineol (+Culturalia) (ES) FIXED (+Alpacine)

Post by peque »

Hola,

Acabo de terminar un pequeño (bueno... no tanto) fix para que este script vuelva a recuperar bien la imagen (más grande, y más disponibles) de Culturalianet.

Tengo que limpiar el código y acabar de retocar alguna cosa (mañana, estoy cansado)... si a alguien le interesa que avise, lo subiré.

Un saludo.
Last edited by peque on 2009-02-16 11:29:56, edited 1 time in total.
PeNeWaN
Posts: 10
Joined: 2008-04-12 17:09:29

Post by PeNeWaN »

Buenas!
A mi me interesa :D tambien has solucionado el tema de que recupere bien la información de "premios" de cada pelicula? (vuelve a remitir la sinopsis en éste campo)

Saludos!
peque
Posts: 23
Joined: 2009-02-02 23:53:20

Post by peque »

Es que Cineol no presenta el apartado Premios desde hace unos días... Simplemente he obviado ese apartado, pero el script almenos recupera bien toda la info del campo Comentarios, y no repite la sinopsis.

Veo que no puedo añadir archivos por aquí. Ahora lo subo y te paso el link.
peque
Posts: 23
Joined: 2009-02-02 23:53:20

Post by peque »

Ahí va:

Actualizado

Un saludo.
Last edited by peque on 2009-02-05 14:49:14, edited 2 times in total.
peque
Posts: 23
Joined: 2009-02-02 23:53:20

Post by peque »

Tengo lista la versión 1.6, en la que se analizan todas las páginas de resultados de Culturalianet (en caso de haberlas), y no sólo la primera. Haré un par de pruebas y la pongo por aquí.

bye!
peque
Posts: 23
Joined: 2009-02-02 23:53:20

Post by peque »

Ahí va la 1.6:

Actualizado

bye!
Last edited by peque on 2009-02-16 08:54:46, edited 1 time in total.
PeNeWaN
Posts: 10
Joined: 2008-04-12 17:09:29

Post by PeNeWaN »

Gracias campeón, voy a probarlo ahora mismo ;)
peque
Posts: 23
Joined: 2009-02-02 23:53:20

1.9beta

Post by peque »

Wola,

Nueva versión. Changelog:
v 1.9beta (16-Febrero 2009)
-----------------------

He tocado tantas cosas desde la 1.6 (y encima soy un desastre como programador) que no tengo muy claros los
canvios, pero vamos a intentarlo:

- Añadida búsqueda de carátula en Alpacine. ¡Son enormes!. Se puede seleccionar cual de las 3 opciones (o cualquier
combinación) de carátula se quiere bajar, modificando las variables oportunas: BuscaMiniCaratula, BuscaCaratula y
BuscaGranCaratula.
- La variable FiltradoAnyo controla el nivel de filtrado que se quiere aplicar a las búsquedas de carátulas en
Culturalianet y en Alpacine. Esto es así porque la base de datos de películas de Cineol no siempre coincide en
cuanto a año de estreno con las de Culturalianet o Alpacine:
0 : No se filtra por año las películas encontradas.
1 : Se filtra de los resultados cualquier película que no se haya estrenado el año de estreno según Cineol,
el anterior, o el siguiente. Recomendado. Salen menos resultados, y es bastante probable que la película
esté entre ellos.
2 : Se filtra de los resultados cualquier película que no se haya estrenado el año de estreno según Cineol,
sin excepciones. Mucho más restrictivo, puede que no se muestren películas que en realidad sí que están.
En ese caso, se puede optar por bajar el nivel a 1 o 0.
- En ModoBatch, la búsqueda de carátulas en Culturalianet y Alpacine está filtrada en modo 2 SIEMPRE, para evitar
falsos "matches" al buscar carátulas de películas.
- Reescrito el procedimiento AnalyzePage_Alpacine desde cero. El original mostraba carácteres extraños en alguna
ocasión (Amelie, por ejemplo).
- Modificado el paso del nombre de película a AnalyzePage_Alpacine. El script original no encuentra películas con
acentos.
- Cambiada la URL de consulta a Alpacine. Es mejor buscar en la página normal (no en tipo=2 y todo=1), ya que los
resultados salen ordenados por coincidencia. En caso de haber más de 10 resultados, se muestra la opción de buscar
todos los resultados. En ese caso, aparecerán por orden alfabético.
- Mejorado el paseo de la página de resultados de Culturalianet. A veces aparecían opciones vacías.
- Paginación de resultados de Culturalianet y Alpacine. Así sólo se hace un GetPage y el script es más rápido.
- Añadida opción para recuperar TODAS las curiosidades de una película en Cineol. Se controla con la variable
MasCuriosidades. En caso de dejarla a 0, baja una curiosidad al azar (la que aparece en la página de la película
en Cineol.
- Añadida opción para recuperar los ERRORAMAS. Se controla con la variable Erroramas. Se añaden al final, en el
campo "Comentarios".

Seguro que he cometido errores, y aunque he hecho bastantes pruebas (gracias z3us por ayudarme con ellas), es posible
que no todo funcione perfectamente. Cualquier problema, por favor avisadme a peque@idecnet.com.

por PeQuE
http://www.peque.org/cosas/Cineol.[Cult ... S]_bPQ.ifs

Un saludo.
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

What is it compared to "Cineol (+Culturalia)" script? Another one which adds Alpacine, or a replacement of that one?
peque
Posts: 23
Joined: 2009-02-02 23:53:20

Post by peque »

Well... it's not an official update, as I haven't talked to original developers...

Cover retrieving from Culturalia is not working in original script. I've fixed this, and I've added cover retrieval from Alpacine.com, greater covers in spanish. I've also improved some parts of the code, and added some more info retrieval from Cineol.

I'm not sure if original developers had in mind to fix the script... :P I just did it and make it available. :P

bye!
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

If it makes what the original script does + other things, I guess it can replace it :D
Only problem is that the name is different, I'll see if I rename it or add it with the new name.
peque
Posts: 23
Joined: 2009-02-02 23:53:20

Post by peque »

New name is more descriptive about what script does... but do it the way you feel better. :)

PD: Download it again, so I've corrected some spelling errors in changelog. :P
peque
Posts: 23
Joined: 2009-02-02 23:53:20

Post by peque »

And again some fixes related to html character parsing from Cineol. Sorry. You can find updated version in original link.
clamatac
Posts: 6
Joined: 2008-08-26 19:58:30

Post by clamatac »

cineol ha actualizado el interfaz de su web y el scrip ha dejado de ir

en este link:

http://www.cineol.net/forum/viewtopic.p ... 5#p2325985

el usuario indica billyberjas puede pasar los datos concretos para actualizarlo

me vendría genial el scrip porque me encanta cineol y el ant movie

Gracias
PeNeWaN
Posts: 10
Joined: 2008-04-12 17:09:29

Post by PeNeWaN »

Seguro que peque no nos deja en la estacada, :grinking: y en un pispas se lo come con patatas xD

Saludos y gracias peque de antemano.
legrad
Posts: 109
Joined: 2006-02-11 09:46:06
Location: Lerida-Spain

Dejo un adaptacion mia provisional por si a alguien le sirve

Post by legrad »

Dejo un adaptacion mia provisional por si a alguien le sirve
Todos los datos se extraen de cineol se carga la caratula de alpacine si en alpacine no se encuentra la caratula se carga la pequeña que hay en cineol

Code: Select all

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

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

[Infos]
Authors=Legrad
Title=Cineol-Alpacine
Description=
Site=www.cineol.net-www.alpacine.com
Language=ES
Version=1.0
Requires=3.5.0
Comments=
License=
GetInfo=1

[Options]

***************************************************)

program CineolAlpacine;
var
  MovieName: string;
  MovieURL: string;
  //---------------------------------------------------------------------
function Acentos(Acento: string) :string;
begin
          Acento := StringReplace(Acento, 'á' , 'á');
          Acento := StringReplace(Acento, 'é' , 'é');
          Acento := StringReplace(Acento, 'á­' , 'í');
          Acento := StringReplace(Acento, 'í' ,  'í');
          Acento := StringReplace(Acento, 'ó',   'ó');
          Acento := StringReplace(Acento, 'ú',  'ú');
          Acento := StringReplace(Acento, 'ñ', 'ñ');

result := Acento;
end;
//------------------------------------------------------------------------------------
function BorraComillas(var S: string): string;
var
   n,len, tag: Integer;
   c: char;
   t: String;
begin
   tag := 0;
   t := '';
   len := length(s);
   for n :=1 to len do
   begin
     c := Copy(s,n,1);
     if c = '''' then
        c := ' ';
        t := t + c;
   end
   s := t;
   result := t;
end;

//------------------------------------------------------------------
                              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 TextBetween(var S: string; StartTag: string; EndTag: string): string;
var
  InitialPos: Integer;
begin
  InitialPos := Pos(StartTag, S);
  if InitialPos = 0 then
    result := ''
  else
  begin
    Delete(S, 1, InitialPos + Length(StartTag) - 1);
    InitialPos := Pos(EndTag, S);
    if InitialPos = 0 then
      result := S
    else
    begin
      result := copy(S, 1, InitialPos - 1);
      Delete(S, 1, InitialPos + 1);
    end;
  end;
end;

//------------------------------------------------------------------------------------
                               function DeleteTags(var S: string): string;
var
   n,len, tag: Integer;
   c: char;
   t: String;
begin

   tag := 0;
   t := '';
   len := length(s);

   for n :=1 to len do
   begin
      c := Copy(s,n,1);


      if c = #9 then
         c := ' ';

      if(tag=1) then
      begin
         if(c='>') then tag := 0;
         continue;
      end
      else
      begin
         if(c='<') then
         begin
            tag := 1;
            continue;
         end;
         t := t + c;
      end;
   end
   s := t;
   result := t;
end;


//------------------------------------------------------------------------------------
procedure AnalyzePage(Address: string);
var
  strPage, MovieAddr, MovieTitle, MovieDate, MovieID, Movie: string;
  BeginPos, EndPos: Integer;
  BeginPoss, EndPoss: Integer;
begin
  strPage := GetPage(Address);
  BeginPos := Pos('<h1>Resultados de la búsqueda en CINeol</h1>', strPage);
  if(BeginPos > -1)then
    begin
      PickTreeClear;
      Delete(strPage, 1, BeginPos);
      BeginPos := Pos('<h3><a href="pelicula/', strPage);
      EndPos := 1;
      while ((BeginPos > 0) and (EndPos > 0)) do

        begin
          Delete(strPage, 1, BeginPos);
          EndPos := Pos('">', strPage);
          MovieId := Copy(strPage,+22, EndPos-22);
          MovieAddr := 'http://www.cineol.net/pelicula/' + MovieId;
          BeginPoss := Pos('">',strPage);
          EndPoss := Pos('</a>', strPage);
          MovieTitle := Copy(strPage,BeginPoss, EndPoss);
          MovieTitle  := TextBetween(MovieTitle ,'">', #13#10);
          DeleteTags (MovieTitle);
          HTMLDecode(MovieTitle);
          MovieTitle := UTF8Decode(MovieTitle);
          MovieTitle  := Acentos(MovieTitle);
          PickTreeAdd(MovieTitle, MovieAddr);
          BeginPos := Pos('<h3><a href="pelicula/', strPage);
          if(Pos('</body>', strPage) < BeginPos) then
           BeginPos := -1;
        end;

    end;
    PickTreeSort;
    PickTreeExec(Address)
    AnalyzeMoviePage(Address);
end;
//------------------------------------------------------------------------------------
procedure AnalyzeMoviePage(Address: string);
var
  Page: TStringList;
  LineNr: Integer;
  Line: string;
  Item: string;
  Comments: string;
  Actors: string;
  Directors: string;
  Description: string;
  Busca: integer;


begin
  Description := '';

  // URL
  SetField(fieldURL, Address);

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

  // Titulo Original
  LineNr := FindLine('tulo Original</strong>:', Page, 0);
  if LineNr <> -1 then
  begin
    Line := Page.GetString(LineNr);
    Item := TextBetween (Line, 'tulo Original</strong>:', '</');
    HTMLDecode(Item);
    DeleteTags (Item);
    Item  := Acentos(Item);
    SetField(fieldOriginalTitle, Trim (Item));
  end;
  
  // año
 LineNr := FindLine('<li><strong>A', Page, 0);
  if LineNr > 0 then
  begin
    Item := copy(Page.Text, pos('a<li><strong>A',Page.Text), length(Page.Text));
    Item := TextBetween (Item, 'o:</strong> ', '</');
    Item  := Trim(Item );
    HTMLDecode(Item);
    SetField(fieldYear, Trim (Item));
  end;
  
   // Categoria
  LineNr := FindLine('nero:</strong> ', Page, 0);
  if LineNr > 0 then
  begin
    Item := copy(Page.Text, pos('nero:</strong> ',Page.Text), length(Page.Text));
    Item := TextBetween (Item, 'nero:</strong> ', '</');
    Item  := Trim(Item );
    HTMLDecode(Item);
    DeleteTags (Item);
    Item  := Acentos(Item);
    SetField(fieldCategory, Trim (Item));
  end;
  
  // pais
  LineNr := FindLine('<li><strong>Pa', Page, 0);
  if LineNr <> -1 then
  begin
    Line := Page.GetString(LineNr);
    Item := TextBetween (Line, 's:</strong>', '</');
    Item  := StringReplace(Item , '/', ',');
    HTMLDecode(Item);
    DeleteTags (Item);
    Item  := Acentos(Item);
    SetField(fieldCountry, Trim (Item));
  end;
  
  // Duracion
  LineNr := FindLine('<li><strong>Duraci', Page, 0);
  if LineNr > 0 then
  begin
    Item := copy(Page.Text, pos('<li><strong>Duraci',Page.Text), length(Page.Text));
    Item := TextBetween (Item, 'n</strong>:', 'minutos');
    Item  := Trim(Item );
    HTMLDecode(Item);
    SetField(fieldLength, Trim (Item));
  end;
 
    // director
  LineNr := FindLine('<li><strong>Direcci', Page, 0);
  if LineNr > 0 then
  begin
    Item := copy(Page.Text, pos('<li><strong>Direcci',Page.Text), length(Page.Text));
    Item := TextBetween (Item, '">', '</a></li>');
    Item  := Trim(Item );
    HTMLDecode(Item);
    DeleteTags (Item);
    Item  := Acentos(Item);
    SetField(fieldDirector, Trim (Item));
  end;
  
  // productor
  LineNr := FindLine('<li><strong>Producci', Page, 0);
  if LineNr > 0 then
  begin
    Item := copy(Page.Text, pos('<li><strong>Producci',Page.Text), length(Page.Text));
    Item := TextBetween (Item, '">', '</a></li>');
    Item  := Trim(Item );
    HTMLDecode(Item);
    DeleteTags (Item);
    Item  := Acentos(Item);
    SetField(fieldProducer, Trim (Item));
  end;
  
   // sinopsis
 LineNr := FindLine('<h2>Sinopsis</h2>', Page, 0);
  if LineNr > 0 then
  begin
    Item := copy(Page.Text, pos('<h2>Sinopsis</h2>',Page.Text), length(Page.Text));
    Item := TextBetween (Item, '<h2>Sinopsis</h2>', '</p>');
    Item := StringReplace(Item , #13#10, '');
    Item  := StringReplace(Item , '  ', '');
    DeleteTags (Item);
    Item  := Trim(Item );
    HTMLDecode(Item);
    Item  := Acentos(Item);
    SetField(fieldDescription, Trim (Item));
  end;
 
  // Reparto
  LineNr := FindLine('rpretes</h2>', Page, 0);
  if LineNr > 0 then
  begin
    Item := copy(Page.Text, pos('rpretes</h2>',Page.Text), length(Page.Text));
    Item := TextBetween (Item, '</tr>', '</table>');
    Item := StringReplace(Item , '</a><td>', ' (');
    Item := StringReplace(Item , '</td></tr>', '), ');
    Item := StringReplace(Item , #13#10, '');
    DeleteTags (Item);
    Item  := Trim(Item );
    HTMLDecode(Item);
    Item := StringReplace(Item , '   ', ' ');
    Item  := Acentos(Item);
    SetField(fieldActors, Trim (Item));
  end;
  
   // Guión
LineNr := FindLine('<li><strong>Gui', Page, 0);
if LineNr <> -1 then
begin
Item := copy(Page.Text, pos('<li><strong>Gui',Page.Text), length(Page.Text));
Item := TextBetween (Item, '">', '</a>');
DeleteTags (Item);
Item := Trim(Item);
HTMLDecode(Item);
Item  := Acentos(Item);
Comments := Comments + 'Guión: ' + Item +#13#10;
end;

// Fotografia
LineNr := FindLine('<li><strong>Fotograf', Page, 0);
if LineNr <> -1 then
begin
Item := copy(Page.Text, pos('<li><strong>Fotograf',Page.Text), length(Page.Text));
Item := TextBetween (Item, '">', '</a>');
DeleteTags (Item);
Item := Trim(Item);
HTMLDecode(Item);
Item  := Acentos(Item);
Comments := Comments + 'Fotografía: ' + Item +#13#10;
end;

// Musica
LineNr := FindLine('sica:</strong>', Page, 0);
if LineNr <> -1 then
begin
Item := copy(Page.Text, pos('sica:</strong>',Page.Text), length(Page.Text));
Item := TextBetween (Item, '">', '</a>');
DeleteTags (Item);
Item := Trim(Item);
HTMLDecode(Item);
Item  := Acentos(Item);
Comments := Comments + 'Música: ' + Item +#13#10;
end;

// formato
LineNr := FindLine('<li><strong>Formato:</strong>', Page, 0);
if LineNr <> -1 then
begin
Item := copy(Page.Text, pos('<li><strong>Formato:</strong>',Page.Text), length(Page.Text));
Item := TextBetween (Item, '<li><strong>Formato:</strong>', '</');
DeleteTags (Item);
Item := Trim(Item);
HTMLDecode(Item);
Item  := Acentos(Item);
Comments := Comments + 'Formato: ' + Item +#13#10;
end;

// Estreno
LineNr := FindLine('<li><strong>Estreno en Espa', Page, 0);
if LineNr <> -1 then
begin
Item := copy(Page.Text, pos('<li><strong>Estreno en Espa',Page.Text), length(Page.Text));
Item := TextBetween (Item, '</strong>', '</li>');
DeleteTags (Item);
Item := Trim(Item);
HTMLDecode(Item);
Item  := Acentos(Item);
Comments := Comments + 'Estreno en España: ' + Item +#13#10;
end;

// Recaudacion
LineNr := FindLine('<li><strong>Recaudación Espa', Page, 0);
if LineNr <> -1 then
begin
Item := copy(Page.Text, pos('<li><strong>Recaudación Espa',Page.Text), length(Page.Text));
Item := TextBetween (Item, '</strong>', '</');
DeleteTags (Item);
Item := Trim(Item);
HTMLDecode(Item);
Item  := Acentos(Item);
Comments := Comments + 'Recaudación España: ' + Item +#13#10;
end;

// Recaudacion mundial
LineNr := FindLine('<li><strong>Estreno Mund', Page, 0);
if LineNr <> -1 then
begin
Item := copy(Page.Text, pos('<li><strong>Estreno Mund',Page.Text), length(Page.Text));
Item := TextBetween (Item, '</strong>', '</');
DeleteTags (Item);
Item := Trim(Item);
HTMLDecode(Item);
Item  := Acentos(Item);
Comments := Comments + 'Recaudación mundial: ' + Item +#13#10;
end;

SetField(fieldComments, Comments);



   // Caratula
  LineNr := FindLine('<img src="galeria/carteles/', Page, 0);
  if LineNr <> -1 then
  begin
     Line := Page.GetString(Linenr);
     Item := TextBetween (Line, '<img src="galeria/carteles/', '"');
     GetPicture ('http://www.cineol.net/galeria/carteles/'+Item);
  end;
  
   // Titulo traducido
  LineNr := FindLine('<title>', Page, 0);
  Line := Page.GetString(LineNr);
  Item := TextBetween (Line, '<title>', '::');
  HTMLDecode(Item);
  DeleteTags (Item);
  Item  := Acentos(Item);
  SetField(fieldTranslatedTitle, Trim (Item));
  
  
  //--------------------------------------------------------
Item := StringReplace (Item, ' ', '+');
Page.Text := GetPage('http://www.google.es/search?hl=es&as_qdr=all&q=%22'+(Item)+'%22+site%3Aalpacine.com&btnG=Buscar&meta=');
LineNr := FindLine('en el dominio <b>alpacine.com', Page, 0);
 if LineNr > 0 then
  begin
    Item := copy(Page.Text, pos('href="http://alpacine.com/pelicula/',Page.Text), length(Page.Text));
    Item := TextBetween (Item, 'href="http://alpacine.com/pelicula/', '"');
    Page.Text := GetPage('http://alpacine.com/pelicula/'+Item);
LineNr := FindLine('<img src="http://img.alpacine.com/carteles/', Page, 0);
  if LineNr > 0 then
  begin
    Item := copy(Page.Text, pos('<img src="http://img.alpacine.com/carteles/',Page.Text), length(Page.Text));
    Item := TextBetween (Item, '<img src="http://img.alpacine.com/carteles/', '-');
    GetPicture ('http://img.alpacine.com/carteles/'+(Item)+'.jpg');
 end;
 end;
  end;




//end;
 //-------------------------------------------------------------------------
begin
       if (CheckVersion(3,5,0)=FALSe) then
   begin
      ShowMessage('Se requiere Ant Movie Catalog versión 3.5 o superior');
      exit;
   end;

   MovieName := GetField(fieldTranslatedTitle);
   if MovieName = '' then
            MovieName := GetField(fieldOriginalTitle);
Input('Cineol-Alpacine ', 'Buscar:', MovieName);

     if(GetOption('Sin resultado') = 0) then  Input('Cineol-Alpacine', 'Buscar:', MovieName);

   AnalyzePage('http://www.cineol.net/search.php?search=' + UrlEncode(MovieName)+'&select=0&button=Buscar');
end.
peque
Posts: 23
Joined: 2009-02-02 23:53:20

Post by peque »

Coooño... la que me han liao en un par de meses que no he usado el script...

Voy a ver qué se puede hacer. Espero que no sea mucha cosa...
peque
Posts: 23
Joined: 2009-02-02 23:53:20

Post by peque »

Bufff... totalmente diferente. Me va a llevar tiempo, y no lo tengo. :(

legrad, tu script no se lleva demasiado bien con los acentos. Échale un ojo.
clamatac
Posts: 6
Joined: 2008-08-26 19:58:30

Post by clamatac »

peque wrote:Bufff... totalmente diferente. Me va a llevar tiempo, y no lo tengo. :(

legrad, tu script no se lleva demasiado bien con los acentos. Échale un ojo.
Aunque tardes tiempo, yo y seguro que muchos te agredeceríamos la corrección del script :grinking:
peque
Posts: 23
Joined: 2009-02-02 23:53:20

Post by peque »

Es que no es sólo un cambio estético que sólo me haría tocar la parte de parsing... han cambiado estructuras y todo...

Ya digo que no ando libre como hace unos meses. :(

Lo que me toca más la moral es que es un trabajo laborioso (sobretodo para alguien que programa de año en año como yo) que te pueden echar por tierra muy fácilmente con cambios como estos. Lo interesante de verdad sería poder llegar a algún acuerdo con alguna web de películas de forma que publicara sus contenidos en un formato fácilmente parseable y sin grandes alteraciones en el tiempo, como en su día hizo Culturalianet. Voy a ver si puedo hacer algo en ese sentido...

Un saludo.
Post Reply