Que lenguaje elijo para un proyectiyo Hola buenas, alguien me podria decir q lenguaje de programacion usar y orientarme un poco en este proyecto q stoy aciendo? Tengo montado en casa un servidor (S.O. Debian) con mi biblioteca de peliculas para la red local. De momento uso un programa en windows "Ant movie catalog" que ejecuta un script que recoge la informacion de paginas web de cine y las guarda en un archivo propio, luego me da la posibilidad de exportar a archivo sql para insertar los datos en la tabla de mysql y con lo que he podido aprender d php las presento en una pagina web. Pero ya me he cansado y quiero automatizar el proceso de (detectar nuevas pelis en el servidor > buscar informacion en internet > insertar campos en mysql).
Pues eso, por donde empiezo?
El script del programa es de licencia abierta os paso un trozo aver si me podeis decir que lenguaje es, si lo puedo reaprovechar o si vale mas la pena empezar de cero
Muchas gracias
Código:
program FilmAffinity;
uses
StringUtils1;
const
BaseURL1 = 'http://www.filmaffinity.com';
CoverURL = 'http://www.caratulas.info/';
CoverURL1 = 'www.caratulas.info';
var
MovieName: string;
function TextBetweenOLD(var S: string; StartTag: string; EndTag: string): string;
var
InitialPos: Integer;
begin
InitialPos := Pos(StartTag, S);
if InitialPos = 0 then
result := ''
else
begin
Delete(S, 1, InitialPos + Length(StartTag) - 1);
InitialPos := Pos(EndTag, S);
if InitialPos = 0 then
result := S
else
begin
result := Copy(S, 1, InitialPos - 1);
Delete(S, 1, InitialPos + 1);
end;
end;
end;
//------------------------------------------------------------------------------------
procedure AnalyzeCoversPage(Address: string; var CoverAdress: string);
var
strPage, MovieAddr, MovieTitle, MovieID: string;
BeginPos, EndPos, ContadorPrimeras: Integer;
Page: TStringList;
begin
strPage := GetPage(Address);
BeginPos := Pos('en el dominio <b>' + CoverURL1, strPage);
if BeginPos < 1 then
begin
SetField(fieldChecked, '');
if GetOption('AutoSelect') = 1 then exit;
ShowError('No se han encontrado resultados para ' + UpperCase(MovieName))
Page.Free
exit;
end
else
PickTreeClear;
PickTreeAdd('Carátulas de DVD para ' + UpperCase(MovieName), '');
Delete(strPage, 1, BeginPos);
BeginPos := Pos('href="' + CoverURL, strPage);
EndPos := 1;
while ((BeginPos > 0) and (EndPos > 0)) do
begin
Delete(strPage, 1, BeginPos);
EndPos := Pos('" onmousedown', strPage);
MovieId := Copy(strPage, + 32, EndPos - 32);
MovieAddr := CoverURL + MovieId;
BeginPos := Pos('.info/',strPage);
EndPos := Pos('.htm"', strPage);
MovieTitle := Copy(strPage, BeginPos, EndPos);
MovieTitle := TextBetweenOLD (MovieTitle , '.info/', 'jpg');
//FBrowser := TBrowser(RCaseOf(RequestHeader['HTTP_USER_AGENT'], ['MSIE', 'Firefox', 'Chrome', 'Safari', 'Opera', 'Konqueror'])+1);
MovieTitle := StringReplace(MovieTitle , 'musica/', '(MUSICA) ');
MovieTitle := StringReplace(MovieTitle , 'juegos/', '(JUEGOS) ');
MovieTitle := StringReplace(MovieTitle , '-', ' ' );
MovieTitle := StringReplace(MovieTitle , 'DVD', '(DVD)' );
MovieTitle := StringReplace(MovieTitle , 'Pc', '(PC)' );
MovieTitle := StringReplace(MovieTitle , 'Vcd', '(VCD)' );
MovieTitle := StringReplace(MovieTitle , 'Trasera', '(Trasera)' );
MovieTitle := StringReplace(MovieTitle , 'cd ', '(CD)' );
MovieTitle := StringReplace(MovieTitle , '/', '' );
MovieTitle := StringReplace(MovieTitle , 'Delantera', '(Delantera)' );
MovieTitle := StringReplace(MovieTitle , 'peliculas', '' );
MovieTitle := StringReplace(MovieTitle , 'Frontal', '(Frontal)' );
MovieTitle := StringReplace(MovieTitle , 'PS2', '(PS2)' );
MovieTitle := StringReplace(MovieTitle , 'Bso', '' );
MovieTitle := StringReplace(MovieTitle , 'The Album Del', '' );
MovieTitle := StringReplace(MovieTitle , 'Divx', '(DIVX)' );
MovieTitle := StringReplace(MovieTitle , 'BSO', '' );
MovieTitle := StringReplace(MovieTitle , 'B S O', '' );
MovieTitle := StringReplace(MovieTitle , 'Inlay', '(Interior)' );
MovieTitle := StringReplace(MovieTitle , 'Slim', '(Slim)' );
ContadorPrimeras:= ContadorPrimeras + 1;
if (Pos('(DVD)', MovieTitle) > 0) And (Pos('(Frontal)', MovieTitle) > 0) And (GetOption('AutoSelect') = 1) And (ContadorPrimeras < 8) then
begin
AnalyzeCoverPage(MovieAddr, CoverAdress);
exit;
end
else
begin
PickTreeAdd(MovieTitle, MovieAddr);
BeginPos := Pos('href="' + CoverURL, strPage);
if(Pos('</body>', strPage) < BeginPos) then
BeginPos := -1;
end;
end;
if PickTreeExec(Address) then
AnalyzeCoverPage(Address, CoverAdress);
end;
//------------------------------------------------------------------------------------
procedure AnalyzeCoverPage(Address: string; var CoverAdress: string);
var
Page: TStringList;
LineNr: Integer;
Item: string;
begin
CoverAdress:= Address + #13#10;
// SetField(fieldURL, Address);
Page := TStringList.Create;
Page.Text := GetPage(Address);
// Picture
LineNr := FindLine('<p><img src="/', Page, 0);
if LineNr <> -1 then
begin
Item := copy(Page.Text, pos('<p><img src="/',Page.Text), length(Page.Text));
Item := TextBetweenOLD (Item, 'src="/', '"');
Item := Trim(Item );
GetPicture (CoverURL + Item);
end;
end;
procedure AnalyzePage(Address: string);
var
Page: TStringList;
LineNr: Integer;
Line,Line2: string;
MovieTitle, MovieAddress: string;
begin
Page := TStringList.Create;
Page.Text := GetPage(Address);
PickTreeClear;
PickTreeAdd('Resultados en Filmaffinity para ' + UpperCase(MovieName), '');
// un solo resultado
LineNr := FindLine('<strong>1</strong> resultados.</div>', Page, 0);
if LineNr <> -1 then
begin
LineNr := FindLine('<b><a href="', Page, LineNr);
if LineNr <> -1 then
begin
Line := Page.GetString(LineNr);
Line2 := Line;
MovieAddress := TextBetweenOLD(Line, '<b><a href="', '">');
MovieTitle := Trim(TextBetweenOLD(Line2, '.html">', '<img src="'));
HTMLDecode(MovieTitle);
HTMLRemoveTags(MovieTitle);
if (MovieAddress <> '') AND (MovieTitle <> '') then
begin
MovieAddress := BaseURL1 + MovieAddress;
PickTreeAdd(MovieTitle, MovieAddress);
if GetOption('AutoSelect') = 0 then
if PickTreeExec(MovieAddress) then
AnalyzeMoviePage(MovieAddress);
if GetOption('AutoSelect') = 1 then
AnalyzeMoviePage(MovieAddress);
end
Page.Free;
exit;
end;
end;
Si lo quereis entero ya os lo paso |