* création d'un fichier french.lng adapter à mon script (si vous souhaiter d'autres champs par rapport à ce qui est récupérable chez jeuxvideo.com, demandez je verrais)
* pour filtrer la recherche on peut remplir la string Plateform avec 'xbox','pc', 'ps2', 'gcn', 'gba', ... ou mettre '' pour toutes plateformes confondues
Code: Select all
// GETINFO SCRIPTING
// JeuxVideo.com import v1.3
(***************************************************
* Game importation script for: *
* JeuxVideo.com, http://www.jeuxvideo.com *
* *
* Script by Crevette 26/01/2005 *
* Modified by EDb 21/01/2005 *
* For use with Ant Movie Catalog 3.4.2 *
* 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 JeuxVideo;
const
ConfirmTitle = True; // False : ne demande pas de confirmation du titre avant recherche
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)
}
IsDisplayResults = True; // True : permet de selectionner les champs à importer dans la fiche
var
GameName: string;
Plateform: string; // mettre '' pour toutes plateformes confondues ou préciser 'xbox','pc', 'ps2', 'gcn', 'gba', ... pour filtrer la recherche
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, Count: Integer;
Line, GameAddress, Value, ValuePF: string;
BeginPos, EndPos: Integer;
begin
Page := TStringList.Create;
Page.Text := GetPage(Address);
if pos('Test avec JeuxVideo.com', Page.Text) > 0 then
AnalyzeGamePage(Page);
if pos('<img height=21 src="pics/', Page.Text) > 0 then
begin
// Titre Original
LineNr := FindLine('<b><font face="verdana, arial, helvetica, sans-serif" size="4">', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('<b><font face="verdana, arial, helvetica, sans-serif" size="4">', Line) + 63;
EndPos := pos('</font></b></td>', Line);
Value := copy(Line, BeginPos, EndPos - BeginPos);
SetField(fieldOriginalTitle, Value);
end;
// Jaquette grand format
LineNr := FindLine('Voir la jaquette en grand format', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('<a href="/affpic.htm?images/', Line) + 28;
EndPos := pos('">Voir la jaquette en grand format', Line);
Value := 'http://image.jeuxvideo.com/images/' + copy(Line, BeginPos, EndPos - BeginPos);
GetPicture(Value, ExternalPictures);
end else
begin
// Adresse de la jaquette chez Alapage.com
LineNr := FindLine('Achetez-le sur<br>Alapage.com', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('F&REF_NOVA=', Line) + 11;
EndPos := pos('" target=', Line);
Value := 'http://www.alapage.com/get_img.php?cgi=disque_l&num_ref=' + copy(Line, BeginPos, EndPos - BeginPos) + 'r.jpg';
GetPicture(Value, ExternalPictures);
end else
begin
LineNr := FindLine('Cliquez pour acheter ce jeu!', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('F&REF_NOVA=', Line) + 11;
EndPos := pos('" target=', Line);
Value := 'http://www.alapage.com/get_img.php?cgi=disque_l&num_ref=' + copy(Line, BeginPos, EndPos - BeginPos) + 'r.jpg';
GetPicture(Value, ExternalPictures);
end;
end;
end;
// Adresse du Test Complet
LineNr := FindLine('Test Complet', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('<a href="', Line) + 9;
EndPos := pos('"><b>', Line);
Address := copy(Line, BeginPos, EndPos - BeginPos);
AnalyzePage(Address);
end else
begin
LineNr := FindLine('</td><td><h1>', Page, 0);
Line := Page.GetString(LineNr);
BeginPos := pos('</td><td><h1>', Line) + 13;
EndPos := pos('</h1></td></tr>', Line);
Value := copy(Line, BeginPos, EndPos - BeginPos);
SetField(fieldOriginalTitle, Value);
SetField(fieldDescription, 'JeuxVideo.com n''a pas encore de Test Complet pour ' + Value +'.');
end;
end else
begin
PickTreeClear;
// Liste des Jeux Trouvés
LineNr := FindLine('<br>Nous avons trouvé ', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('color="#FF3300">', Line) + 16;
EndPos := pos('</font></b></font>', Line);
if (EndPos - BeginPos > 0) then
begin
PickTreeAdd(copy(Line, BeginPos, EndPos - BeginPos) +' jeux trouvés pour ' + GameName + ' :', '');
Count := StrToInt(copy(Line, BeginPos, EndPos - BeginPos), 0);
Delete(Line, 1, EndPos + 18);
While (Count > 0) do
begin
LineNr := FindLine('<p><img src="/pics/', Page, LineNr) ;
Line := Page.GetString(LineNr);
BeginPos := pos('<font size="4">', Line) + 15;
EndPos := pos('</font></b></font><br>', Line);
ValuePF := copy(Line, BeginPos, EndPos - BeginPos);
if ((Plateform = '') or (AnsiLowerCase(ValuePF) = Plateform)) then
PickTreeAdd(ValuePF, '');
Delete(Line, 1, EndPos + 22);
LineNr := FindLine('<a href="http://www.jeuxvideo.com/jeux/', Page, LineNr);
Repeat
Line := Page.GetString(LineNr);
BeginPos := pos('<a href="http://www.jeuxvideo.com/jeux/', Line) + 9;
If BeginPos > 9 then
begin
EndPos := pos('">', Line);
GameAddress := copy(Line, BeginPos, EndPos - BeginPos);
BeginPos := EndPos + 2;
EndPos := pos('</a><br>', Line);
Value := copy(Line, BeginPos, EndPos - BeginPos);
if ((Plateform = '') or (AnsiLowerCase(ValuePF) = Plateform)) then
PickTreeAdd(Value, GameAddress);
Delete(Line, 1, EndPos + 8);
Count := Count - 1;
end;
LineNr := LineNr + 1;
Until (pos('</font></p></blockquote>', Page.GetString(LineNr)) <> 0);
end;
end;
if PickTreeExec(Address) then
AnalyzePage(Address);
end;
end;
Page.Free;
end;
procedure AnalyzeGamePage(Page: TStringList);
var
Pageaff: TStringList;
Line, Value, LineNotes, ValueTemp: string;
LineNr: Integer;
IntValue: Integer;
BeginPos: Integer;
EndPos, EndPos2: Integer;
Offset, Count: Integer;
begin
// Label Du Support
LineNr := FindLine('sans-serif"><img src="/pics/', Page, LineNr) ;
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('sans-serif"><img src="/pics/', Line) + 28;
EndPos := pos('.gif" width="23" height="21">', Line);
Value := AnsiUpperCase(copy(Line, BeginPos, EndPos - BeginPos));
SetField(fieldMedia, Value);
end;
// Editeur
LineNr := FindLine('<font color="#CC0000">Editeur:', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('target="_blank">', Line) + 16;
EndPos := pos('</a><br>', Line);
Value := copy(Line, BeginPos, EndPos - BeginPos);
SetField(fieldProducer, Value);
end;
// Développeur
LineNr := FindLine('<font color="#CC0000">Développeur', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('target="_blank">', Line) + 16;
EndPos := pos('</a><br>', Line);
Value := copy(Line, BeginPos, EndPos - BeginPos);
SetField(fieldDirector, Value);
end;
// Site Web Officiel
LineNr := FindLine('<font color="#CC0000">Site web officiel', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('<a href="', Line) + 9;
EndPos := pos('" target=', Line);
Value := copy(Line, BeginPos, EndPos - BeginPos);
SetField(fieldUrl, Value);
end;
// Type de Jeu
LineNr := FindLine('<font color="#CC0000">Type', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('target=_new>', Line) + 12;
EndPos := pos('</a>', Line);
Value := copy(Line, BeginPos, EndPos - BeginPos);
SetField(fieldCategory, Value);
end;
// Date de Sortie
LineNr := FindLine('<font color="#CC0000">Sortie', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr+1);
SetField(fieldSource, Line);
Value := Copy(Line, Length(Line)-4, 5);
SetField(fieldYear, Value);
end;
// Version = Langue
LineNr := FindLine('<font color="#CC0000">Version :</font> ', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('<font color="#CC0000">Version :</font> ', Line) + 39;
EndPos := pos('<br>', Line);
Value := copy(Line, BeginPos, EndPos - BeginPos);
SetField(fieldLanguages, Value);
end;
// Classification
LineNr := FindLine('<font color="#CC0000">Classification :</font><br> ', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('<font color="#CC0000">Classification :</font><br> ', Line) + 50;
Delete(Line, 1, BeginPos-1);
EndPos := pos('<br>', Line);
Value := copy(Line, 1, EndPos - 1);
SetField(fieldSubtitles, Value);
end;
// Similaire à
LineNr := FindLine('<font color="#CC0000">Similaire à', Page, 0);
if LineNr > -1 then
begin
Value := '';
repeat
Line := Page.GetString(LineNr);
BeginPos := pos('target=_new>', Line) + 12;
EndPos := pos('</a>', Line);
Value := Value + copy(Line, BeginPos, EndPos - BeginPos) + #13#10;
LineNr := LineNr + 1;
until (pos('</span></td></tr></table></td></tr><tr valign=top>', Page.GetString(LineNr)) <> 0);
SetField(fieldActors, Value);
end;
// Test Complet (Description)
LineNr := FindLine('<p align="justify">', Page, 0);
if LineNr > -1 then
begin
Value := '';
LineNr := LineNr + 1;
repeat
Line := Page.GetString(LineNr);
if (pos('<', line) <> 1) then
begin
Value := Value + Line + #13#10#13#10;
SetField(fieldDescription, Value);
end;
LineNr := LineNr+1;
until (pos('<a href="mailto:', Page.GetString(LineNr-2)) <> 0)or (pos('</span></p><p align=right><span class=''nmt''><i>', Page.GetString(LineNr-1)) <> 0);
SetField(fieldDescription, Value);
end;
// En Bref... (Commentaires)
LineNr := FindLine('En bref...', Page, 0);
if LineNr > -1 then
begin
Value := '';
// Graphisme
Line := Page.GetString(LineNr + 1);
BeginPos := pos('color="#009900">', Line) + 16;
EndPos := pos('</font></b><br>', Line);
Value := Value + copy(Line, BeginPos, EndPos - BeginPos) + ' : ';
// Note
LineNotes := Page.GetString(LineNr + 11);
BeginPos := pos('face="Tahoma, Arial, Helvetica, sans-serif">', LineNotes) + 44;
EndPos := pos('</font><font face=', LineNotes);
ValueTemp := copy(LineNotes, BeginPos, EndPos - BeginPos);
Value := Value + ValueTemp + '/20' + #13#10;
EndPos := pos('/20', LineNotes);
Delete (LineNotes, 1, EndPos + 2);
// Commentaire
Line := Page.GetString(LineNr + 2);
BeginPos := 1;
//pos('<font size="1" face="Tahoma, Arial, Helvetica, sans-serif">', Line) + 59;
EndPos := pos('</td>', Line);
Value := Value + copy(Line, BeginPos, EndPos - BeginPos) + #13#10#13#10;
LineNr := LineNr + 3;
// Jouabilité
Line := Page.GetString(LineNr);
BeginPos := pos('color="#009900">', Line) + 16;
EndPos := pos('</font></b><br>', Line);
Value := Value + copy(Line, BeginPos, EndPos - BeginPos) + ' : ';
// Note
BeginPos := pos('face="Tahoma, Arial, Helvetica, sans-serif">', LineNotes) + 44;
EndPos := pos('</font><font face=', LineNotes);
ValueTemp := copy(LineNotes, BeginPos, EndPos - BeginPos);
Value := Value + ValueTemp + '/20' + #13#10;
EndPos := pos('/20', LineNotes);
Delete (LineNotes, 1, EndPos + 2);
// Commentaire
Line := Page.GetString(LineNr + 1);
BeginPos := 1;
EndPos := pos('</td>', Line);
Value := Value + copy(Line, BeginPos, EndPos - BeginPos) + #13#10#13#10;
LineNr := LineNr + 2;
// Durée de vie
Line := Page.GetString(LineNr);
BeginPos := pos('color="#009900">', Line) + 16;
EndPos := pos('</font></b><br>', Line);
Value := Value + copy(Line, BeginPos, EndPos - BeginPos) + ' : ';
// Note
BeginPos := pos('face="Tahoma, Arial, Helvetica, sans-serif">', LineNotes) + 44;
EndPos := pos('</font><font face=', LineNotes);
ValueTemp := copy(LineNotes, BeginPos, EndPos - BeginPos);
Value := Value + ValueTemp + '/20' + #13#10;
EndPos := pos('/20', LineNotes);
Delete (LineNotes, 1, EndPos + 2);
// Commentaire
Line := Page.GetString(LineNr + 1);
BeginPos := 1;
EndPos := pos('</td>', Line);
Value := Value + copy(Line, BeginPos, EndPos - BeginPos) + #13#10#13#10;
LineNr := LineNr + 2;
// Bande son
Line := Page.GetString(LineNr);
BeginPos := pos('color="#009900">', Line) + 16;
EndPos := pos('</font></b><br>', Line);
Value := Value + copy(Line, BeginPos, EndPos - BeginPos) + ' : ';
// Note
BeginPos := pos('face="Tahoma, Arial, Helvetica, sans-serif">', LineNotes) + 44;
EndPos := pos('</font><font face=', LineNotes);
ValueTemp := copy(LineNotes, BeginPos, EndPos - BeginPos);
Value := Value + ValueTemp + '/20' + #13#10;
EndPos := pos('/20', LineNotes);
Delete (LineNotes, 1, EndPos + 2);
// Commentaire
Line := Page.GetString(LineNr + 1);
BeginPos := 1;
EndPos := pos('</td>', Line);
Value := Value + copy(Line, BeginPos, EndPos - BeginPos) + #13#10#13#10;
LineNr := LineNr + 2;
// Scénario
Line := Page.GetString(LineNr);
BeginPos := pos('color="#009900">', Line) + 16;
EndPos := pos('</font></b><br>', Line);
Value := Value + copy(Line, BeginPos, EndPos - BeginPos) + ' : ';
// Note
BeginPos := pos('face="Tahoma, Arial, Helvetica, sans-serif">', LineNotes) + 44;
EndPos := pos('</font><font face=', LineNotes);
ValueTemp := copy(LineNotes, BeginPos, EndPos - BeginPos);
Value := Value + ValueTemp + '/20' + #13#10;
EndPos := pos('/20', LineNotes);
Delete (LineNotes, 1, EndPos + 2);
// Commentaire
Line := Page.GetString(LineNr + 1);
BeginPos := 1;
EndPos := pos('</td>', Line);
Value := Value + copy(Line, BeginPos, EndPos - BeginPos) + #13#10#13#10;
LineNr := LineNr + 2;
// Note générale
Line := Page.GetString(LineNr);
BeginPos := pos('color="#FF0000" size="4">', Line) + 25;
EndPos := pos('</font></strong><br>', Line);
ValueTemp := copy(Line, BeginPos, EndPos - BeginPos) ;
ValueTemp := StringReplace(ValueTemp, ' ', ' ');
Value := Value + ValueTemp + ' : ';
// Note
BeginPos := pos('face="Tahoma, Arial, Helvetica, sans-serif" color="#FF0000">', LineNotes) + 60;
EndPos2 := pos('</font><font face=', LineNotes);
ValueTemp := copy(LineNotes, BeginPos, EndPos2 - BeginPos);
Value := Value + ValueTemp + '/20' + #13#10;
SetField(fieldRating, IntToStr(StrToInt(ValueTemp,0) div 2));
// Commentaire
Line := copy(Line, EndPos, Length(Line));
BeginPos := pos('<br>', Line) + 4;
EndPos := pos('<td width', Line);
Value := Value + copy(Line, BeginPos, EndPos - BeginPos) + #13#10#13#10;
SetField(fieldComments, Value);
end;
if IsDisplayResults then
DisplayResults;
end;
begin
Plateform := AnsiLowerCase('');
if CheckVersion(3,4,2) then
begin
GameName := GetField(fieldOriginalTitle);
if GameName = '' then
GameName := GetField(fieldTranslatedTitle);
if ConfirmTitle then
begin
if Input('JeuxVideo.com Import', 'Entrez le nom du jeu :', GameName) then
AnalyzePage('http://www.jeuxvideo.com/schr.htm?textfield='+UrlEncode(GameName)+'&range=-');
end else
AnalyzePage('http://www.jeuxvideo.com/schr.htm?textfield='+UrlEncode(GameName)+'&range=-');
end else
ShowMessage('Ce script requiert la version 3.4.2 ou supérieure de Ant Movie Catalog.');
end.
Pour le fichier de langue, copiez dans un fichier text nommé french.lng et le mettre à la place de celui se trouvant dans ..\Ant Movie Catalog\Languages
(faites une sauvegarde de l'original si vous souhaitez retrouver les champs originaux) :