tout d'abord, bravo à antp pour ce programme fabuleux
moi aussi, je pense que la combinaison Mr Cinema + affiche cinefil est sans doute l'une des meilleures
je propose ici mes "modifications" (il y a dans le script original Mr Cinema une petite erreur de récupération du rating dans certains cas)
3 scripts
- Mr cinema: correction de ladite "erreur" + ajout du flag FullStory à positionner à True pour récupérer la description complète ou à False pour ne récupérer que le résumé (j'aime pas forcément connaitre la fin d'un film à suspense comme Psychose par exemple)
Code: Select all
// GETINFO SCRIPTING
// Monsieur Cinéma corrigé
(***************************************************
* Movie importation script for: *
* Monsieur Cinéma, http://www.monsieurcinema.com *
* *
* (c) 2002 Antoine Potten antoine@buypin.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 MonsieurCinema;
const
ImportPicture = True; // mettre ceci à True pour que l'image soit importée
FullStory = True; // mettre ceci à True pour importer [en savoir plus]
ExternalPictures = False;
{ True: Les images seront stockées en tant que fichiers dans le même dossier que le catalogue
False: Les images seront stockées dans le catalogue (seulement pour les fichiers .amc) }
var
MovieName: string;
//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;
Line: string;
BeginPos, EndPos: Integer;
begin
Line := GetPage(Address);
BeginPos := Pos('<table width="620" border="0" cellpadding="5" bgcolor="#ffffff" cellspacing="0">', Line);
if BeginPos > 0 then
begin
Delete(Line, 1, BeginPos-1);
if Pos('Accueil</a> > Recherche </td>', Line) > 0 then
begin
BeginPos := Pos('<b> Films</b>', Line);
if BeginPos > 0 then
begin
Delete(Line, 1, BeginPos);
BeginPos := Pos(' <A HREF', Line);
Delete(Line, 1, BeginPos - 1);
EndPos := Pos(#13#10 + '<br>', Line);
Delete(Line, EndPos, Length(Line));
PickTreeClear;
PickTreeAdd('Films:', '');
Page := TStringList.Create;
Page.Text := Line;
for LineNr := 0 to Page.Count-1 do
begin
Line := Page.GetString(LineNr);
BeginPos := Pos('/film/', Line);
EndPos := Pos('" TARGET', Line);
Address := Copy(Line, BeginPos, EndPos - BeginPos);
HTMLRemoveTags(Line);
HTMLDecode(Line);
PickTreeAdd(Line, 'http://www.monsieurcinema.tiscali.fr/commun' + Address);
end;
Page.Free;
if PickTreeExec(Address) then
AnalyzePage(Address);
end else
ShowMessage('Aucun film trouvé');
end else
begin
AnalyzeMoviePage(Line);
end;
end;
end;
procedure AnalyzeMoviePage(Fullpage: string);
var
Line, Value, Value2: string;
LineNr: Integer;
BeginPos, EndPos: Integer;
begin
BeginPos := Pos('<td><b>', Fullpage);
Delete(Fullpage, 1, BeginPos);
EndPos := Pos('</td>', Fullpage);
Line := Copy(Fullpage, 1, EndPos);
Delete(Fullpage, 1, EndPos);
// Original Title
BeginPos := Pos('<b>', Line);
EndPos := Pos('<br>', Line);
if (BeginPos > 0) and (EndPos > 0) then
begin
Value := Copy(Line, BeginPos + 3, EndPos - BeginPos - 3);
HTMLRemoveTags(Value);
BeginPos := Pos('(', Value);
EndPos := Pos(')', Value);
if (BeginPos > 0) and (EndPos > 0) then
begin
Value2 := Copy(Value, BeginPos + 1, EndPos - BeginPos - 1);
Delete(Value, BeginPos - 1, Length(Value));
end else
Value2 := '';
if Value2 <> '' then
begin
SetField(fieldOriginalTitle, Value2);
SetField(fieldTranslatedTitle, Value);
end else
SetField(fieldOriginalTitle, Value);
end;
// Director
BeginPos := Pos('de <a href', Line) + 3;
EndPos := Pos('</a>', Line);
Value := Copy(Line, BeginPos, EndPos - BeginPos);
HTMLRemoveTags(Value);
SetField(fieldDirector, Value);
Delete(Line, 1, EndPos);
// Year
BeginPos := Pos('(', Line) + 1;
EndPos := Pos(')', Line);
Value := Copy(Line, BeginPos, EndPos - BeginPos);
SetField(fieldYear, Value);
// Actors
BeginPos := Pos('avec <a href', Line) + 4;
Delete(Line, 1, BeginPos);
Value := '';
repeat
BeginPos := Pos('<a', Line);
EndPos := Pos('</a', Line);
if BeginPos > 0 then
begin
Value2 := Copy(Line, BeginPos, EndPos - BeginPos);
HTMLRemoveTags(Value2);
if Value2 <> '...' then
begin
if Value <> '' then
Value := Value + ',';
Value := Value + Value2;
end;
Delete(Line, 1, EndPos);
end;
until BeginPos = 0;
SetField(fieldActors, Value);
// Description
BeginPos := Pos('<td>', Fullpage);
EndPos := Pos('</td>', Fullpage);
Value := Copy(Fullpage, BeginPos, EndPos - BeginPos);
Delete(Fullpage, 1, EndPos);
EndPos := Pos('[<a href="histoire', Value);
if FullStory then
// description complète
begin;
if EndPos > 0 then
begin
BeginPos := EndPos + 10;
EndPos := Pos('">', Value);
Value := Copy(Value, BeginPos, EndPos - BeginPos);
Line := GetPage('http://www.monsieurcinema.tiscali.fr/commun/film/' + Value);
BeginPos := Pos('<table width="100%" border="0" cellspacing="0" cellpadding="4">', Line);
Delete(Line, 1, BeginPos);
BeginPos := Pos('<p>', Line);
Delete(Line, 1, BeginPos + 2);
EndPos := Pos('</td>', Line);
Value := Copy(Line, 1, EndPos - 1);
end;
end else
// description simplifiée (peut être tronquée)
begin;
Value := Copy(Value,1,EndPos -1);
end;
HTMLRemoveTags(Value);
SetField(fieldDescription, Trim(Value));
// Comments & Rating
BeginPos := Pos('<b>L''avis de la rédaction', Fullpage);
EndPos := Pos('<b> L''avis des spectateurs', FullPage);
if (BeginPos > 0) and (EndPos > 0) then
begin
Line := Copy(Fullpage, BeginPos, EndPos - BeginPos);
EndPos := Pos('redac.gif', Line);
Value := Copy(Line, EndPos-1, 1);
SetField(fieldRating, IntToStr(StrToInt(Value, 0) * 2));
BeginPos := Pos('<tr valign="top">', Line);
Delete(Line, 1, BeginPos);
BeginPos := Pos('<td', Line);
EndPos := Pos('[<a class="important" href="redaction', Line);
if (EndPos = 0) then EndPos := Pos('</td>', Line);
Value := Copy(Line, BeginPos, EndPos - BeginPos);
HTMLRemovetags(Value);
SetField(fieldComments, Trim(Value));
end;
// Picture
BeginPos := Pos('<table width="205" border="0" cellspacing="0" cellpadding="0">', Fullpage);
EndPos := Pos('<table width="205" border="0" cellspacing="0" cellpadding="0" bgcolor="#eeeeee">', Fullpage);
Line := Copy(Fullpage, BeginPos, EndPos - BeginPos);
Delete(Fullpage, 1, EndPos);
if ImportPicture then
begin
BeginPos := Pos('src="', Line) + 5;
EndPos := Pos('" width', Line);
Value := Copy(Line, BeginPos, EndPos - BeginPos);
GetPicture(Value, False);
end;
//
EndPos := Pos('<table width="200" border="0" cellspacing="0" cellpadding="0" align="center">', Fullpage);
Line := Copy(Fullpage, 1, EndPos);
EndPos := Pos('</table>', Line);
Delete(Line, EndPos, Length(Line));
// Category
BeginPos := Pos('<b>Genre</b>', Line) + 11;
if BeginPos > 11 then
begin
Delete(Line, 1, BeginPos);
EndPos := Pos('</tr>', Line);
Value := Copy(Line, 1, EndPos);
HTMLRemoveTags(Value);
SetField(fieldCategory, Value);
end;
// Length
BeginPos := Pos('<b>Durée</b>', Line) + 18;
if BeginPos > 18 then
begin
Delete(Line, 1, BeginPos);
EndPos := Pos('</tr>', Line);
Value := Copy(Line, 1, EndPos);
HTMLRemoveTags(Value);
Value := IntToStr(StrToInt(Copy(Value, 1, 2), 0) * 60 + StrToInt(Copy(Value, 4, 2), 0));
SetField(fieldLength, Value);
end;
// Country
BeginPos := Pos('<b>Pays</b>', Line) + 10;
if BeginPos > 10 then
begin
Delete(Line, 1, BeginPos);
EndPos := Pos('</tr>', Line);
Value := Copy(Line, 1, EndPos);
HTMLRemoveTags(Value);
SetField(fieldCountry, Value);
end;
end;
begin
if CheckVersion(3,4,0) then
begin
MovieName := GetField(fieldOriginalTitle);
if MovieName = '' then
MovieName := GetField(fieldTranslatedTitle);
if Input('MonsieurCinéma.com Import', 'Entrez le titre du film :', MovieName) then
begin
AnalyzePage('http://www.monsieurcinema.tiscali.fr/commun/recherche/?search='+UrlEncode(MovieName));
DisplayResults;
end;
end else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.0)');
end.
- cinefil affiche seule
Code: Select all
// GETINFO SCRIPTING
// Cinefil (FR) import grande Image seule
(***************************************************
* Script d'importation de film pour : *
* Cinéfil.com , http://www.cinefil.com *
* *
* (c) 2003 Danone-KiD *
* *
* A utiliser avec Ant Movie Catalog 3.4.2 *
* 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 cinefil;
var
MovieName: string;
procedure AnalyzePage2(Address: string);
var
Page: TStringList;
LineNr: Integer;
Line,page_film,titre_film, realisateur_film, annee_film: string;
BeginPos, EndPos: Integer;
begin
//vide la liste des films
PickTreeClear;
//charge la page
Line := GetPage(Address);
//teste si il y a des films trouvés
BeginPos := Pos('Aucun film trouvé', Line);
if BeginPos <> 0 then
begin
showmessage('Aucun film trouvé !');
exit;
end;
//teste si il n'y a pas qu'un seul film
BeginPos := Pos('FILMS TROUVÉS', Line);
if BeginPos = 0 then
begin
AnalysePageFilm2(Address);
exit;
end;
//supprime tout le code avant la liste des films
BeginPos := Pos('<B>ANNÉE</B>', Line);
Delete(Line, 1, BeginPos-1);
repeat
//cherche le lien de la page du film
BeginPos := Pos('HREF=''FicheFilm.cfm?ref=',Line);
Delete(Line, 1, BeginPos+5);
EndPos := Pos(' ',Line);
page_film := 'http://www.cinefil.com/newsiteweb/' + Copy(Line, 1, EndPos-2 );
//cherche le nom du film
BeginPos := Pos('TITLE=''Fiche Film Cinéfil''>',Line);
Delete(Line, 1, BeginPos+26);
EndPos := Pos('</a>',Line)-1;
titre_film := Copy(Line, 1, EndPos );
HTMLdecode(titre_film);
HTMLremovetags(titre_film);
titre_film := StringReplace(titre_film, #13#10, '');
titre_film := StringReplace(titre_film, ' ', '');
titre_film := Trim(titre_film);
titre_film := AnsiLowerCase(titre_film);
titre_film := AnsiUpFirstLetter(titre_film);
//cherche le réalisateur
BeginPos := Pos('size=2>',Line);
Delete(Line, 1, BeginPos+6);
EndPos := Pos('</TD><TD',Line)-1;
realisateur_film := Copy(Line, 1, EndPos );
HTMLdecode(realisateur_film);
HTMLremovetags(realisateur_film);
realisateur_film := StringReplace(realisateur_film, #13#10, '');
realisateur_film := StringReplace(realisateur_film, ' ', '');
realisateur_film := Trim(realisateur_film);
realisateur_film := AnsiLowerCase(realisateur_film);
realisateur_film := AnsiUpFirstLetter(realisateur_film);
//cherche l'année
BeginPos := Pos('size=2>',Line);
Delete(Line, 1, BeginPos+6);
EndPos := Pos('</TD>',Line)-1;
annee_film := Copy(Line, 1, EndPos );
HTMLdecode(annee_film);
HTMLremovetags(annee_film);
annee_film := StringReplace(annee_film, #13#10, '');
annee_film := StringReplace(annee_film, ' ', '');
annee_film := Trim(annee_film);
//ajoute les films
PickTreeAdd(titre_film + ' (' + realisateur_film + '), '+ annee_film , page_film);
//cherche le lien de la page du film
BeginPos := Pos('HREF=''FicheFilm.cfm?ref=',Line);
until BeginPos = 0;
begin
if PickTreeExec(Address)=true then
AnalysePageFilm2(Address);
end;
end;
//------------------------------------------------------------------------------
// ANALYSE DE LA PAGE DU FILM
//------------------------------------------------------------------------------
procedure AnalysePageFilm2(Address: string);
var
Line,page_film,titre_film,titre_original, categorie_film, realisateur_film, annee_film: string;
pays_film, duree_film, acteurs_film, liste_acteurs, description_film, reference_film,fichier_image:string;
BeginPos, EndPos: Integer;
begin
//charge la page
Line := GetPage(Address);
//chargement des jaquettes
//on teste si il y a un grang format
BeginPos := Pos('<A HREF="AfficheGF.cfm?ref=', Line);
if BeginPos <> 0 then
begin
Delete(Line, 1, BeginPos+26);
EndPos := Pos('" target="_blank" TITLE="ZOOM">',Line)-1;
fichier_image := 'http://www.cinefil.com/ImagesCinefil/AfficheGrandFormat/a' + Copy(Line, 1, EndPos )+'.jpeg';
GetPicture(fichier_image, false);
end;
if BeginPos = 0 then
begin
//sinon on teste si il y a un petit format
BeginPos := Pos('AffichePetitFormat/', Line);
if BeginPos <> 0 then
Begin
Delete(Line,1, BeginPos +18);
EndPos := Pos(' border=1 ALIGN=left hspace=10 >',Line)-1;
fichier_image := 'http://www.cinefil.com/ImagesCinefil/AffichePetitFormat/' + Copy(Line, 1, EndPos );
GetPicture(fichier_image, false);
end;
end;
DisplayResults;
end;
begin
if CheckVersion(3,4,0) then
begin
MovieName := GetField(fieldOriginalTitle);
if MovieName = '' then
MovieName := GetField(fieldTranslatedTitle);
if Input('cinefil.com Import image', 'Entrez le titre du film :', MovieName) then
begin
//remplace les caractères accentués
MovieName:= AnsiLowerCase(MovieName);
MovieName:= StringReplace(MovieName, 'é', 'e');
MovieName:= StringReplace(MovieName, 'è', 'e');
MovieName:= StringReplace(MovieName, 'à', 'a');
MovieName:= StringReplace(MovieName, 'ç', 'c');
MovieName:= StringReplace(MovieName, 'ù', 'u');
MovieName := 'http://www.cinefil.com/newsiteweb/ListeFilms.cfm?titre='+ UrlEncode(MovieName);
AnalyzePage2(MovieName);
end;
end else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.0)');
end.
- et le combo Mr Cinema + affiche cinefil
Code: Select all
// GETINFO SCRIPTING
// Monsieur Cinéma + affiche cinefil
(***************************************************
* Movie importation script for: *
* Monsieur Cinéma, http://www.monsieurcinema.com *
* *
* (c) 2002 Antoine Potten antoine@buypin.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 MonsieurCinema;
const
ImportPicture = True; // mettre ceci à True pour que l'image soit importée
FullStory = True; // mettre ceci à True pour importer [en savoir plus]
ExternalPictures = False;
{ True: Les images seront stockées en tant que fichiers dans le même dossier que le catalogue
False: Les images seront stockées dans le catalogue (seulement pour les fichiers .amc) }
var
MovieName: string;
procedure AnalyzePage(Address: string);
var
Page: TStringList;
LineNr: Integer;
Line: string;
BeginPos, EndPos: Integer;
begin
Line := GetPage(Address);
BeginPos := Pos('<table width="620" border="0" cellpadding="5" bgcolor="#ffffff" cellspacing="0">', Line);
if BeginPos > 0 then
begin
Delete(Line, 1, BeginPos-1);
if Pos('Accueil</a> > Recherche </td>', Line) > 0 then
begin
BeginPos := Pos('<b> Films</b>', Line);
if BeginPos > 0 then
begin
Delete(Line, 1, BeginPos);
BeginPos := Pos(' <A HREF', Line);
Delete(Line, 1, BeginPos - 1);
EndPos := Pos(#13#10 + '<br>', Line);
Delete(Line, EndPos, Length(Line));
PickTreeClear;
PickTreeAdd('Films:', '');
Page := TStringList.Create;
Page.Text := Line;
for LineNr := 0 to Page.Count-1 do
begin
Line := Page.GetString(LineNr);
BeginPos := Pos('/film/', Line);
EndPos := Pos('" TARGET', Line);
Address := Copy(Line, BeginPos, EndPos - BeginPos);
HTMLRemoveTags(Line);
HTMLDecode(Line);
PickTreeAdd(Line, 'http://www.monsieurcinema.tiscali.fr/commun' + Address);
end;
Page.Free;
if PickTreeExec(Address) then
AnalyzePage(Address);
end else
ShowMessage('Aucun film trouvé');
end else
begin
AnalyzeMoviePage(Line);
end;
end;
end;
procedure AnalyzeMoviePage(Fullpage: string);
var
Line, Value, Value2: string;
LineNr: Integer;
BeginPos, EndPos: Integer;
begin
BeginPos := Pos('<td><b>', Fullpage);
Delete(Fullpage, 1, BeginPos);
EndPos := Pos('</td>', Fullpage);
Line := Copy(Fullpage, 1, EndPos);
Delete(Fullpage, 1, EndPos);
// Original Title
BeginPos := Pos('<b>', Line);
EndPos := Pos('<br>', Line);
if (BeginPos > 0) and (EndPos > 0) then
begin
Value := Copy(Line, BeginPos + 3, EndPos - BeginPos - 3);
HTMLRemoveTags(Value);
BeginPos := Pos('(', Value);
EndPos := Pos(')', Value);
if (BeginPos > 0) and (EndPos > 0) then
begin
Value2 := Copy(Value, BeginPos + 1, EndPos - BeginPos - 1);
Delete(Value, BeginPos - 1, Length(Value));
end else
Value2 := '';
if Value2 <> '' then
begin
SetField(fieldOriginalTitle, Value2);
SetField(fieldTranslatedTitle, Value);
end else
SetField(fieldOriginalTitle, Value);
end;
// Director
BeginPos := Pos('de <a href', Line) + 3;
EndPos := Pos('</a>', Line);
Value := Copy(Line, BeginPos, EndPos - BeginPos);
HTMLRemoveTags(Value);
SetField(fieldDirector, Value);
Delete(Line, 1, EndPos);
// Year
BeginPos := Pos('(', Line) + 1;
EndPos := Pos(')', Line);
Value := Copy(Line, BeginPos, EndPos - BeginPos);
SetField(fieldYear, Value);
// Actors
BeginPos := Pos('avec <a href', Line) + 4;
Delete(Line, 1, BeginPos);
Value := '';
repeat
BeginPos := Pos('<a', Line);
EndPos := Pos('</a', Line);
if BeginPos > 0 then
begin
Value2 := Copy(Line, BeginPos, EndPos - BeginPos);
HTMLRemoveTags(Value2);
if Value2 <> '...' then
begin
if Value <> '' then
Value := Value + ',';
Value := Value + Value2;
end;
Delete(Line, 1, EndPos);
end;
until BeginPos = 0;
SetField(fieldActors, Value);
// Description
BeginPos := Pos('<td>', Fullpage);
EndPos := Pos('</td>', Fullpage);
Value := Copy(Fullpage, BeginPos, EndPos - BeginPos);
Delete(Fullpage, 1, EndPos);
EndPos := Pos('[<a href="histoire', Value);
if FullStory then
// description complète
begin;
if EndPos > 0 then
begin
BeginPos := EndPos + 10;
EndPos := Pos('">', Value);
Value := Copy(Value, BeginPos, EndPos - BeginPos);
Line := GetPage('http://www.monsieurcinema.tiscali.fr/commun/film/' + Value);
BeginPos := Pos('<table width="100%" border="0" cellspacing="0" cellpadding="4">', Line);
Delete(Line, 1, BeginPos);
BeginPos := Pos('<p>', Line);
Delete(Line, 1, BeginPos + 2);
EndPos := Pos('</td>', Line);
Value := Copy(Line, 1, EndPos - 1);
end;
end else
// description simplifiée (peut être tronquée)
begin;
Value := Copy(Value,1,EndPos -1);
end;
HTMLRemoveTags(Value);
SetField(fieldDescription, Trim(Value));
// Comments & Rating
BeginPos := Pos('<b>L''avis de la rédaction', Fullpage);
EndPos := Pos('<b> L''avis des spectateurs', FullPage);
if (BeginPos > 0) and (EndPos > 0) then
begin
Line := Copy(Fullpage, BeginPos, EndPos - BeginPos);
EndPos := Pos('redac.gif', Line);
Value := Copy(Line, EndPos-1, 1);
SetField(fieldRating, IntToStr(StrToInt(Value, 0) * 2));
BeginPos := Pos('<tr valign="top">', Line);
Delete(Line, 1, BeginPos);
BeginPos := Pos('<td', Line);
EndPos := Pos('[<a class="important" href="redaction', Line);
if (EndPos = 0) then EndPos := Pos('</td>', Line);
Value := Copy(Line, BeginPos, EndPos - BeginPos);
HTMLRemovetags(Value);
SetField(fieldComments, Trim(Value));
end;
// Picture
BeginPos := Pos('<table width="205" border="0" cellspacing="0" cellpadding="0">', Fullpage);
EndPos := Pos('<table width="205" border="0" cellspacing="0" cellpadding="0" bgcolor="#eeeeee">', Fullpage);
Line := Copy(Fullpage, BeginPos, EndPos - BeginPos);
Delete(Fullpage, 1, EndPos);
if ImportPicture then
begin
BeginPos := Pos('src="', Line) + 5;
EndPos := Pos('" width', Line);
Value := Copy(Line, BeginPos, EndPos - BeginPos);
GetPicture(Value, False);
end;
//
EndPos := Pos('<table width="200" border="0" cellspacing="0" cellpadding="0" align="center">', Fullpage);
Line := Copy(Fullpage, 1, EndPos);
EndPos := Pos('</table>', Line);
Delete(Line, EndPos, Length(Line));
// Category
BeginPos := Pos('<b>Genre</b>', Line) + 11;
if BeginPos > 11 then
begin
Delete(Line, 1, BeginPos);
EndPos := Pos('</tr>', Line);
Value := Copy(Line, 1, EndPos);
HTMLRemoveTags(Value);
SetField(fieldCategory, Value);
end;
// Length
BeginPos := Pos('<b>Durée</b>', Line) + 18;
if BeginPos > 18 then
begin
Delete(Line, 1, BeginPos);
EndPos := Pos('</tr>', Line);
Value := Copy(Line, 1, EndPos);
HTMLRemoveTags(Value);
Value := IntToStr(StrToInt(Copy(Value, 1, 2), 0) * 60 + StrToInt(Copy(Value, 4, 2), 0));
SetField(fieldLength, Value);
end;
// Country
BeginPos := Pos('<b>Pays</b>', Line) + 10;
if BeginPos > 10 then
begin
Delete(Line, 1, BeginPos);
EndPos := Pos('</tr>', Line);
Value := Copy(Line, 1, EndPos);
HTMLRemoveTags(Value);
SetField(fieldCountry, Value);
end;
end;
procedure AnalyzePage2(Address: string);
var
Page: TStringList;
LineNr: Integer;
Line,page_film,titre_film, realisateur_film, annee_film: string;
BeginPos, EndPos: Integer;
begin
//vide la liste des films
PickTreeClear;
//charge la page
Line := GetPage(Address);
//teste si il y a des films trouvés
BeginPos := Pos('Aucun film trouvé', Line);
if BeginPos <> 0 then
begin
showmessage('Aucun film trouvé !');
exit;
end;
//teste si il n'y a pas qu'un seul film
BeginPos := Pos('FILMS TROUVÉS', Line);
if BeginPos = 0 then
begin
AnalysePageFilm2(Address);
exit;
end;
//supprime tout le code avant la liste des films
BeginPos := Pos('<B>ANNÉE</B>', Line);
Delete(Line, 1, BeginPos-1);
repeat
//cherche le lien de la page du film
BeginPos := Pos('HREF=''FicheFilm.cfm?ref=',Line);
Delete(Line, 1, BeginPos+5);
EndPos := Pos(' ',Line);
page_film := 'http://www.cinefil.com/newsiteweb/' + Copy(Line, 1, EndPos-2 );
//cherche le nom du film
BeginPos := Pos('TITLE=''Fiche Film Cinéfil''>',Line);
Delete(Line, 1, BeginPos+26);
EndPos := Pos('</a>',Line)-1;
titre_film := Copy(Line, 1, EndPos );
HTMLdecode(titre_film);
HTMLremovetags(titre_film);
titre_film := StringReplace(titre_film, #13#10, '');
titre_film := StringReplace(titre_film, ' ', '');
titre_film := Trim(titre_film);
titre_film := AnsiLowerCase(titre_film);
titre_film := AnsiUpFirstLetter(titre_film);
//cherche le réalisateur
BeginPos := Pos('size=2>',Line);
Delete(Line, 1, BeginPos+6);
EndPos := Pos('</TD><TD',Line)-1;
realisateur_film := Copy(Line, 1, EndPos );
HTMLdecode(realisateur_film);
HTMLremovetags(realisateur_film);
realisateur_film := StringReplace(realisateur_film, #13#10, '');
realisateur_film := StringReplace(realisateur_film, ' ', '');
realisateur_film := Trim(realisateur_film);
realisateur_film := AnsiLowerCase(realisateur_film);
realisateur_film := AnsiUpFirstLetter(realisateur_film);
//cherche l'année
BeginPos := Pos('size=2>',Line);
Delete(Line, 1, BeginPos+6);
EndPos := Pos('</TD>',Line)-1;
annee_film := Copy(Line, 1, EndPos );
HTMLdecode(annee_film);
HTMLremovetags(annee_film);
annee_film := StringReplace(annee_film, #13#10, '');
annee_film := StringReplace(annee_film, ' ', '');
annee_film := Trim(annee_film);
//ajoute les films
PickTreeAdd(titre_film + ' (' + realisateur_film + '), '+ annee_film , page_film);
//cherche le lien de la page du film
BeginPos := Pos('HREF=''FicheFilm.cfm?ref=',Line);
until BeginPos = 0;
begin
if PickTreeExec(Address)=true then
AnalysePageFilm2(Address);
end;
end;
//------------------------------------------------------------------------------
// ANALYSE DE LA PAGE DU FILM
//------------------------------------------------------------------------------
procedure AnalysePageFilm2(Address: string);
var
Line,page_film,titre_film,titre_original, categorie_film, realisateur_film, annee_film: string;
pays_film, duree_film, acteurs_film, liste_acteurs, description_film, reference_film,fichier_image:string;
BeginPos, EndPos: Integer;
begin
//charge la page
Line := GetPage(Address);
//chargement des jaquettes
//on teste si il y a un grang format
BeginPos := Pos('<A HREF="AfficheGF.cfm?ref=', Line);
if BeginPos <> 0 then
begin
Delete(Line, 1, BeginPos+26);
EndPos := Pos('" target="_blank" TITLE="ZOOM">',Line)-1;
fichier_image := 'http://www.cinefil.com/ImagesCinefil/AfficheGrandFormat/a' + Copy(Line, 1, EndPos )+'.jpeg';
GetPicture(fichier_image, false);
end;
if BeginPos = 0 then
begin
//sinon on teste si il y a un petit format
BeginPos := Pos('AffichePetitFormat/', Line);
if BeginPos <> 0 then
Begin
Delete(Line,1, BeginPos +18);
EndPos := Pos(' border=1 ALIGN=left hspace=10 >',Line)-1;
fichier_image := 'http://www.cinefil.com/ImagesCinefil/AffichePetitFormat/' + Copy(Line, 1, EndPos );
GetPicture(fichier_image, false);
end;
end;
DisplayResults;
end;
begin
if CheckVersion(3,4,0) then
begin
MovieName := GetField(fieldOriginalTitle);
if MovieName = '' then
MovieName := GetField(fieldTranslatedTitle);
if Input('MonsieurCinéma.com Import', 'Entrez le titre du film :', MovieName) then
begin
// Mr cinéma
AnalyzePage('http://www.monsieurcinema.tiscali.fr/commun/recherche/?search='+UrlEncode(MovieName));
// cinefil : préfére les titres en français
MovieName := GetField(fieldTranslatedTitle);
if MovieName = '' then
MovieName := GetField(fieldOriginalTitle);
if Input('Cinéfil.com Import', 'Entrez le titre du film :', MovieName) then
begin
//remplace les caractères accentués
MovieName:= AnsiLowerCase(MovieName);
MovieName:= StringReplace(MovieName, 'é', 'e');
MovieName:= StringReplace(MovieName, 'è', 'e');
MovieName:= StringReplace(MovieName, 'à', 'a');
MovieName:= StringReplace(MovieName, 'ç', 'c');
MovieName:= StringReplace(MovieName, 'ù', 'u');
AnalyzePage2('http://www.cinefil.com/newsiteweb/ListeFilms.cfm?titre='+ UrlEncode(MovieName));
end;
DisplayResults;
end;
end else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.0)');
end.
voila, j'espère que ça t'ira