(***************************************************
Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/
[Infos]
Authors=Antoine Potten
Title=Cinéstore
Description=Cinéstore (FR) import avec image
Site=http://www.cinestore.com
Language=FR
Version=2.0 (25/06/2005)
Requires=3.5.0
Comments=Refait le 25/06/2005 par Antoine Potten|Anciennes versions par nono.1|
License=This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
GetInfo=1
[Options]
AudioType=1|1|1=Audio -> Format audio|2=Audio -> Langues
GrandeImage=0|1|0=Toujours la petite image|1=Grande image si dispo
***************************************************)
program Cinestore;
uses
StringUtils1;
var
MovieName: string;
procedure AnalyzePage(Address: string);
var
PageText: string;
s1, Title: string;
Count: Integer;
begin
PageText := GetPage(Address);
if Pos('
Recherche
', PageText) = 0 then
AnalyzeMoviePage(PageText)
else
begin
PickTreeClear;
if Pos('Pas de résultats
', PageText) = 0 then
begin
Count := 0;
PickTreeAdd('Résultats de la recherche de "' + TextBetween(PageText, '', '
') + '"', '');
PageText := TextBetween(PageText, '', '
');
while Pos('
0 do
begin
s1 := TextBetween(PageText, '
');
PageText := RemainingText;
Address := 'http://www.cinestore.com' + TextBetween(s1, '', ''));
Title := StringReplace(Title + ' (' + TextBetween(s1, ' ', ''), #13#10, '') + ')';
HTMLRemoveTags(Title);
HTMLDecode(Title);
PickTreeAdd(Title, Address);
Count := Count + 1;
end;
end;
if Count = 1 then
AnalyzePage(Address)
else
if PickTreeExec(Address) then
AnalyzePage(Address);
end;
end;
procedure AnalyzeMoviePage(PageText: string);
var
Value: string;
begin
if CanSetField(fieldUrl) then
begin
Value := TextBetween(PageText, '?idproduit=', '&');
SetField(fieldUrl, 'http://www.cinestore.com/fiche_produit_film_gen_idproduit=' + Value + '.html');
end;
if CanSetField(fieldOriginalTitle) then
begin
Value := TextBetween(PageText, '', '
');
HTMLDecode(Value);
SetField(fieldOriginalTitle, Value);
end;
if CanSetField(fieldDirector) then
begin
Value := TextBetween(PageText, 'Réalisé par : ', '
');
if Value <> '' then
begin
HTMLRemoveTags(Value);
HTMLDecode(Value);
SetField(fieldDirector, Value);
end;
end;
if CanSetField(fieldActors) then
begin
Value := TextBetween(PageText, 'Avec : ', '
');
if Value <> '' then
begin
HTMLRemoveTags(Value);
HTMLDecode(Value);
SetField(fieldActors, Value);
end;
end;
if CanSetField(fieldMediaType) then
begin
Value := TextBetween(PageText, 'DVD Zone', '');
if Value <> '' then
SetField(fieldMediaType, 'DVD Zone' + Value);
end;
if CanSetField(fieldComments) then
begin
Value := TextBetween(PageText, 'Bonus :
', '
');
if Value <> '' then
begin
Value := StringReplace(Value, '
', #13#10);
HTMLRemoveTags(Value);
HTMLDecode(Value);
SetField(fieldComments, 'Bonus : ' + #13#10 + Value);
end;
end;
if CanSetField(fieldDescription) then
begin
Value := TextBetween(PageText, 'Synopsis
', '
');
if Value <> '' then
begin
Value := TextAfter(Value, '