
Et je suis en train d'en refaire un pour la version 3.5
Code: Select all
program CineSnap_SEARCH;
var
MovieName, NomFilm, Adresse, Parametre, Reponse : string;
premiereExecution : Integer;
//------------------------------------------------------------------------------
// MET LE TITRE AU BON FORMAT
//------------------------------------------------------------------------------
function formatTitre(titre : String; option : Integer) : string;
begin
if (option = 0) then
begin
titre := AnsiLowerCase(titre);
end else if (option = 1) then
begin
titre := AnsiUpperCase(titre);
end else if (option = 2) then
begin
titre := AnsiUpFirstLetter(titre);
end else if (option = 3) then
begin
titre := AnsiMixedCase(titre,' -');
end;
result := titre;
end;
//------------------------------------------------------------------------------
// ANALYSE DE LA PAGE DES FILMS
//------------------------------------------------------------------------------
procedure AnalyzePage(Address, Params: string);
var
Line, aucun_film,page_film,titre_film, la_page : string;
BeginPos, EndPos, compteur: Integer;
begin
//vide la liste des films
PickTreeClear;
//charge la page
Address := URLEncode(Address);
Params := URLEncode(Params);
Line := PostPage(Address,Params);
aucun_film := Line;
//introduction résultats
titre_film := MovieName;
titre_film := AnsiUpFirstLetter(titre_film);
PickTreeAdd('Trouvé : ' + titre_film, '');
//compte les résultats
compteur := 0;
BeginPos := Pos('<td width=65><a href="detail_film.php?num=', Line);
//Delete(Line, 1, BeginPos+Length('td width=65>'));
//cherche le lien de la page du film
//BeginPos := Pos('<a href=', Line);
repeat
Delete(Line, 1, BeginPos+Length('td width=65>'));
//cherche le lien de la page du film
BeginPos := Pos('<a href=', Line);
Delete(Line, 1, BeginPos+Length('<a href='));
EndPos := Pos('>', Line);
page_film := 'http://www.cinesnap.com/' + Copy(Line, 1, EndPos-2);
page_film := URLEncode(page_film);
//cherche le nom du film
BeginPos := Pos('<td><a href="'+Copy(Line, 1, EndPos-2)+'"><b>',Line);
Delete(Line, 1, BeginPos+Length('<td><a href="'+Copy(Line, 1, EndPos-2)+'"><b'));
EndPos := Pos('</b></a></td>',Line);
titre_film := Copy(Line, 0, EndPos );
HTMLdecode(titre_film);
HTMLremovetags(titre_film);
titre_film := Trim(titre_film);
titre_film := AnsiLowerCase(titre_film);
titre_film := AnsiUpFirstLetter(titre_film);
if titre_film <> '' then
begin
//ajoute les films
PickTreeAdd(titre_film , page_film);
la_page := page_film;
compteur := compteur+1;
end;
//cherche le lien de la page du film
BeginPos := Pos('<td width=65><a href="detail_film.php?num=', Line);
until BeginPos = 0;
if compteur = 1 then
begin
AnalysePageFilm(la_page);
exit;
end;
if PickTreeExec(Address) then
AnalysePageFilm(Address);
end;
//------------------------------------------------------------------------------
// ANALYSE DE LA PAGE DU FILM
//------------------------------------------------------------------------------
procedure AnalysePageFilm(Address: string);
var
Line,tempval,tmp,tmp2 : string;
BeginPos, EndPos: Integer;
begin
//charge la page
Address := URLEncode(Address);
Line := GetPage(Address);
//cherche les erreurs
tmp:='width=22 height=13>';
BeginPos := Pos(tmp, Line);
if BeginPos <> 0 then
begin
//url
SetField(fieldURL,Address);
Delete(Line, 1, BeginPos+Length(tmp)-1);
EndPos := Pos('</td>', Line);
tempval := copy(Line,0,EndPos-1);
HTMLdecode(tempval);
HTMLremovetags(tempval);
EndPos := Pos('(', tempval);
tmp:=copy(tempval,0,EndPos-1);
//titre
tmp := Trim(tmp);
tmp := AnsiLowerCase(tmp);
tmp := AnsiUpFirstLetter(tmp);
SetField(fieldOriginalTitle,tmp);
SetField(fieldTranslatedTitle,tmp);
//date
BeginPos:= Pos('(', tempval);
EndPos := Pos(')', tempval);
tmp:=copy(tempval,BeginPos+1,EndPos);
tmp:=copy(tmp,1,4);
tmp := Trim(tmp);
SetField(fieldYear,tmp)
//photo
tmp:='<td width=126 height=173 valign="top"><img src="';
BeginPos := Pos(tmp, Line);
Delete(Line, 1, BeginPos+Length(tmp)-1);
EndPos := Pos('" width=126 height=173', Line);
tempval := copy(Line,0,EndPos-1);
HTMLdecode(tempval);
HTMLremovetags(tempval);
GetPicture(tempval);
//acteurs
tmp:='<a href="detail_acteur.php?num=';
BeginPos := Pos(tmp, Line);
Delete(Line, 1, BeginPos+Length(tmp)-1);
BeginPos := Pos('>', Line);
Delete(Line, 1, BeginPos);
EndPos := Pos('</span></td>', Line);
tempval := copy(Line,0,EndPos-1);
HTMLdecode(tempval);
HTMLremovetags(tempval);
tempval := Trim(tempval);
SetField(fieldActors, tempval);
//Réalisateur
tmp:='<a href="detail_realisateur.php?num=';
BeginPos := Pos(tmp, Line);
Delete(Line, 1, BeginPos+Length(tmp)-1);
BeginPos := Pos('>', Line);
Delete(Line, 1, BeginPos);
EndPos := Pos('.</span></td>', Line);
tempval := copy(Line,0,EndPos-1);
HTMLdecode(tempval);
HTMLremovetags(tempval);
tempval := Trim(tempval);
SetField(fieldDirector, tempval);
//durée
tmp:='</b></font><font class="txt_10_noir">';
BeginPos := Pos(tmp, Line);
Delete(Line, 1, BeginPos+Length(tmp)-1);
EndPos := Pos('minutes</font></td>', Line);
tempval := copy(Line,0,EndPos-1);
HTMLdecode(tempval);
HTMLremovetags(tempval);
tempval := Trim(tempval);
SetField(fieldLength, tempval);
//synopsis
tmp:='<td class="synopsis">';
BeginPos := Pos(tmp, Line);
Delete(Line, 1, BeginPos+Length(tmp)-1);
EndPos := Pos('</td>', Line);
tempval := copy(Line,0,EndPos-1);
HTMLdecode(tempval);
HTMLremovetags(tempval);
tempval := Trim(tempval);
SetField(fieldDescription, tempval);
//audio langue
tmp:='width=40 class=text_tableau_son>';
tmp2:='';
BeginPos := Pos(tmp, Line);
repeat
Delete(Line, 1, BeginPos+Length(tmp)-1);
EndPos := Pos('</td>', Line);
tempval := copy(Line,0,EndPos-1);
HTMLdecode(tempval);
HTMLremovetags(tempval);
tempval := Trim(tempval);
tmp2:=tmp2+tempval+',';
BeginPos := Pos(tmp, Line);
until BeginPos = 0;
SetField(fieldLanguages, copy(tmp2,0,Length(tmp2)-1));
//format image
tmp:='<font class=''txt_11_noir''>';
BeginPos := Pos(tmp, Line);
Delete(Line, 1, BeginPos+Length(tmp)-1);
EndPos := Pos('</font></td>', Line);
tempval := copy(Line,0,EndPos-1);
HTMLdecode(tempval);
HTMLremovetags(tempval);
tempval := Trim(tempval);
SetField(fieldResolution, tempval);
//bonus
tmp:='<font class=''txt_11_noir''>';
BeginPos := Pos(tmp, Line);
Delete(Line, 1, BeginPos+Length(tmp)-1);
EndPos := Pos('</font></td>', Line);
tempval := copy(Line,0,EndPos-1);
HTMLdecode(tempval);
HTMLremovetags(tempval);
tempval := Trim(tempval);
SetField(fieldComments, tempval);
end;
end;
//------------------------------------------------------------------------------
// PROCEDURE DE DEBUG AVEC ECRITURE DANS UN FICHIER
//------------------------------------------------------------------------------
procedure debug (la_ligne : String);
var
Page: TStringList;
LineNr: Integer;
fichier: string;
begin
fichier := 'c:\DEBUG.HTM';
Page := TStringList.Create;
Page.Text := la_ligne;
Page.SaveToFile(fichier);
end;
//------------------------------------------------------------------------------
// NETTOIE LE TITRE DU FICHIER POUR AVOIR LE TITRE DE FILM
//------------------------------------------------------------------------------
function cleanTitle(title : String) : string;
var
i,j, fin : Integer;
temp : String;
begin
title := AnsiUpperCase(title);
if title <> '' then
begin
// Nettoie les tags fichiers, merci Atmosfear pour les tags
i:=pos('.DVD',title);
if i <> 0 then
begin
title := copy(title,1,i-1);
end;
i:=pos('.DIVX',title);
if i <> 0 then
begin
title := copy(title,1,i-1);
end;
i:=pos('.FREN',title);
if i <> 0 then
begin
title := copy(title,1,i-1);
end;
i:=pos('.GERM',title);
if i <> 0 then
begin
title := copy(title,1,i-1);
end;
i:=pos('.INT',title);
if i <> 0 then
begin
title := copy(title,1,i-1);
end;
i:=pos('.LIM',title);
if i <> 0 then
begin
title := copy(title,1,i-1);
end;
i:=pos('.PROP',title);
if i <> 0 then
begin
title := copy(title,1,i-1);
end;
i:=pos('.REPACK',title);
if i <> 0 then
begin
title := copy(title,1,i-1);
end;
i:=pos('.SUBB',title);
if i <> 0 then
begin
title := copy(title,1,i-1);
end;
i:=pos('.UNSUB',title);
if i <> 0 then
begin
title := copy(title,1,i-1);
end;
i:=pos('.WS',title);
if i <> 0 then
begin
title := copy(title,1,i-1);
end;
i:=pos('.XVID',title);
if i <> 0 then
begin
title := copy(title,1,i-1);
end;
i:=pos('.AC3',title);
if i <> 0 then
begin
title := copy(title,1,i-1);
end;
i:=pos('.UNRAT',title);
if i <> 0 then
begin
title := copy(title,1,i-1);
end;
title := StringReplace(title, '.', ' ');
title := StringReplace(title, ',', ' ');
title := StringReplace(title, ':', '');
title := StringReplace(title, '-', '');
title := StringReplace(title, ' ', ' ');
i := 0;
// Nettoie les tags de team
if (pos('(',title) <> 0) then
begin
i := pos('(',title);
temp := copy(title,0,i-1);
j := pos(')',title);
fin := Length(title);
title := temp + copy(title,j+1,fin);
end;
if (pos('[',title) <> 0) then
begin
i := pos('[',title);
temp := copy(title,1,i-1);
j := pos(']',title);
fin := Length(title);
title := temp + copy(title,j+1,fin);
end;
title := AnsiLowerCase(title);
title := AnsiUpFirstLetter(title);
title := AnsiMixedCase(title,' -');
end;
result := title;
end;
//------------------------------------------------------------------------------
// PROGRAMME PRINCIPAL
//------------------------------------------------------------------------------
begin
if CheckVersion(3,5,0) then
begin
MovieName := GetField(fieldTranslatedTitle);
if MovieName = '' then
MovieName := GetField(fieldOriginalTitle);
MovieName := cleanTitle(MovieName);
if Input('cinesnap par iDo', 'Entrez le titre du film :', MovieName) then
begin
//remplace les caractères accentués
NomFilm := MovieName;
NomFilm := AnsiLowerCase(NomFilm);
NomFilm := StringReplace(NomFilm, 'é', 'e');
NomFilm := StringReplace(NomFilm, 'è', 'e');
NomFilm := StringReplace(NomFilm, 'à', 'a');
NomFilm := StringReplace(NomFilm, 'ç', 'c');
NomFilm := StringReplace(NomFilm, 'ù', 'u');
Adresse := URLEncode('http://www.cinesnap.com/recherche.php?rech_titre='+NomFilm+'&x=0&y=0');
Parametre := URLEncode('');
AnalyzePage(Adresse, Parametre);
end;
end else
ShowMessage('Ce script requiert une version plus récente de Ant Movie Catalog (au moins la version 3.5.0)');
end.
Ok, merci Antoine ! Je vais essayer le prog pour le convertir !antp wrote:Je n'avais pas ce script parmis les scripts "officiels"
- soit il provient de ce forum-ci ou d'un autre forum et je ne l'ai pas vu donc jamais intégré
- soit le site m'a demandé de le retirer (mais je ne retrouve pas ce nom dans mes e-mails)
- soit le script ne fonctionnait plus depuis longtemps et je l'avais retiré à l'époque
S'il fonctionnait jusqu'à la migration vers la 3.5, il est toujours là, dans le dossier scripts, mais n'apparaît pas car il est au format 3.4.3
Il suffit de le convertir avec le programme de Pivello : viewtopic.php?t=1837
antp wrote:Si il a demandé à ce que le script soit retiré, ça explique pourquoi il n'est plus fourni avec AMC.
Pour ce qui est d'avoir des ennuis, a priori je ne pense pas. De toute façon je n'ai aucun moyen d'empêcher les gens d'accéder à leur site. Par contre si eux ne veulent pas qu'AMC accède à leur site, il leur suffit de bloquer le user agent d'AMC et plus aucune version officielle d'AMC ne pourra se connecter à leur site.
ça marche pour moi ce matin. As-tu été voir ici viewtopic.php?t=2016Anonymous wrote:Je suis un utilisateur satisfait de AMC . Merci à son créateur et à tous les participants à l'écriture des nouveaux scripts ... Mais depuis quelques jours , je ne peux plus accéder via CINEFIL.FR . Est-ce pour la même raison , ont-ils bloqué l'accès à l'user agent d'AMC ?
Il faudrait plutôt le suggérer à ScorEpioN dans son topic vu que c'est lui qui s'occupe du script Allocinédrone wrote:il y a une nouvelle section "séries", sur allociné et ça serait bien si qq'un pouvait faire un script pour les séries TV.
Merci d'avance
edit : http://www.mobygames.comsourichiot wrote:Bonjour à tous et à l'équipe qui fait vraiment des chefs d'oeuvres!
Je fais parti d'amateur et collectionneur de jeux vidéo et j'aimerais savoir si un script pourrais etre fait avec les infos images et textes tres complet de ce site:
http://www.gamefaqs.com
Merci d'avance !!!
Cela nous aiderez grandement!