Page 1 of 1

[REL] IMDB [ES] - Segunda versión

Posted: 2006-01-01 14:53:51
by gilistico
Se trata de uno de los scripts que más utilizo, pues lo empleo para incluir practicamente todos los datos de la película, salvo la sinopsis y las críticas que las dejo para otros scripts ya en lengua castellana.

La busqueda es muy diferente al script general para IMDB que anda por ahí; pues va más al grano y se busca por el titulo castellano de la película (tambien por el oficial, si este no produce resultados).

Se ha incluido toda aquella información que pueda ser interesante (se recorre unas cuantas páginas de IMDB en busca de información) y se ha adaptado al castellano y al modo de ser de los scripts (ES). Los creditos son bastante completos (incluyen los principales de cada categoría), se incluen los datos técnicos de la pelicula, fecha del primer estreno mundial y de su estreno en España, titulos alternativos, pagina web oficial, certificación española, lugares de rodaje, etc, etc.

Todo ello sin intentar agobiar con demasiada información; por ejemplo, si los lugares de rodaje son numerosos, la información de los mismos se reducen únicamente a los paises.

Ya contareis.

IMDB (ES).ifs

Esta es la segunda versión:

Code: Select all

(***************************************************

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, '<a href="', '">');
			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
	begin
		if Pos('/', Value) > 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 class="ch">Country:</b>', '<br>');
    	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 class="ch">Genre:</b>', '<br>');
    	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 class="ch">Runtime:</b>' + #13#10, ' ');
	if Value <> '' then
	begin
      		if Pos(':', Value) > 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></a>', '</table>');
    	if Value <> '' then
    	begin
		Value := StringReplace(Value, '</tr><tr>', #13#10);

		Tmp := '';
		While Pos(#13#10, Value)> 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></a>', '</table>');
    	if Value <> '' then
    	begin
		Value := StringReplace(Value, '</tr><tr>', #13#10);
		Value := StringReplace(Value, '</tr> <tr>', #13#10);
		Value := StringReplace(Value, 'verified as complete', '');
		Value := StringReplace(Value, 'complete, awaiting verification', '');
		Value := StringReplace(Value, '(in credits order)', '');
 		Value := StringReplace(Value, '(in alphabetical order)', '');

		Todo := Value;
		m   := 0;
		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 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;

	// Productor
	Item := GetPersonas(Pagina,'Produced by');
    	if Item <> '' then
      		Comments := Comments + 'Producción: ' + Item + #13#10;

	// Guionista
	Value := TextBetween(Pagina, 'Writing credits</b></a>', '</table>');
    	if Value <> '' then
    	begin
		Value := StringReplace(Value, '</tr><tr>', #13#10);

		Guion := '';
		novela:= '';
		Historia := '';

		Value := Value + #13#10;

		While Pos(#13#10, Value)> 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 
					Guion := Guion + ', ';
				Guion := Guion + Persona;
				continue;
			end


			if (Pos('screen story', Cargo) > 0) OR
			   (Pos('story', Cargo) > 0) then
			begin

				Cargo := trim(Cargo);

				if Historia <> '' then 
					Historia := Historia + ', '
				else    Historia := '(Historia de ';

				Historia := Historia + Persona;
				continue;
			end

			if (Pos('comic book', Cargo) > 0) OR
			   (Pos('graphic novels', Cargo) > 0) OR
			   (Pos('comic', Cargo) > 0) then
			begin

				Cargo := trim(Cargo);

				if Novela <> '' then 
					Novela := Novela + ', '
				else    Novela := '(Comic de ';

				Novela := Novela + Persona;
				continue;
			end

			if Pos('novels', Cargo) > 0 then
			begin

				Cargo := StringReplace(Cargo, 'novels', '');
				Cargo := trim(Cargo);

				if Novela <> '' then 
					Novela := Novela + ', ';

				if Cargo = '' then
					Novela := Novela + '(Novelas de ' + Persona + ')'
				else    Novela := Novela + '(Novelas "'+ Cargo + '" de ' + Persona + ')';
				continue;
			end;


			if (Pos('play', Cargo) > 0) OR
			   (Pos('novel', Cargo) > 0) then
			begin

				Cargo := StringReplace(Cargo, 'play', '');
				Cargo := StringReplace(Cargo, 'novel', '');
				Cargo := trim(Cargo);

				if Novela <> '' then 
					Novela := Novela + ', ';

				if Cargo = '' then
					Novela := Novela + '(Novela de ' + Persona + ')'
				else    Novela := Novela + '(Novela "'+ Cargo + '" de ' + Persona + ')';

			end

		end

		if Pos('Comic', Novela) > 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 + 'Musica: ' + Item + #13#10;

	// Fotografía
	Item := GetPersonas(Pagina,'Cinematography by');
    	if Item <> '' then
      		Comments := Comments + 'Fotografía: ' + Item + #13#10;

	// Diseño de producción:
	Item := GetPersonas(Pagina,'Production Design by');
    	if Item <> '' then
      		Comments := Comments + 'Diseño de producción: ' + Item + #13#10;

	// Dirección artística
	Item := GetPersonas(Pagina,'Art Direction by');
    	if Item <> '' then
      		Comments := Comments + 'Dirección artística: ' + Item + #13#10;

	// Vestuario
	Item := GetPersonas(Pagina,'Costume Design by');
    	if Item <> '' then
      		Comments := Comments + 'Vestuario: ' + Item + #13#10;

	// Montaje
	Item := GetPersonas(Pagina,'Film Editing by');
    	if Item <> '' then
      		Comments := Comments + 'Montaje: ' + Item + #13#10;


  	// Otros títulos
	Value := TextBetween(Pagina, '<b class="ch">Also Known As:</b><br>', '<br>' + #13#10 + '<b');
	if Value <> '' then
    	begin
    		Value := StringReplace(Value, ' <br>', ', ');
      		Value := StringReplace(Value,' ','');
      		HTMLRemoveTags(Value);
      		HTMLDecode(Value);
    		Value := StringReplace(Value, 'working', '');
    		Value := StringReplace(Value, 'alternative', '');
    		Value := StringReplace(Value, 'aspelling', '');
    		Value := StringReplace(Value, 'transliteration', '');
    		Value := StringReplace(Value, 'complete', '');
    		Value := StringReplace(Value, 'International', '');
    		Value := StringReplace(Value, 'English title', '');
    		Value := StringReplace(Value, 'title', '');
    		Value := StringReplace(Value, 'literal', '');
    		Value := StringReplace(Value, 'video', '');
    		Value := StringReplace(Value, ': )', ')');
    		Value := StringReplace(Value, '()', '');
    		Value := StringReplace(Value, '( )', '');

      		Comments := Comments + 'Otros títulos: ' + RenombraPais(Trim(Value)) + #13#10;
	end;	

	// Premios
	Value := TextBetween(Pagina, '<b class="ch">Awards:</b> ' + #13#10, '<');
	if Value <> '' then
	begin
      		HTMLDecode(Value);
      		HTMLRemoveTags(Value);
      		Value := StringReplace(Value,#13#10,' ');
      		Value := StringReplace(Value,'wins','primeros premios');
      		Value := StringReplace(Value,'win','primer premio');
      		Value := StringReplace(Value,'Won','1');
      		Value := StringReplace(Value,'Another','Otros');
     		Value := StringReplace(Value,'Nominated for','Nominada para');
      		Value := StringReplace(Value,'&','y');
      		Value := StringReplace(Value,'nominations','nominaciones');
      		Value := StringReplace(Value,'nomination','nominación');
       		Comments := Comments + 'Premios: ' + Value +#13#10;
	end;

	Comments := Comments + 'Rodaje: ';

  	//Lenguaje original
    	Value := TextBetween(Pagina, '<b class="ch">Language:</b>', '<br>');
    	if Value <> '' then
    	begin
    		HTMLRemoveTags(Value);
		HTMLDecode(Value);
		value := StringReplace(Value,#13#10,' ');
		value := StringReplace(Value,'/',',');
		Value := RenombraIdioma(Trim(Value));
		Comments := Comments +  Value;
	end;

  	//Color 
    	Value := TextBetween(Pagina, '<b class="ch">Color:</b>', '<br>');
    	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 class="ch">Sound Mix:</b>', '<br>');
    	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;

  	//Certificación
    	Value := TextBetween(Pagina, '<b class="ch">Certification:</b>', '<br>');
  	HTMLRemoveTags(Value);
	HTMLDecode(Value);
    	Value := TextBetween(Value, 'Spain:', '/');
    	if Value <> '' then
	begin
		if Pos('T', Value) > 0 then
			Comments := Comments + 'Apta para todos los publicos.'+ #13#10
		else    Comments := Comments + 'Apta para ' + trim(Value) + ' años'+ #13#10;
	end;


	// Aspectos técnicos
	Item := '';
	Address := 'http://imdb.com/title/tt' + MovieNumber + '/technical';
	Estrenos := GetPage(Address);
	Value := TextBetween(Estrenos, '<dl>','</dl>');
	if value <> '' then
	begin
		While Pos('</dd>', Value)> 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 <> '' then
	begin
		While Pos('</dd>', Value)> 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
			Comments := Comments + 'Localizaciones: ' + RenombraPais(Item) + #13#10;
	end;

	// Fechas de estreno
	Address := 'http://imdb.com/title/tt' + MovieNumber + '/releaseinfo';
	Estrenos := GetPage(Address);
	n    := 0;
	Item := '';
	Todo := '';
	While Pos('<tr><td>', Estrenos)> 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);

	// Página web oficial
	Address := 'http://imdb.com/title/tt' + MovieNumber + '/officialsites';
	Estrenos := GetPage(Address);
	Value := TextBetween(Estrenos, '<li>','</ol>');
	if value <> '' then
	begin
		Comments := Comments + 'Web oficial:' ;
		While Pos('</li>', Value)> 0 do
		begin
			Value2 := TextBefore(Value,'</li>', '');
			Value  := RemainingText;

			Tmp := TextBetween(Value2, 'a href="','"');

			if Pos('musictoslayby.com', Tmp) > 0 then 
				continue;
			if Pos('-lefilm.com', Tmp) > 0 then 
				continue;
			if Pos('simifilm.ch', Tmp) > 0 then 
				continue;
			if Pos('.filmz.ru', Tmp) > 0 then 
				continue;
			if Pos('.uip.es', Tmp) > 0 then 
				continue;
			if Pos('-film.de', Tmp) > 0 then 
				continue;
			Comments := Comments + ' '+ Tmp ;
		end;
	end;

	// 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">', '</p>');
		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></a></td></tr><tr> <td valign="top">','</table>');
    	if Value <> '' then
    	begin

		Value := StringReplace(Value, '</tr><tr>', #13#10);

		Tmp := '';
		While Pos(#13#10, Value)> 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 
				Tmp := Tmp + ', ';

      			Tmp := Tmp + Trim(Persona);
		end

      		HTMLRemoveTags(Tmp);
      		HTMLDecode(Tmp);
		Tmp := PonerY(Tmp);

      		result := Trim(Tmp);
   	end;

end;


function PonerY(Value: string): string;
var 
	n: Integer;
begin
	n:=LastPos(',',Value);
	if n>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','Historica');
	Value := StringReplace(Value,'Horror','Terror');
	Value := StringReplace(Value,'Music','Musica');
      //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','Dialogos');
      //Value := StringReplace(Value,'Thriller','Thriller');
	Value := StringReplace(Value,'TWar','Belica');
      //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,'Juny','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','Belgica');
	Value := StringReplace(Value,'Brazil','Brasil');
	Value := StringReplace(Value,'Croatia','Croacia');
	Value := StringReplace(Value,'Czech Republic','Republica 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','Mejico');
	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','Albanes');
      	Value := StringReplace(Value,'Arabic','Arabe');
      	Value := StringReplace(Value,'Bulgarian','Bulgaro');
      	Value := StringReplace(Value,'Cantonese','Cantones');
      	Value := StringReplace(Value,'Czech','Checo');
      	Value := StringReplace(Value,'Danish','Danes');
      	Value := StringReplace(Value,'Dutch','Holandes');
      	Value := StringReplace(Value,'English','Inglés');
      	Value := StringReplace(Value,'Finnish','Finlandes');
      	Value := StringReplace(Value,'French','Frances');
      	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','Portugues'); 
      	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,'Tagalog','Tagalo'); 
      	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.

Posted: 2006-01-01 15:29:14
by antp
What's the difference compared to original IMDB script? (I guess that it is explained, but I do not understand spanish :D)

Posted: 2009-10-17 09:16:26
by DaYoda
Gracias por tu aporte de IMBD.

Salu2.

Ahora me doy cuenta de la fecha este ya no va.