[FR] Demande de Script bdparadisio.com - ScorEpioN pour toi

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
GareAT
Posts: 8
Joined: 2004-08-19 15:38:07

[FR] Demande de Script bdparadisio.com - ScorEpioN pour toi

Post by GareAT »

Salut ScorEpioN (ou tout être bienveillant qui pourrait me filer un coup de main),

Tu à l'air d'être particulièrement efficace pour créer des scripts d'importation.

Je me sers de AMC pour cataloguer mes films (merci au passage pour ton script sur allociné) et pour répertorier mes BD.

Auparavant, j'utilisais un script pour le site BDParadisio (www.bdparadisio.com) crée par quelqu'un d'autre. Puis le site a été modifié et j'ai moi meme modifié ce script pour récuperer les infos essentielles. Cependant, le site a été à nouveau modifié et je pense qu'il faudrait faire un nouveau script.

Pourrais-tu t'occuper de ce script ?
cf le script original qui peut faire une bonne base : viewtopic.php?t=1043

(Je comprendrais tout à fait que tu dises non :ha: )

Merci de ta réponse.



Sinon le scipt doit permettre de :

Trouver la BD dans le moteur de recherce sur cette page :
http://www.bdparadisio.com/scripts/selalbum.cfm

Récuperer les informations sur une page de résultat :
http://www.bdparadisio.com/scripts/detailbd.cfm?Id=5935

Couverture ---> Image
Série ---> Origine
N° Tome ---> Emprunté par
Titre du tome ---> Titre Original
Scénariste ---> Réalisateur
Dessinateur ---> Producteur
Editeur ---> Pays
Date de sortie ---> Acteur
Nombre de pages ---> Durée
Résumé ---> Description

GareAT
ScorEpioN
Posts: 264
Joined: 2004-08-17 11:02:02

Post by ScorEpioN »

Bon alors j'ai regardé mais je n'aurai pas trop de temps (à cause de mon boulot).

Ca ne devrai pas être très compliqué à faire, mise à part le fait que le site semble utilisé la méthode Post au lieu de Get. Tu devrai regarder le script erreursdefilms pour avoir un squelette de script ;)
GareAT
Posts: 8
Joined: 2004-08-19 15:38:07

Post by GareAT »

Merci d'avoir regardé ScorEpioN

Je vais tenter l'expérience :grinking:
GareAT
Posts: 8
Joined: 2004-08-19 15:38:07

Post by GareAT »

Bon j'ai finalement réussi à modifier le script pour qu'il fonctionne avec le nouveau site de BD paradisio et j'y ai ajouté quelques fonctions (Collection, modifications de certains caractères qui passent pas avec mon template XML).

j'ai cependant besoin d'un coup de main uniquement pour relire le début du script qui m'affiche un ou deux message d'erreur lorsque débute la recherche (peut etre un probleme de cookies).

Alors merci d'avance aux connaisseur :grinking:

Code: Select all

// GETINFO SCRIPTING
// BD Paradisio

