I use the following code in the Import Awards section. It worked for 3.86 as well. If you don't want to pick only Selected awards as per the code, delete the If clause after " // Only Pick Selected Awards".
Code: Select all
// Import awards
procedure ImportAwards;
var
IndexPage: TStringList;
PageText, FullValue, Block, Value, Row, Outcome, Details, AwardShow, PageText1: string;
Year, Result, Award, Category: string;
begin
sleep(50);
Value := MovieUrl;
PageText := ConvertToASCII(GetPage(Value+'/awards'));
repeat
AwardShow := TextBetween(PageText, '<h3>', '</h3>');
if Pos('User Lists', AwardShow) > 0 then
break;
HTMLRemoveTags(AwardShow);
// HTMLDecode(AwardShow);
AwardShow := UTF8Decode(AwardShow);
AwardShow := FullTrim(AwardShow);
AwardShow := StringReplace(AwardShow, #13, '');
AwardShow := StringReplace(AwardShow, #10, '');
PageText1 := TextBetween(PageText, '<table class="awards"', '</table>');
PageText := RemainingText;
Block := PageText1;
// Begin of Mod Oscar+
// Only Pick Selected Awards
if (AnsiPosEx('Academy Awards, USA', AwardShow, true, true) > 0) or
(AnsiPosEx('BAFTA Awards', AwardShow, true, true) > 0) or
(AnsiPosEx('Cannes Film Festival', AwardShow, true, true) > 0) or
(AnsiPosEx('César Awards, France', AwardShow, true, true) > 0) or
(AnsiPosEx('Golden Globes, USA', AwardShow, true, true) > 0) or
(AnsiPosEx('Razzie Awards', AwardShow, true, true) > 0) then
begin
// End of Mod Oscar+
// Begin of Mod Oscar+++
// FullValue := FullValue + #32 + AwardShow + #13#10;
FullValue := FullValue + #13#10 + '- ' + AwardShow;
// End of Mod Oscar+++
repeat
Row := TextBetween(Block, '<tr>', '</tr>');
Block := RemainingText;
Row := UTF8Decode(Row);
Outcome := TextBetween(Row, '<b>', '</b>');
Category := TextBetween(Row, '<span class="award_category">', '</span>');
Award := TextBetween(Row, '<td class="award_description">', '</td>');
Details := TextBetween(Row, '<div class="award_detail_notes">', '</div>');
If Outcome <> '' then
// Begin of Mod Oscar+++
// FullValue := FullValue + #32 + Outcome + #13#10;
// End of Mod Oscar+++
If Category <> '' then
// Begin of Mod Oscar+++
// FullValue := FullValue + #32 + Category;
FullValue := FullValue + #13#10 + ' ' + Year + '' + Outcome + ' "' + Category + '"';
// End of Mod Oscar+++
If Award <> '' then
begin
// Begin of Mod Oscar++++
// Award := StringReplace(Award, '<br />', #32);
Award := StringReplace2(Award, '<br />', ': ', true, false);
Award := StringReplace(Award, '</a>', '</a>, ');
// End of Mod Oscar++++
HTMLRemoveTags(Award);
HTMLDecode(Award);
Award := StringReplace(Award, #13, '');
Award := StringReplace(Award, #10, '');
Award := FullTrim(Award);
Award := StringReplace(Award, ' ', '');
// Begin of Mod Oscar+++
// FullValue := FullValue + #32 + Award;
if Award <> '' then
begin
if StrGet(Award, Length(Award)) = ':' then
begin
Delete(Award, Length(Award), 1);
Award := FullTrim(Award);
end;
end;
if Award <> '' then
begin
if StrGet(Award, Length(Award)) = ',' then
begin
Delete(Award, Length(Award), 1);
Award := FullTrim(Award);
end;
end;
FullValue := FullValue + #13#10 + ' ' + Award;
FullValue := StringReplace(FullValue, ', :', ':');
FullValue := StringReplace(FullValue, ', (', ' (');
FullValue := StringReplace(FullValue, ',(', '(');
// End of Mod Oscar+++
end;
// If Details <> '' then
// begin
// HTMLRemoveTags(Details);
// HTMLDecode(Details);
// Award := StringReplace(Details, #13, '');
// Award := StringReplace(Details, #10, '');
// Award := FullTrim(Details);
// FullValue := FullValue + #32 + Details + #13#10;
// end;
until (Row = '');
end;
until (PageText1 = '');
// ShowInformation(FullValue);
if FullValue <> '' then
case GetOption('Awards') of
1:
begin
if GetField(fieldDescription) <> '' then
Value := GetField(fieldDescription) + #13#10 + #13#10 + 'AWARDS: ' + #13#10 + FullValue
else
Value := 'AWARDS: ' + FullValue;
SetField(fieldDescription, Value);
end;
2:
begin
if GetField(fieldComments) <> '' then
Value := GetField(fieldComments) + #13#10 + #13#10 + 'AWARDS: ' + #13#10 + FullValue
else
Value := 'AWARDS: ' + FullValue;
SetField(fieldComments, Value);
end;
end;
end;