Page 1 of 1

Culturalia modification

Posted: 2004-09-10 08:10:42
by albondiga
Any one can help me to modificate te culturalia script in the way it has capable to find films like "la mujer mas fea del mundo"?. I found in www.culturalianet.com by searching "mujer mundo" but I can't import from amc using the next script.



// GETINFO SCRIPTING
// 2003-08-28 Culturalia (Con Portada + Duración)

(* Update to Culturalia to retrieve length *)

(***************************************************
* Movie importation script for: *
* Culturalia, http://www.culturalianet.com *
* *
* Original version made by David Arenillas *
* New version made by Antoine Potten *
* Modified by Jose Miguel Folgueira
* Thanks to Culturalia's webmaster for his help *
* and for providing more direct access to his *
* database *
* *
* 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 Culturalia;
var
MovieName: string;
const
BaseURL = 'http://www.culturalianet.com/bus/catalogo.php';

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;
Code, Title, TitleOri, Year: string;
begin
Page := TStringList.Create;
Page.Text := GetPage(Address);
if Pos('No se ha encontrado ningún artículo por título', Page.Text) > 0 then
begin
ShowMessage('No se ha encontrado ningún artículo por título');
end else
begin
PickTreeClear;
LineNr := 1;
Page.Text := StringReplace(Page.Text, '<br>', #13#10);
PickTreeAdd('Search results:', '');
while LineNr + 3 < Page.Count do
begin
Code := GetValueAfter(Page.GetString(LineNr), 'Codigo = ');
Title := GetValueAfter(Page.GetString(LineNr+1), 'Titulo = ');
TitleOri := GetValueAfter(Page.GetString(LineNr+2), 'Titulo original = ');
Year := GetValueAfter(Page.GetString(LineNr+3), 'Año = ');
PickTreeAdd(Title + ' (' + TitleOri + '), ' + Year, BaseURL + '?catalogo=1&codigo=' + Code);
LineNr := LineNr + 5;
end;
Page.Free;
if PickTreeExec(Address) then
AnalyzeMoviePage(Address, Code);
end;
end;

procedure AnalyzeMoviePage(Address: string; Code: string);
var
Page: TStringList;
Comments: string;
strTitle: string;
strSinopsis: string;
strLength: string;
Line: string;
LineNr: Integer;
BeginPos, EndPos: Integer;
EndSinopsis: Integer;
begin
Page := TStringList.Create;
Page.Text := StringReplace(GetPage(Address), '<br><br>', #13#10);
Page.Text := StringReplace(Page.Text, '<br>', #13#10);
strTitle := GetValueAfter(Page.GetString(1), 'Titulo = ');
if copy(strTitle, Length(strTitle), Length(strTitle)) = '.' then
begin
SetField(fieldTranslatedTitle, copy(strTitle, 1, Length(strTitle) -1 ));
end else
begin
SetField(fieldTranslatedTitle, strTitle);
end;
SetField(fieldOriginalTitle, GetValueAfter(Page.GetString(2), 'Titulo original = '));
SetField(fieldYear, GetValueAfter(Page.GetString(3), 'Año = '));
SetField(fieldCategory, GetValueAfter(Page.GetString(4), 'Genero = '));
SetField(fieldCountry, GetValueAfter(Page.GetString(5), 'Nacion = '));
SetField(fieldDirector, GetValueAfter(Page.GetString(6), 'Director = '));
SetField(fieldActors, GetValueAfter(Page.GetString(7), 'Actores = '));
SetField(fieldProducer, GetValueAfter(Page.GetString(8), 'Productor = '));
Comments := 'Guión: ' + GetValueAfter(Page.GetString(9), 'Guion = ');
Comments := Comments + #13#10 + 'Fotografía: ' + GetValueAfter(Page.GetString(10), 'Fotografia = ');
Comments := Comments + #13#10 + 'Música: ' + GetValueAfter(Page.GetString(11), 'Musica = ');
SetField(fieldComments, Comments);
LineNr := FindLine('Sinopsis = ', Page, 0);
Line := Page.GetString(LineNr);
strSinopsis := GetValueAfter(Line, 'Sinopsis = ');
LineNr := LineNr + 1;
Line := Page.GetString(LineNr);
while pos('URL = ', Line) = 0 do
begin
strSinopsis := strSinopsis + #13#10 + Line;
LineNr := LineNr + 1;
Line := Page.GetString(LineNr);
end
SetField(fieldDescription, strSinopsis);
LineNr := FindLine('URL = ', Page, 0);
if LineNr <> -1 then
SetField(fieldURL, GetValueAfter(Page.GetString(LineNr), 'URL = '));
LineNr := FindLine('Imagen = ', Page, 0);
if LineNr <> -1 then
GetPicture(GetValueAfter(Page.GetString(LineNr), 'Imagen = '), False);
Page.Free;
Page := TStringList.Create;
Page.Text := StringReplace(GetPage('http://www.culturalianet.com/art/ver.php?art=' + Code), '<br>', #13#10);
(*LineNr := FindLine('>Duración:</font> ', Page, 0);
strLength := Page.GetString(LineNr);
EndPos := pos(' minutos.', strLength);
BeginPos := pos('Duración:</font> ', strLength) + 17;
strLength := copy(strLength, BeginPos, EndPos - BeginPos);
SetField(fieldLength, strLength);*)
Page.Free;
DisplayResults;
end;

function GetValueAfter(Line, Identifier: string): string;
begin
if Pos(Identifier, Line) = 1 then
Result := Copy(Line, Length(Identifier)+1, Length(Line))
else
Result := '';
end;

begin
if CheckVersion(3,4,0) then
begin
MovieName := GetField(fieldTranslatedTitle);
if MovieName = '' then
MovieName := GetField (fieldOriginalTitle);
if Input('Importar de Culturalia', 'Introduce el Titulo de la Pelicula:', MovieName) then
AnalyzePage(BaseURL + '?catalogo=1&texto=' + UrlEncode(MovieName) + '&donde=3');
end else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.0)');
end.

Posted: 2004-09-12 21:21:01
by folgui
Hello!

Look at thread: viewtopic.php?t=906 and copy the script that guest (pollopolea) has posted there. Saved it as Culturalia+IMDB.ifs and copy it to the scripts directory of AMC.

It works ok for that and other films with the same problem.

Regards, folgui.

The script don't works

Posted: 2004-09-12 21:56:53
by albondiga
I tried the script of Pollopolea but It couldn't find any film.
He probado el script de Pollopolea, pero es incapaz de encontrar ninguna película.

Posted: 2004-09-13 15:58:45
by folgui
Hello!

Well, if you write down the title ("mujer mas fea del mundo") at the original/translated title field and then import -> script, it works.

If you don't write nothing until script's textbox appears then it doesn't work. I'm going the tell him this issue.

Regards, folgui

Posted: 2004-10-03 23:06:59
by pollopolea
the new script i wrote solve this problem

see
viewtopic.php?t=1540

enjoy!