Resource

Resource Basics

Resource Name List Confirmed Faces
Resource Version 1.0
Category Catalog
Downloads 533
Release Date 10/7/2024 9:00:26 PM
 

Resource Details

Description This script will dump all confirmed faces to a simple HTML table. The HTML is opened in a Web Browser where it can be printed etc.
Installation Instructions na
Usage Instructions 1. Download the script
2. Open the Scripter (Tools -> Scripter)
3. Run the script
Changes in this version na
Special Requirements
 

Author Information

Author Name IDimager
 

Script

var
  i: Integer;
  AAreas: TCatalogAreas;
  AArea: TCatalogArea;

  ACatItem: TCatalogItem;
  AProp: TCatalogItemProp;

  AHtml: TTntStringList;
  ASl: TTntStringList;
begin
  AAreas := TCatalogAreas.Create(TCatalogArea, '');
  PublicCatalog.EnumAllAreasWithFeatures(AAreas);

  AAreas.Disconnect;

  ASl := TTntStringList.Create;
  try
    // remove areas that are not "confirmed"
    for i := AAreas.Count - 1 downto 0 do
    begin
      AArea := AAreas.Items[i];
      if (not AArea.HasFaceFeatures) or (AArea.PropGUID = '') then
        AArea.Free;

      ACatItem := TCatalogItem.Create(nil);
      AProp := TCatalogItemProp.Create(nil);
      if PublicCatalog.FindItemCombinedByGUID(AArea.ItemGUID, ACatItem) then
      begin
        AArea.Name := ACatItem.FileName;
        if PublicCatalog.EnumProp(AArea.PropGUID, AProp, False) then
          ASl.AddObject(AProp.PropName + '.' + ACatItem.FileName, AArea);
      end;
      AProp.Free;
      ACatItem.Free;
    end;

    // sort the areas
    ASl.Sort;
    for i := 0 to ASl.Count - 1 do
    begin
      AArea := ASl.Objects[i];
      AArea.Index := i;
    end;
  finally
    ASl.Free;
  end;

  AHtml := TTntStringList.Create;

AHtml.Add('<html>');

AHtml.Add('<head>');

AHtml.Add('<style>');
AHtml.Add('body {font-family: helvetica; background-color: #000; color:#fff}');
AHtml.Add('.image   {background-color: #202020; text-align: center;}');
AHtml.Add('.name   {text-align: left; vertical-align: top;}');
AHtml.Add('.hierarchical   {text-align: left; vertical-align: top;}');
AHtml.Add('.faceimage   {max-width: 200px; max-height: 200px;}');

AHtml.Add('</style>');

AHtml.Add('</head>');

AHtml.Add('<body>');

  AHtml.Add('<h2>Confirmed Faces</h2>');

  AHtml.Add('<table>');

    AHtml.Add('<tr>');

    AHtml.Add('<th class="image">');
    AHtml.Add('Image');
    AHtml.Add('</th>');

    AHtml.Add('<th class="name">');
    AHtml.Add('Name');
    AHtml.Add('</th>');

    AHtml.Add('<th class="name">');
    AHtml.Add('File Name');
    AHtml.Add('</th>');

    AHtml.Add('</tr>');

  for i := 0 to AAreas.Count - 1 do
  begin
    AArea := AAreas.Items[i];

    AHtml.Add('<tr>');

    AHtml.Add('<td class="image">');
    AHtml.Add('<img class="faceimage" src="data:image/jpeg;base64,' + Base64EncodeStream(AArea.Image) + '">');
    AHtml.Add('</td>');

    AHtml.Add('<td class="name">');
    AHtml.Add(AArea.Caption);
    AHtml.Add('</td>');

    AHtml.Add('<td class="name">');
    AHtml.Add(AArea.Name);
    AHtml.Add('</td>');

    AHtml.Add('</tr>');
  end;
  AHtml.Add('</table>');

  AHtml.Add('</body>');
  AHtml.Add('</html>');

  AHtml.SaveToFile(WindowsTempDir + 'confirmed.htm');
  ShellDoExecute(0, WindowsTempDir + 'confirmed.htm');

  AHtml.Free;

  AAreas.Free;
end;