(***************************************************
 *  Script d'importation pour :                    *
 *  Bd Paradisio , www.bdparadisio.com             *
 *                                                 *
 *  Script by GareAT                               *
 *  Sur la base du script de Jekkil                *
 *                                                 *
 *                                                 *
 *  A utiliser avec Ant Movie Catalog 3.4.0        *
 *  www.ant.be.tf/moviecatalog                     *
 *                                                 *
 *  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 BDParadisio;
const
  MustImportBitrate = False;
  BaseURL = 'http://www.bdparadisio.com/';
  
  
var
  BDName: string;

function DelFirstBlank(line: string): string;
begin
  while (   (pos(' ', line) = 1)
         or (pos(#09, line) = 1)
         or (pos(#13, line) = 1)
         or (pos(#10, line) = 1) ) do
    Delete(line, 1, 1);
  result := line;
end;
procedure GetReferences(Address: string; QueryType: Integer);
var
  Page: TStringList;
  LineNr: Integer;
  Line, StartTag, EndTag, Url, Caption: string;
  SubL1, SubL2, SubL3, SubL4: string;
  BeginPos, EndPos: Integer;

begin
   // Aller à la page de recherche
    Line := GetPage(Address);
    Line := GetPage(Address);

   if Pos('<A HREF="detailbd.cfm', Line) > 0 then
   begin
      // We have the correct page.

     // Some initialisation
      PickTreeClear;

     StartTag := '<TD align=left  nowrap>';
     EndTag := '</TABLE>';
     BeginPos := Pos ( StartTag, Line );
     EndPos := Pos ( EndTag, Line );
     SubL1 := Copy ( Line, BeginPos, EndPos-BeginPos-Length(StartTag) );

     while Pos( '<A HREF="detailbd.cfm', SubL1 ) > 0 do
     begin
        // Get the URL
        StartTag := 'A HREF="';
        EndTag := '">';
        BeginPos := Pos ( StartTag, SubL1 );
        EndPos := Pos ( EndTag, SubL1 );
       Url := BaseURL + 'scripts/' + Copy ( SubL1, BeginPos + Length(StartTag), EndPos-BeginPos-Length(StartTag) );

       // get the caption
        StartTag := '">';
        EndTag := '</A>';
        BeginPos := Pos ( StartTag, SubL1 );
        EndPos := Pos ( EndTag, SubL1 );
       Caption := Copy ( SubL1, BeginPos + Length(StartTag), EndPos-BeginPos-Length(StartTag) );

       // Add the entry to the tree
       PickTreeAdd(Caption,  Url);

       // Remove processes parts
        EndTag := '</A>';
        EndPos := Pos ( EndTag, SubL1 );
        Delete ( SubL1, 1, EndPos );
     end;

     if PickTreeExec(Address) then
      begin
         AnalyseBdPage(Address);
     end;
   end else
   begin
      if QueryType = 1 then
      begin
         GetReferences(BaseURL + 'scripts/albums.cfm?DATEFROM=01/01/50&DATETO=&IEDITEUR=all&SSERIE=&SCOLLECTION=&TRI=Serie&RESUMEONLY=no&serieorder=desc&editionorder=asc&datesortieorder=desc&changeorder=1&STITRE='+UrlEncode(BDName), 2);

      end else
      begin
         ShowMessage('Aucune références trouvées');
      end;
   end;
end;

procedure AnalyseBdPage(Address: string);

var
  Page: TStringList;
  LineNr: Integer;
  DateTest, Line, StartTag, EndTag, Url, Caption: string;
  NomSerie, Description, SubL1, SubL2, SubL3, SubL4: string;
  BeginPos, EndPos: Integer;
  
begin

   SetField(fieldUrl, Address);
    Line := GetPage(Address);

  if Pos('<TITLE>BdParadisio :', Line) > 0 then
  begin
  
    // Get Title
    StartTag := '<table cellpadding=2 cellspacing=4 width=500><tr><td><font size=5><b>';
    EndTag := '</b></font></td></tr></table>';
    BeginPos := Pos ( StartTag, Line );
    EndPos := Pos ( EndTag, Line );
    SetField(fieldOriginalTitle, Copy(Line, BeginPos+Length(StartTag), EndPos-BeginPos-Length(StartTag)));

    // Get data part of the page
    StartTag := '<table>';
    EndTag := '</table>';
    BeginPos := Pos ( StartTag, Line );
    EndPos := Pos ( EndTag, Line );
    SubL1 := Copy ( Line, BeginPos, EndPos-BeginPos-Length(StartTag) );

    // Get Picture
    StartTag := '<IMG src="';
    EndTag := '" ';
    BeginPos := Pos ( StartTag, SubL1 );
    Delete ( SubL1, 1, BeginPos+Length(StartTag));
    EndPos := Pos ( EndTag, SubL1 );
    SubL2 := Copy(SubL1, 1, EndPos-1);
    GetPicture(BaseURL + SubL2, False);

    // Get Série
    StartTag := 'GetSerie.cfm';
    BeginPos := Pos ( StartTag, Line );
    Delete ( Line, 1, BeginPos+Length(StartTag));
    StartTag := '">';
    EndTag := '</A>';
    BeginPos := Pos ( StartTag, Line );
    EndPos := Pos ( EndTag, Line );
    SubL2 := Copy ( Line, BeginPos+Length(StartTag), EndPos-BeginPos-Length(StartTag) );
    NomSerie := StringReplace(Trim(SubL2), chr(39) , '’'  );
    SetField ( fieldTranslatedTitle, NomSerie );
    Delete ( Line, 1, EndPos);

    // Tome #
    StartTag := '</A> - T.';
    BeginPos := Pos ( StartTag, Line );
    Delete ( Line, 1, BeginPos+Length(StartTag));
    EndTag := '</b>';
    EndPos := Pos ( EndTag, Line );
    SubL2 := Copy ( Line, 1, EndPos-1);
    SetField ( fieldBorrower, Trim(SubL2) );
    Delete ( Line, 1, EndPos);

    // Editeur
    StartTag := 'Edition :</b></td><td><b';
    BeginPos := Pos ( StartTag, Line );
    Delete ( Line, 1, BeginPos+Length(StartTag));
    EndTag := '</b>';
    EndPos := Pos ( EndTag, Line );
    SubL2 := Copy ( Line, 1, EndPos-1);
    SetField ( fieldCountry, Trim(SubL2) );
    Delete ( Line, 1, EndPos);
    
    // Collection
    if Pos ('<b>Collection :</b></td><td><b>', Line) > 0 then
    begin
    StartTag := 'Collection :</b></td><td><b';
    BeginPos := Pos ( StartTag, Line );
    Delete ( Line, 1, BeginPos+Length(StartTag));
    EndTag := '</b>';
    EndPos := Pos ( EndTag, Line );
    SubL2 := Copy ( Line, 1, EndPos-1);
    SetField ( fieldCategory, Trim(SubL2) );
    Delete ( Line, 1, EndPos);
    end

    // # Pages
    StartTag := '<b>Pages :</b></td><td><b';
    BeginPos := Pos ( StartTag, Line );
    Delete ( Line, 1, BeginPos+Length(StartTag));
    EndTag := ' pages ';
    EndPos := Pos ( EndTag, Line );
    SubL2 := Copy ( Line, 1, EndPos-1);
    SetField ( fieldLength, Trim(SubL2) );
    Delete ( Line, 1, EndPos);

    // Parution
    StartTag := 'Parution :</b></td><td><b';
    BeginPos := Pos ( StartTag, Line );
    Delete ( Line, 1, BeginPos+Length(StartTag));
    EndTag := '</b>';
    EndPos := Pos ( EndTag, Line );
    SubL2 := Copy ( Line, 1, EndPos-1);
    SubL2 := AnsiUpFirstLetter(Trim(SubL2));
    if Length(SubL2) > 0 then
    begin
    DateTest := copy (SubL2, Length(SubL2)-1, Length(SubL2));
    DateTest := copy (DateTest,1, Length(DateTest)-1);
    if DateTest = '0' then
    begin
    DateTest :=  copy (SubL2, 1, Length(SubL2)-2) + '20' + copy (SubL2, Length(SubL2)-1, Length(SubL2)) ;
    SetField(fieldActors, Trim(DateTest));
    end else
    begin
    DateTest :=  copy (SubL2, 1, Length(SubL2)-2) + '19' + copy (SubL2, Length(SubL2)-1, Length(SubL2)) ;
    SetField(fieldActors, Trim(DateTest));
    end;
    end;
    Delete ( Line, 1, EndPos);
    
    // Auteurs
    StartTag := '<b>Auteurs :';
    BeginPos := Pos ( StartTag, Line );
    Delete ( Line, 1, BeginPos+Length(StartTag)+3);
    EndTag := '</b><br>';
    EndPos := Pos ( EndTag, Line );
    SubL2 := Copy ( Line, 1, EndPos-3 );

    // Condition si le scénariste est aussi le dessinateur
    if Pos ('hspace=2><img src', SubL2) > 0 then
    begin
       // Get Scenariste & Dessinateur
       StartTag := '">';
       BeginPos := Pos ( StartTag, SubL2 );
       EndTag := '</A>';
       EndPos := Pos ( EndTag, SubL2 );
       SubL3 := Copy ( SubL2, BeginPos+Length(StartTag), EndPos-BeginPos-Length(StartTag) );
       SetField(fieldDirector, Trim(SubL3));
       SetField(fieldProducer, Trim(SubL3));
    end else
    begin
       // Get Scénariste
       StartTag := '">';
       BeginPos := Pos ( StartTag, SubL2 );
       EndTag := '</A>';
       EndPos := Pos ( EndTag, SubL2 );
       SubL3 := Copy ( SubL2, BeginPos+Length(StartTag), EndPos-BeginPos-Length(StartTag) );
       SetField(fieldDirector, Trim(SubL3));
       
       // Get Dessinateur
       Delete ( SubL2, 1, EndPos+Length(EndTag));
       StartTag := '">';
       BeginPos := Pos ( StartTag, SubL2 );
       EndTag := '</A>';
       EndPos := Pos ( EndTag, SubL2 );
       SubL3 := Copy ( SubL2, BeginPos+Length(StartTag), EndPos-BeginPos-Length(StartTag) );
       SetField(fieldProducer, Trim(SubL3));
    end;

     // Résumé
     StartTag := '<a href="CriticsAdd.cfm?Id=';
     BeginPos := Pos ( StartTag, Line );
     Delete ( Line, 1, BeginPos+Length(StartTag));
     StartTag := '<p>';
     Delete ( Line, 1, Pos ( StartTag, Line )+Length(StartTag));
     Delete ( Line, 1, Pos ( StartTag, Line )+Length(StartTag));
     SubL2 := DelFirstBlank ( Line );
     EndPos := Pos ( #10, SubL2 );
     SubL3 := Copy ( SubL2, 1, EndPos);
     HTMLRemoveTags(SubL3);
     Description := StringReplace(Trim(SubL3) , '’' , chr(39) );
     SetField(fieldDescription, Description);

end;
end;


begin
  if CheckVersion(3,4,1) then
  begin
    BDName := GetField(fieldOriginalTitle);
    if Input('BD Paradisio Import', 'Entrez le titre de la BD :', BDName) then
    begin
       // Look for Series
      GetReferences(BaseURL + 'scripts/albums.cfm?DateFrom=1/1/50&iEditeur=all&sCollection=&Tri=DateSortie&sTitre=&resumeOnly=yes&sSerie='+UrlEncode(BDName), 1);
    end;
  end else
    ShowMessage('Ce script requiert la version 3.4.1 ou supérieure de Ant Movie Catalog.');
end.

Post Reply