program IMDB;
uses
StringUtils1;
var
MovieName: string;
MovieURL: string;
MovieNumber: string;
// ***** analyzes the results page that asks to select a movie from a list *****
procedure AnalyzeResultsPage(Address: string);
var
PageText: string;
Value: string;
begin
PageText := GetPage(Address);
if pos('<title>IMDb', PageText) = 0 then
begin
AnalyzeMoviePage(PageText)
end else
begin
if Pos('[b]No Matches.[/b]', PageText) > 0 then
begin
if GetOption('BatchMode') = 0 then
ShowMessage('No movie found for this search');
Exit;
end;
if GetOption('BatchMode') = 0 then
begin
PickTreeClear;
repeat
Value := TextBefore(PageText, '<ol>', '[b]');
if Value <> '' then
begin
HTMLRemoveTags(Value);
HTMLDecode(Value);
PickTreeAdd(Value, '');
end;
Value := TextBetween(PageText, '<ol>', '</ol>');
PageText := RemainingText;
until not AddMovieTitles(Value);
Value := TextBefore(PageText, '][b]more titles[/b][/url]', '</ol>'), '
', ', ');
HTMLRemoveTags(Value);
HTMLDecode(Value);
SetField(fieldDirector, Value);
end;
// Actors
if CanSetField(fieldActors) then
begin
Value := TextBetween(PageText, 'ast overview', '');
if Value = '' then
Value := TextBetween(PageText, 'redited cast', '');
if Value = '' then
Value := TextBetween(PageText, 'Cast:', '[/table]');
if Value [/tr] 0 do
begin
Value2 := TextBetween(Value, '<tr', '[/tr]');
Value := RemainingText;
if Pos('rest of cast', Value2) > 0 then
Continue;
if Pos('[url=fullcredits](more)[/url]', Value2) > 0 then
Break;
if FullValue <> '' then
FullValue := FullValue + #13#10;
TextBefore(Value2, '[/td]', '');
Value2 := TextBetween(RemainingText, '/]', '[/url]');
if Value2 <then> 0 do
begin
Value2 := TextBetween(Value, '[tr]', '[/tr]');
Value := RemainingText;
if Pos('rest of cast', Value2) > 0 then
Continue;
if Pos('[url=fullcredits](more)[/url]', Value2) > 0 then
Break;
if FullValue [/td] 0 do
begin
Value2 := TextBetween(Value, '<tr', '[/tr]');
Value := RemainingText;
if Pos('rest of cast', Value2) > 0 then
Continue;
if Pos('[url=fullcredits](more)[/url]', Value2) > 0 then
Break;
if FullValue <> '' then
FullValue := FullValue + #13#10;
TextBefore(Value2, '[/td]', '');
Value2 := TextBetween(RemainingText, '/]', '[/url]');
if Value2 <> '' then
begin
FullValue := FullValue + Value2;
Value2 := TextBetween(RemainingText, 'e]', '[/td]');
if Value2 <then> 0 do
begin
Value2 := TextBetween(Value, '[tr]', '[/tr]');
Value := RemainingText;
if Pos('rest of cast', Value2) > 0 then
Continue;
if Pos('[url=fullcredits](more)[/url]', Value2) > 0 then
Break;
if FullValue <> '' then
FullValue := FullValue + #13#10;
FullValue := FullValue + TextBefore(Value2, '[/td]', '');
Value2 := TextBetween(RemainingText, '[td]', '[/td]');
if Value2 <> '' then
FullValue := FullValue + ' (as ' + Value2 + ')';
end;
*)
4:
begin
FullValue := TextBefore(Value, '[/tr][tr][td]', '');
if FullValue = '' then
FullValue := Value;
FullValue := StringReplace(FullValue, ' [tr][td]rest of cast listed alphabetically:</small>[/td][/tr] ', '');
FullValue := StringReplace(FullValue, '[/tr]', #13#10);
end;
end;
HTMLRemoveTags(FullValue);
HTMLDecode(FullValue);
case GetOption('ActorsLayout') of
0, 2:
FullValue := StringReplace(FullValue, #13#10, ', ');
end;
SetField(fieldActors, FullValue);
end;
end;
//Country
if CanSetField(fieldCountry) then
begin
SetField(fieldCountry, ImportList(PageText, GetOption('MultipleValuesCountry'), '/Countries/'));
end;
//Category
if CanSetField(fieldCategory) then
begin
SetField(fieldCategory, ImportList(PageText, GetOption('MultipleValuesCategory'), '/Genres/'));
end;
// Language
if CanSetField(fieldLanguages) then
begin
SetField(fieldLanguages, ImportList(PageText, GetOption('MultipleValuesLanguages'), '/Languages/'));
end;
// Length
if CanSetField(fieldLength) then
begin
Value := TextBetween(PageText, '[b]Duración:[/b]' + #13#10, ' ');
if Value <then> 0 then
SetField(fieldLength, TextAfter(Value, ':'))
else
SetField(fieldLength, Value);
end;
end;
// AKA Name
if CanSetField(fieldTranslatedTitle) then
begin
Value := TextBetween(PageText, '[b]También conocida como:[/b]
', '
' + #13#10 + '<b');
if Value <then> 0 then
begin
Value := TextAfter(PageText, '[url=trivia]');
if Value <> '' then
begin
sleep(50);
Value := GetField(fieldURL);
FullValue := GetPage(Value+'/trivia');
Value := TextBetween(FullValue, '<ul>', '');
Value2 := TextBetween(FullValue, '<title>', '</title>');
Value := StringReplace(Value, #13#10, '');
Value := StringReplace(Value, ' ', '');
Value := StringReplace(Value, '<li>', #13#10 + '- ');
HTMLRemoveTags(Value);
HTMLDecode(Value);
HTMLRemoveTags(Value2);
HTMLDecode(Value2);
Value2 := AnsiUpperCase(Value2);
case GetOption('Trivia') of
1:
begin
if GetField(fieldDescription) <> '' then
Value := GetField(fieldDescription) + #13#10 + #13#10 + 'IMDB ' + Value2 + ': ' + Value
else
Value := 'IMDB ' + Value2 + ': ' + Value;
SetField(fieldDescription, Value);
end;
2:
begin
if GetField(fieldComments) <then> 0) then
begin
Value := TextAfter(PageText, '[url=awards]');
if Value </h1> 0 do
Value := StringReplace(Value, #13#10+#13#10, #13#10);
FullValue:= Value2+': '+Value;
case GetOption('Awards') of
1:
begin
if GetField(fieldDescription) <> '' then
Value := GetField(fieldDescription) + #13#10 + #13#10 + Value2 + ': ' + Value
else
Value := Value2 + ': ' + Value;
SetField(fieldDescription, Value);
end;
2:
begin
if GetField(fieldComments) <> '' then
Value := GetField(fieldComments) + #13#10 + #13#10 + Value2 + ': ' + Value
else
Value := Value2 + ': ' + Value;
SetField(fieldComments, Value);
end;
end;
end;
end;
end;
// ***** Imports lists like Genre, Country, etc. depending of the selected option *****
function ImportList(PageText: string; MultipleValues: Integer; StartTag: string): string;
var
Value, Value2: string;
begin
if MultipleValues = 0 then
begin
Value := TextBetween(PageText, StartTag, '[/url]');
Value2 := TextAfter(Value, ']');
end
else
begin
Value := TextBetween(PageText, StartTag, #13#10);
Value2 := TextBefore(Value, ' ');
HTMLRemoveTags(Value2);
if MultipleValues = 1 then
Value2 := StringReplace(Value2, ' / ', ', ');
end;
HTMLDecode(Value2);
Result := Value2;
end;
// ***** Gets summaries for the movie, based on the plot outline given in parameter (that contains the URL to more summaries) *****
function ImportSummary(PlotText: string): string;
var
Address, Value, Value2, PageText, Longest: string;
begin
Address := TextBetween(PlotText, '[url=/rg/title-tease/plotsummary', '](more)[/url]');
if (Address = '') or (GetOption('DescriptionSelection') = 0) then
begin
Result := Trim(TextBefore(PlotText, '[url=/rg', ''));
if Result = '' then
Result := Trim(PlotText);
HTMLRemoveTags(Result);
HTMLDecode(Result);
end
else
begin
PageText := GetPage('http://spanish.imdb.com/rg/title-tease/plotsummary' + Address);
PickListClear;
Longest := '';
Value := TextBetween(PageText, '<p class="plotpar]', '');
PageText := RemainingText;
while Value <do> 0 do
Value := StringReplace(Value, ' ', ' ');
if Length(Value) > Length(Longest) then
Longest := Value;
PickListAdd(Trim(Value));
Value := TextBetween(PageText, '<p class="plotpar]', '');
PageText := RemainingText;
end;
if (GetOption('BatchMode') > 0) or (GetOption('DescriptionSelection') = 2) then
Result := Longest
else
begin
if not PickListExec('Select a description for "' + GetField(fieldOriginalTitle) + '"', Result) then
Result := '';
end;
end;
end;
// ***** beginning of the program *****
begin
if CheckVersion(3,5,0) then
begin
MovieName := '';
if GetOption('BatchMode') = 2 then
begin
MovieName := GetField(fieldURL);
if Pos('imdb.com', MovieName) = 0 then
MovieName := '';
end;
if MovieName = '' then
MovieName := GetField(fieldOriginalTitle);
if MovieName = '' then
MovieName := GetField(fieldTranslatedTitle);
if GetOption('BatchMode') = 0 then
begin
if not Input('IMDB Import', 'Enter the title or the IMDB URL of the movie:', MovieName) then
Exit;
end
else
Sleep(500);
if MovieName <then> 0 then
AnalyzeResultsPage(MovieName)
else
begin
MovieName := StringReplace(MovieName, '&', 'and');
if (GetOption('BatchMode') > 0) or (GetOption('PopularSearches') = 1) then
AnalyzeResultsPage('http://spanish.imdb.com/find?tt=1;q=' + UrlEncode(MovieName))
else
AnalyzeResultsPage('http://spanish.imdb.com/find?more=tt;q=' + UrlEncode(MovieName));
end;
end;
end
else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.5.0)');
end.
(***************************************************
Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/
[Infos]
Authors=gilistico
Title=IMDB (ES)
Description=Importación de creditos desde IMDB adaptandolos al castellano
Language=ES
Version=2.00
Requires=3.5.0
Comments=Se traducen los terminos, paises, categorías,... más usuales.
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]
***************************************************)
program IMDB_ES;
uses
StringUtils1;
var
MovieName: string;
MovieURL: string;
MovieNumber: string;
// Pagina de resultados de la busqueda de peliculas - Extracción de resultados
function BuscaPeliculas(Address: string): Boolean;
var
Pagina, Item, Item2: string;
Value, value2: string;
Primero: Integer;
begin
Pagina := GetPage(Address);
if Pos('[b]No Matches.[/b]', Pagina) > 0 then
begin
Result := False;
Exit;
end;
PickTreeClear;
while Pos('</ol>', Pagina)> 0 do
begin
Value := TextBetween(Pagina, '<ol>', '</ol>');
Pagina := RemainingText;
while Pos('</li>',Value)> 0 do
begin
Value2 := TextBefore(Value, '</li>', '');
Value := RemainingText;
Address := TextBetween(Value2, '[url=', ']');
MovieNumber := TextBetween(Address, '/tt', '/');
Address := 'http://imdb.com/title/tt' + MovieNumber + '/combined';
Value2 := StringReplace(Value2,' ',' ');
Value2 := StringReplace(Value2,#13#10,' ');
HTMLRemoveTags(Value2);
HTMLDecode(Value2);
Value2 := Trim(Value2);
value2 := StringReplace(Value2,'"','');
if Pos('aka',Value2)> 0 then
begin
Item2 := TextBefore(Value2, 'aka', '');
Value2 := RemainingText;
while Pos('aka',Value2)> 0 do
begin
Item := TextBefore(Value2, 'aka', '');
Value2 := RemainingText;
if Pos('(',Item)> 0 then
Item := TextBefore(Item, '(', '');
if Pos('-',Item)> 0 then
Item := TextBefore(Item, '-', '');
Item2 := Trim(Item2) + '; ' + Trim(Item);
end;
if Pos('(',Value2)> 0 then
Value2 := TextBefore(Value2, '(', '');
if Pos('-',Value2)> 0 then
Value2 := TextBefore(Value2, '-', '');
Value2 := Trim(Item2) + '; ' + Trim(Value2);
end;
PickTreeAdd(Value2, Address);
end;
end;
if PickTreeExec(Address) then
AnalizaPelicula(Address);
Result := True;
end;
// Pagina combinada de la pelicula - Extracción de datos de la pelicula.
procedure AnalizaPelicula(Address: string);
var
Value, Value2, Value3, FullValue: string;
p: Integer;
Pagina, Estrenos: string;
Comments: String;
Tmp, Todo, Item: String;
n,m,num: Integer;
Persona, Cargo: String;
Guion, Novela, Historia: String;
begin
Comments := ''; // GetField(fieldComments)+#13#10+'-------------------------'+#13#10;
MovieNumber := TextBetween(Address, '/tt', '/');
Pagina := GetPage(Address);
// Url de la pagina combinada
if Address <> GetField(fieldURL) then
SetField(fieldURL, Address);
// Titulo original
Value := TextBetween(Pagina, '<title>', '</title>');
if Value <> '' then
begin
Value2 := TextBefore(Value, ' (', '');
HTMLDecode(Value2);
if Value2 <> GetField(fieldOriginalTitle) then
SetField(fieldOriginalTitle, Value2);
end;
// Año
Value := RemainingText;
if Value <then> 0 then
Value2 := TextBefore(Value, '/', '')
else Value2 := TextBefore(Value, ')', '');
if Value2 <> GetField(fieldYear) then
SetField(fieldYear, Value2);
end;
// Valoración
Value := TextBetween(Pagina, '/rating-stars/', '/rating-vote/');
if Value <> '' then
begin
Item := TextBetween(Value, '[b]', '/');
if Item <> GetField(fieldRating) then
SetField(fieldRating, Item);
end;
//Pais
Value := TextBetween(Pagina, '[b]Country:[/b]', '
');
if Value <> '' then
begin
HTMLRemoveTags(Value);
HTMLDecode(Value);
value := StringReplace(Value,#13#10,' ');
Value := RenombraPais(Trim(Value));
Value := StringReplace(Value,' /',',');
if Value <> GetField(fieldCountry) then
SetField(fieldCountry, Value);
end;
//Categoría
Value := TextBetween(Pagina,'[b]Genre:[/b]', '
');
if Value <> '' then
begin
HTMLRemoveTags(Value);
HTMLDecode(Value);
value := StringReplace(Value,#13#10,' ');
value := StringReplace(Value,' /',',');
value := StringReplace(Value,'/',',');
value := StringReplace(Value,'(more)','');
Value := RenombraCategoria(Trim(Value));
if Value <> GetField(fieldCategory) then
SetField(fieldCategory, Value);
end;
// Duración
Value := TextBetween(Pagina, '[b]Runtime:[/b]' + #13#10, ' ');
if Value <then> 0 then
Value := TextAfter(Value, ':');
if Value <> GetField(fieldLength) then
SetField(fieldLength, Value);
end;
// Productora
Value := TextBetween(Pagina, 'Production Companies[/b]', '</ul>');
if Value <> '' then
begin
Value := StringReplace(Value, '</li><li>', '; ');
HTMLRemoveTags(Value);
HTMLDecode(Value);
if Value <> GetField(fieldProducer) then
SetField(fieldProducer, Value);
end
// creditos
// Address := 'http://imdb.com/title/tt' + MovieNumber + '/fullcredits';
// Pagina := GetPage(Address);
// Director
Value := TextBetween(Pagina, 'Directed by[/b][/url]', '[/table]');
if Value [/tr] 0 do
begin
Value2 := TextBefore(Value, #13#10, '');
Value := RemainingText;
Persona := TextBefore(Value2, '[/td]', '');
HTMLRemoveTags(Persona);
HTMLDecode(Persona);
Persona := Trim(Persona);
if Persona = '' then
continue;
Cargo := RemainingText;
HTMLRemoveTags(Cargo);
HTMLDecode(Cargo);
Cargo := Trim(Cargo);
if Tmp <> '' then
Tmp := Tmp + ', ';
Tmp := Tmp + Trim(Persona);
end
if Tmp <> GetField(fieldDirector) then
SetField(fieldDirector, Tmp);
end;
// Actores
Value := TextBetween(Pagina, 'Cast[/b][/url]', '[/table]');
if Value [/tr] 0 do
begin
Value2 := TextBefore(Value, #13#10, '');
Value := RemainingText;
HTMLRemoveTags(Value2);
HTMLDecode(Value2);
Value2 := Trim(Value2);
if Pos('rest of cast', Value2) > 0 then
break;
num := Num + 1;
if num > 15 then
break;
n:=Pos('....', Value2);
if n > m then
m := n;
end;
if m> 30 then
m := 30;
Tmp := '';
Value := Todo;
num := 0;
While Pos(#13#10, Value)> 0 do
begin
Value2 := TextBefore(Value, #13#10, '');
Value := RemainingText;
HTMLRemoveTags(Value2);
HTMLDecode(Value2);
Value2 := Trim(Value2);
if value2 = '' then
continue;
if Pos('rest of cast', Value2) > 0 then
break;
num := Num + 1;
if num > 20 then
break;
Item := TextBefore(Value2, '....', '');
for n := length (Item) to m do
Item := Item +'.';
cargo := RemainingText;
if Pos('(age ', Cargo) > 0 then
begin
Cargo := StringReplace(Cargo,'(age ','(A los ');
Cargo := StringReplace(Cargo,')','años)');
end
else if Pos('(', Cargo) > 0 then
Cargo := TextBefore(Cargo, '(', '');
Item := Item + Cargo;
Tmp := Tmp + Item + #13#10;
end;
Tmp := StringReplace(Tmp, '(as ', '(como ');
if Tmp <> GetField(fieldRating) then
SetField(fieldActors, Tmp);
end;
// Guionista
Value := TextBetween(Pagina, 'Writing credits[/b][/url]', '[/table]');
if Value [/tr] 0 do
begin
Value2 := TextBefore(Value, #13#10, '');
Value := RemainingText;
Value2 := StringReplace(Value2, '(in alphabetical order)', '');
Persona := TextBefore(Value2, '[/td]', '');
HTMLRemoveTags(Persona);
HTMLDecode(Persona);
Persona := StringReplace(Persona, '(WGA)', '');
Persona := Trim(Persona);
if Persona = '' then
continue;
Cargo := RemainingText;
HTMLRemoveTags(Cargo);
HTMLDecode(Cargo);
Cargo := Trim(Cargo);
if Pos('(screenplay)', Cargo) > 0 then
Cargo := 'screenplay';
if Pos('(teleplay)', Cargo) > 0 then
Cargo := 'teleplay';
Cargo := StringReplace(Cargo, ') and', '');
Cargo := StringReplace(Cargo, ') &', '');
Cargo := StringReplace(Cargo, '(', '');
Cargo := StringReplace(Cargo, ')', '');
Cargo := StringReplace(Cargo, 'and', 'y');
Cargo := StringReplace(Cargo, '&', 'y');
if (Pos('material', Cargo) > 0) OR
(Pos('earlier', Cargo) > 0) then
continue;
cargo := Trim(cargo);
if (Cargo = '') OR
(Cargo = 'screenplay') OR
(Cargo = 'teleplay') OR
(Cargo = 'scenario') OR
(Cargo = 'written by') then
begin
if guion <then> 0) OR
(Pos('story', Cargo) > 0) then
begin
Cargo := trim(Cargo);
if Historia <then> 0) OR
(Pos('graphic novels', Cargo) > 0) OR
(Pos('comic', Cargo) > 0) then
begin
Cargo := trim(Cargo);
if Novela <then> 0 then
begin
Cargo := StringReplace(Cargo, 'novels', '');
Cargo := trim(Cargo);
if Novela <then> 0) OR
(Pos('novel', Cargo) > 0) then
begin
Cargo := StringReplace(Cargo, 'play', '');
Cargo := StringReplace(Cargo, 'novel', '');
Cargo := trim(Cargo);
if Novela <then> 0 then
Novela := Novela + ')';
if Pos('Historia', Historia) > 0 then
Historia := Historia + ')';
Guion := Guion + ' '+ Novela + Historia;
Guion := PonerY(Guion);
Comments := Comments + 'Guión: ' + Guion + #13#10;
end;
// Musica
Item := GetPersonas(Pagina,'Music by');
if Item <> '' then
Comments := Comments + 'Música: ' + Item + #13#10;
// Fotografía
Item := GetPersonas(Pagina,'Cinematography by');
if Item <> '' then
Comments := Comments + 'Fotografía: ' + Item + #13#10;
// Montaje
Item := GetPersonas(Pagina,'Film Editing by');
if Item <> '' then
Comments := Comments + 'Montaje: ' + Item + #13#10;
//Lenguaje original
Value := TextBetween(Pagina, '[b]Language:[/b]', '
');
if Value <> '' then
begin
HTMLRemoveTags(Value);
HTMLDecode(Value);
value := StringReplace(Value,#13#10,' ');
value := StringReplace(Value,'/',',');
Value := RenombraIdioma(Trim(Value));
Comments := Comments + 'Rodaje: ' + Value;
end;
//Color
Value := TextBetween(Pagina, '[b]Color:[/b]', '
');
if Value <> '' then
begin
HTMLRemoveTags(Value);
HTMLDecode(Value);
value := StringReplace(Value,#13#10,' ');
value := StringReplace(Value,' /',',');
value := StringReplace(Value,'/',',');
value := StringReplace(Value,'Black and White','Blanco y negro');
Value := RenombraIdioma(Trim(Value));
Comments := Comments + '; ' + Value;
end;
//Sonido
Value := TextBetween(Pagina, '[b]Sound Mix:[/b]', '
');
if Value <> '' then
begin
HTMLRemoveTags(Value);
HTMLDecode(Value);
value := StringReplace(Value,#13#10,' ');
value := StringReplace(Value,' /',',');
value := StringReplace(Value,'/',',');
Value := RenombraIdioma(Trim(Value));
Comments := Comments + '; ' + Value;
end;
Comments := Comments + #13#10;
// Aspectos técnicos
Item := '';
Address := 'http://imdb.com/title/tt' + MovieNumber + '/technical';
Estrenos := GetPage(Address);
Value := TextBetween(Estrenos, '<dl>','</dl>');
if value </dd> 0 do
begin
Value2 := TextBefore(Value,'</dd>', '<dt>');
Value := RemainingText;
Todo := TextBefore(Value2,'</dt>', '');
Value2 := RemainingText;
if (Pos('Camera', Todo)> 0) OR
(Pos('Laboratory', Todo)> 0) then
continue;
if Pos('negative format', Todo)> 0 then
Value2 := 'negativo: '+ value2;
if Pos('Printed film', Todo)> 0 then
Value2 := 'distribución: '+ value2;
if Pos('Aspect ratio', Todo)> 0 then
Value2 := 'formato: '+ value2;
if Pos('Cinematographic process', Todo)> 0 then
Value2 := 'proceso: '+ value2;
HTMLRemoveTags(Value2);
HTMLDecode(Value2);
if Pos('(', Value2)> 0 then
Value2 := TextBefore(Value2,'(', '');
If Item <> '' then
Item := Item + '; ';
Item := Item + value2;
end;
Comments := Comments + 'Aspectos técnicos: ' + Item + #13#10;
end;
// Lugares de rodaje
Item := '';
Historia := '';
Address := 'http://imdb.com/title/tt' + MovieNumber + '/locations';
Estrenos := GetPage(Address);
if Estrenos <> '' then
Value := TextBetween(Estrenos, '<dl>','</dl>');
if value </dd> 0 do
begin
Value2 := TextBefore(Value,'</dd>', '<dt>');
Value := RemainingText;
Todo := TextBefore(Value2,'</dt>', '');
Value2 := RemainingText;
HTMLRemoveTags(Todo);
HTMLDecode(Todo);
Todo := StringReplace(Todo,', USA','')+'; ';
Item := Item + Todo;
if Pos(',', Todo)> 0 then
cargo := TextBefore(Todo,';', ',')
else cargo := TextBefore(Todo,';', '');
if Pos(cargo, Historia)> 0 then
continue;
Historia := Historia + cargo+'; ';
end;
if length(Item)> 100 then
Item := Historia;
if Item <> '' then
Item := Item + #13#10;
Item := StringReplace(Item,'; '+ #13#10,'');
if Item <then> 0 do
begin
Value := TextBetween(Estrenos, '[tr][td]','[/tr]');
Estrenos := RemainingText;
Value2 := TextBefore(Value,'[/td]', ''); // Pais
Value := RemainingText;
Value := TextBefore(Value,'[/td]', '"right]'); // Año
Historia := RemainingText;
Historia := TextBefore(Historia,'[/td]', '[td]'); // Motivo
value := Value + Historia;
HTMLRemoveTags(Value2);
HTMLDecode(Value2);
HTMLRemoveTags(Value);
HTMLDecode(Value);
if Pos('Spain', Value2) > 0 then
Item := 'Estreno en España: ' + RenombraMes(Trim(Value)) + #13#10;
if n = 0 then
Todo:= 'Estreno en ' + RenombraPais(Trim(Value2)) + ': '+ RenombraMes(Trim (Value)) + #13#10;
n := 1;
end;
if (Todo <> '') AND (Todo <> Item) then
Comments := Comments + Trim(Todo);
if Item <> '' then
Comments := Comments + Trim(Item);
// Sinopsis, solo si no la tenemos, pues está en ingles
Value := GetField(fieldDescription);
If value = '' then
begin
Address := 'http://imdb.com/title/tt' + MovieNumber + '/plotsummary';
Estrenos := GetPage(Address);
Value := TextBetween(Estrenos, '<p class="plotpar]', '');
HTMLRemoveTags(Value);
HTMLDecode(Value);
SetField(fieldDescription, Value);
end;
// Comentarios: Guionista, etc.
SetField(fieldComments, Comments);
end;
// Función para extraer datos de los tecnicos de la película
function GetPersonas(Pagina: string; Text: string): string;
var
Value, value2, Tmp, Persona, Cargo: string;
begin
// Vestuario
Value := TextBetween(Pagina, Text + '[/b][/url][/td][/tr][tr] [td]','[/table]');
if Value [/tr] 0 do
begin
Value2 := TextBefore(Value, #13#10, '');
Value := RemainingText;
Value2 := StringReplace(Value2, '(in alphabetical order)', '');
Value2 := StringReplace(Value2, 'director of photography', '');
Persona := TextBefore(Value2, '[/td]', '');
HTMLRemoveTags(Persona);
HTMLDecode(Persona);
Persona := Trim(Persona);
if Persona = '' then
continue;
Cargo := RemainingText;
HTMLRemoveTags(Cargo);
HTMLDecode(Cargo);
Cargo := Trim(Cargo);
if Pos('additional', Cargo) > 0 then continue;
if Pos('uncredited', Cargo) > 0 then continue;
if Pos('photography', Cargo) > 0 then continue;
if Pos('song', Cargo) > 0 then continue;
if Pos('theme', Cargo) > 0 then continue;
if Pos('music', Cargo) > 0 then continue;
if Pos('executive', Cargo) > 0 then continue;
if Pos('associate', Cargo) > 0 then continue;
if Pos('line', Cargo) > 0 then continue;
if Pos('co-', Cargo) > 0 then continue;
if Pos('video', Cargo) > 0 then continue;
if Tmp <then>0 then
begin
Delete(Value,n,1);
Insert(' y', Value,n);
end;
result := Value;
end;
// Funciones de traducción
function RenombraCategoria(Value: string): String;
begin
Value := StringReplace(Value,'Action','Acción');
Value := StringReplace(Value,'Adventure','Aventuras');
Value := StringReplace(Value,'Animation','Animación');
Value := StringReplace(Value,'Biography','Biografía');
Value := StringReplace(Value,'Comedy','Comedia');
Value := StringReplace(Value,'Crime','Policíaca');
Value := StringReplace(Value,'Documentary','Documental');
//Value := StringReplace(Value,'Drama','Drama');
Value := StringReplace(Value,'Family','Familiar');
Value := StringReplace(Value,'Fantasy','Fantástica');
Value := StringReplace(Value,'Film-Noir','Cine negro');
Value := StringReplace(Value,'Game-Show','Exhibición deportiva');
Value := StringReplace(Value,'History','Histórica');
Value := StringReplace(Value,'Horror','Terror');
Value := StringReplace(Value,'Music','Música');
//Value := StringReplace(Value,'Musical','Musical');
Value := StringReplace(Value,'Mystery','Misterio');
Value := StringReplace(Value,'News','Noticiario');
Value := StringReplace(Value,'Reality-TV','Reality-Show');
Value := StringReplace(Value,'Romance','Romántica');
Value := StringReplace(Value,'Sci-Fi','Ciencia ficción');
Value := StringReplace(Value,'Short','Cortometraje');
Value := StringReplace(Value,'Sport','Deportes');
Value := StringReplace(Value,'Talk-Show','Diálogos');
//Value := StringReplace(Value,'Thriller','Thriller');
Value := StringReplace(Value,'TWar','Bélica');
//Value := StringReplace(Value,'Western','Western');
result := Value;
end;
function RenombraMes(Value: string): String;
begin
Value := StringReplace(Value,'January','de enero de ');
Value := StringReplace(Value,'February','de febrero de');
Value := StringReplace(Value,'March','de marzo de');
Value := StringReplace(Value,'April','de abril de');
Value := StringReplace(Value,'May','de mayo de');
Value := StringReplace(Value,'June','de junio de');
Value := StringReplace(Value,'July','de julio de');
Value := StringReplace(Value,'August','de agosto de');
Value := StringReplace(Value,'September','de septiembre de');
Value := StringReplace(Value,'October','de octubre de');
Value := StringReplace(Value,'November','de noviembre de');
Value := StringReplace(Value,'December','de diciembre de');
result := Value;
end;
function RenombraPais(Value: string): String;
begin
Value := StringReplace(Value,'USA','Estados Unidos');
Value := StringReplace(Value,'Spain','España');
Value := StringReplace(Value,'Belgium','Bélgica');
Value := StringReplace(Value,'Brazil','Brasil');
Value := StringReplace(Value,'Croatia','Croacia');
Value := StringReplace(Value,'Czech Republic','República Checa');
Value := StringReplace(Value,'Czechoslovakia','Checoslovaquia');
Value := StringReplace(Value,'Denmark','Dinamarca');
Value := StringReplace(Value,'East Germany','Alemania del este');
Value := StringReplace(Value,'Egypt','Egipto');
Value := StringReplace(Value,'Finland','Finlandia');
Value := StringReplace(Value,'France','Francia');
Value := StringReplace(Value,'Germany','Alemania');
Value := StringReplace(Value,'Greece','Grecia');
Value := StringReplace(Value,'Hungary','Hungría');
Value := StringReplace(Value,'Ireland','Irlanda');
Value := StringReplace(Value,'Italy','Italia');
Value := StringReplace(Value,'Japan','Japón');
Value := StringReplace(Value,'Mexico','Méjico');
Value := StringReplace(Value,'Morocco','Marruecos');
Value := StringReplace(Value,'Netherlands','Holanda');
Value := StringReplace(Value,'New Zealand','Nueva Zelanda');
Value := StringReplace(Value,'Norway','Noruega');
Value := StringReplace(Value,'Philippines','Filipinas');
Value := StringReplace(Value,'Poland','Polonia');
Value := StringReplace(Value,'Romania','Rumanía');
Value := StringReplace(Value,'Russia','Rusia');
Value := StringReplace(Value,'South Korea','Corea del Sur');
Value := StringReplace(Value,'Soviet Union','URSS');
Value := StringReplace(Value,'Sweden','Suecia');
Value := StringReplace(Value,'Switzerland','Suiza');
Value := StringReplace(Value,'Turkey','Turquía');
Value := StringReplace(Value,'UK','Reino Unido');
Value := StringReplace(Value,'West Germany','Alemania occidental');
result := Value;
end;
function RenombraIdioma(Value: string): String;
begin
Value := StringReplace(Value,'Albanian','Albanés');
Value := StringReplace(Value,'Arabic','Árabe');
Value := StringReplace(Value,'Bulgarian','Búlgaro');
Value := StringReplace(Value,'Cantonese','Cantonés');
Value := StringReplace(Value,'Czech','Checo');
Value := StringReplace(Value,'Danish','Danés');
Value := StringReplace(Value,'Dutch','Holandés');
Value := StringReplace(Value,'English','Inglés');
Value := StringReplace(Value,'Finnish','Finlandés');
Value := StringReplace(Value,'French','Francés');
Value := StringReplace(Value,'Georgian','Georgiano');
Value := StringReplace(Value,'German','Alemán');
Value := StringReplace(Value,'Greek','Griego');
Value := StringReplace(Value,'Hebrew','Hebreo');
Value := StringReplace(Value,'Hungarian','Húngaro');
Value := StringReplace(Value,'Italian','Italiano');
Value := StringReplace(Value,'Japanese','Japonés');
Value := StringReplace(Value,'Korean','Coreano');
Value := StringReplace(Value,'Malayalam','Malayo');
Value := StringReplace(Value,'None','Muda');
Value := StringReplace(Value,'Norwegian','Noruego');
Value := StringReplace(Value,'Persian','Persa');
Value := StringReplace(Value,'Polish','Polaco');
Value := StringReplace(Value,'Portuguese','Portugués');
Value := StringReplace(Value,'Romanian','Rumano');
Value := StringReplace(Value,'Russian','Ruso');
Value := StringReplace(Value,'Serbo-Croatian','Servo-croata');
Value := StringReplace(Value,'Silent','Cine Mudo');
Value := StringReplace(Value,'Spanish','Castellano');
Value := StringReplace(Value,'Swedish','Sueco');
Value := StringReplace(Value,'Turkish','Turco');
result := Value;
end;
// Aquí empieza el espectáculo
begin
if (CheckVersion(3,5,0)=FALSe) then
begin
ShowMessage('Se requiere Ant Movie Catalog versión 3.5 o superior');
exit;
end;
MovieName := GetField(fieldTranslatedTitle);
if MovieName = '' then
MovieName := GetField(fieldOriginalTitle);
Input('Busqueda de creditos edn IMDB', 'Título de la pelicula', MovieName);
if (MovieName <> '') AND (BuscaPeliculas('http://us.imdb.com/find?more=tt;site=aka;q=%2B' +
StringReplace(UrlEncode(MovieName),'%20','%2B'))) then
exit;
MovieName := GetField(fieldOriginalTitle);
if (MovieName = '') OR (NOT BuscaPeliculas('http://us.imdb.com/find?more=tt;site=aka;q=%2B' +
StringReplace(UrlEncode(MovieName),'%20','%2B'))) then
ShowMessage('No se han encontrado resultados.');
end.
"Niten" escribió aquí: |
Exactamente no sé qué es lo que quieres hacer, pero si en el campo llamado Url pones el enlace ed2k, cuando pinches en ir a ese enlace la descarga pasa directamente al emule.alesves escribió:La base la tengo bastante avanzada pero cuando intento colocar los enlaces no se como hacerlo. No se si queda muy claro lo que intento hacer.
Fijate aquí: http://www.cineforum-clasico.org/archivo/viewt ... 6913#36913Zitor escribió:¿Alguien tiene un script para IMDb que funcione correctamente?
alesves escribió:Un buen programa es Antmovie.
¡Bienvenido Cuper! Fantástico primer post!!! ¡¡Y en el hilo correcto!!cuper escribió:Perdón no se si este hilo es el correcto, pero,¿ alguien conoce alguna version de este catalogador para linux?
Volver a Sobre Cine-Clasico.com
Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 1 invitado