Resource

Resource Basics

Resource Name Sync Read Direct
Resource Version 1.1
Category Catalog
Downloads 2965
Release Date 12/24/2020 11:22:45 AM
 

Resource Details

Description This script will read metadata from file to catalog for selected thumbnails
Installation Instructions 1. Download the script file
Usage Instructions 1. Select one or more files
2. Open Scripter (Tools -> Scripter)
3. Load the downloaded script
4. Run the script
Changes in this version 1.1 Now supports V6.4
Special Requirements
 

Author Information

Author Name IDimager Support
 

Script

var
  AOffsetStart, AOffsetEnd, AStart, AEnd, ASum, AAvg: Cardinal;
  i: Integer;
  AImage: TImageItem;
  ACatItem: TCatalogItem;
  APro: TxomProgress;
begin
  if Selected.Count = 0 then
  begin
    Say('Please select at least 1 thumbnail');
    exit;
  end;

  APro := TxomProgress.Create(nil);
  try
    APro.Caption := 'Sync Read Direct';
    APro.Max := Selected.Count;

    AOffsetStart := GetTickCount;
    ASum := 0;
    for i := 0 to Selected.Count - 1 do
    begin
      AImage := Selected.Items[i];

      APro.Pos := i + 1;
      APro.ProgressText := AImage.FileNameOnly;

      AStart := GetTickCount;
      PublicCatalog.SynchronizeToImage(
        AImage,
        PublicOptions.XMPSyncReadSettings,
        PublicOptions.XMPSyncWriteSettings,
        False,
        False,
        scForcedRead
      );
      AEnd := GetTickCount;

      ASum := ASum + (AEnd - AStart);
    end;
    AOffsetEnd := GetTickCount;
  finally
    APro.Free;
  end;

  AAvg := ASum / Selected.Count;
  Say2(
        'Sync Read for ' + IntToStr(Selected.Count) + ' files',
        'Done in ' +
          FloatToStr(RoundToPrecision((AOffsetEnd - AOffsetStart) / 1000, 2)) + ' sec.' + CrLf +
        'Total time for sync is ' +
          FloatToStr(RoundToPrecision((ASum) / 1000, 2)) + ' sec. ' + CrLf +
        'Average per image is ' +
          FloatToStr(RoundToPrecision((AAvg) / 1000, 2)) + ' sec' + CrLf +
        '');
end;