Delphi, so if I made some terrible mistake, or didn't follow the standards please tell me so I can fix it. Also if there is a way to make this shorter, please let me know. Thanks)
Code: Select all
procedure AnalyzeMoviePage(Page: TStringList);
var
Line, Value, Value2, FullValue, fixtit: string;
LineNr, nActors, Desc, i: Integer;
BeginPos, EndPos: Integer;
Descriptions: TStringList;
begin
// Original Title & Year
LineNr := FindLine('<title>', Page, 0);
Line := Page.GetString(LineNr);
if LineNr > -1 then
begin
BeginPos := pos('<title>', Line);
if BeginPos > 0 then
BeginPos := BeginPos + 7;
EndPos := pos('(', Line);
if EndPos = 0 then
EndPos := Length(Line);
Value := copy(Line, BeginPos, EndPos - BeginPos - 1);
HTMLDecode(Value);
//following "if"s are to have the "fixed title", i.e.: to have "The Matrix" instead of "Matrix, The".
if pos(', The', Value) > 0 then
begin
fixtit := 'The ' + Copy(Value, 1, Length(Value) - 5);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', A', Value) > 0 then
begin
fixtit := 'A ' + Copy(Value, 1, Length(Value) - 3);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', An', Value) > 0 then
begin
fixtit := 'An ' + Copy(Value, 1, Length(Value) - 4);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', As', Value) > 0 then
begin
fixtit := 'As ' + Copy(Value, 1, Length(Value) - 4);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Ellos', Value) > 0 then
begin
fixtit := 'Ellos ' + Copy(Value, 1, Length(Value) - 7);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Ellas', Value) > 0 then
begin
fixtit := 'Ellas ' + Copy(Value, 1, Length(Value) - 7);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', El', Value) > 0 then
begin
fixtit := 'El ' + Copy(Value, 1, Length(Value) - 4);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Los', Value) > 0 then
begin
fixtit := 'Los ' + Copy(Value, 1, Length(Value) - 5);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Las', Value) > 0 then
begin
fixtit := 'Las ' + Copy(Value, 1, Length(Value) - 5);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', La', Value) > 0 then
begin
fixtit := 'La ' + Copy(Value, 1, Length(Value) - 4);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Lo', Value) > 0 then
begin
fixtit := 'Lo ' + Copy(Value, 1, Length(Value) - 4);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Unos', Value) > 0 then
begin
fixtit := 'Unos ' + Copy(Value, 1, Length(Value) - 6);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Unas', Value) > 0 then
begin
fixtit := 'Unas ' + Copy(Value, 1, Length(Value) - 6);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Uno', Value) > 0 then
begin
fixtit := 'Uno ' + Copy(Value, 1, Length(Value) - 5);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Una', Value) > 0 then
begin
fixtit := 'Una ' + Copy(Value, 1, Length(Value) - 5);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Un', Value) > 0 then
begin
fixtit := 'Un ' + Copy(Value, 1, Length(Value) - 4);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Les', Value) > 0 then
begin
fixtit := 'Les ' + Copy(Value, 1, Length(Value) - 5);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Le', Value) > 0 then
begin
fixtit := 'Le ' + Copy(Value, 1, Length(Value) - 4);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', L''', Value) > 0 then
begin
fixtit := 'L''' + Copy(Value, 1, Length(Value) - 4);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Os', Value) > 0 then
begin
fixtit := 'Os ' + Copy(Value, 1, Length(Value) - 4);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', O', Value) > 0 then
begin
fixtit := 'O ' + Copy(Value, 1, Length(Value) - 3);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Il', Value) > 0 then
begin
fixtit := 'Il ' + Copy(Value, 1, Length(Value) - 4);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', I', Value) > 0 then
begin
fixtit := 'I ' + Copy(Value, 1, Length(Value) - 3);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Des', Value) > 0 then
begin
fixtit := 'Des ' + Copy(Value, 1, Length(Value) - 5);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Der', Value) > 0 then
begin
fixtit := 'Der ' + Copy(Value, 1, Length(Value) - 5);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Das', Value) > 0 then
begin
fixtit := 'Das ' + Copy(Value, 1, Length(Value) - 5);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Die', Value) > 0 then
begin
fixtit := 'Die ' + Copy(Value, 1, Length(Value) - 5);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Den', Value) > 0 then
begin
fixtit := 'Den ' + Copy(Value, 1, Length(Value) - 5);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Dem', Value) > 0 then
begin
fixtit := 'Dem ' + Copy(Value, 1, Length(Value) - 5);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Einen', Value) > 0 then
begin
fixtit := 'Einen ' + Copy(Value, 1, Length(Value) - 7);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Einem', Value) > 0 then
begin
fixtit := 'Einem ' + Copy(Value, 1, Length(Value) - 7);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Einer', Value) > 0 then
begin
fixtit := 'Einer ' + Copy(Value, 1, Length(Value) - 7);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Eines', Value) > 0 then
begin
fixtit := 'Eines ' + Copy(Value, 1, Length(Value) - 7);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Eine', Value) > 0 then
begin
fixtit := 'Eine ' + Copy(Value, 1, Length(Value) - 6);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Ein', Value) > 0 then
begin
fixtit := 'Ein ' + Copy(Value, 1, Length(Value) - 5);
SetField(fieldOriginalTitle, fixtit);
end else
if pos(', Gli', Value) > 0 then
begin
fixtit := 'Gli ' + Copy(Value, 1, Length(Value) - 5);
SetField(fieldOriginalTitle, fixtit);
end else
SetField(fieldOriginalTitle, Value);
BeginPos := pos('(', Line) + 1;
if BeginPos > 0 then
begin
EndPos := pos(')', Line);
Value := copy(Line, BeginPos, EndPos - BeginPos);
SetField(fieldYear, Value);
end;
end;
he used, to have the most complete and universal list as possible. If there is someone wrong, or there are other words that imdb puts at the end, please let me know.
Edited: Fixed the extraspace in: fixtit := 'L'' ' + Copy(Value, 1, Length(Value) - 4);