Example of use WmsCreateMediaItemTags and TWmsScriptFileTags
Posted: Mon May 07, 2012 5:36 pm
				
				Required version 1.51
These function and the class may be useful for reading tags of files, that the program does not handle by default (for example in the event "After reading of properties of a media resource").
Example simply display the tags of current media-resource in the List [Movies, Music, Photo]
Settings - Processing - Add
Name: Display Tags
Check "Button on the main form"
Script:
Ok - Ok
Select a media-resource - click "Display Tags" - specify a provider name - Ok
			These function and the class may be useful for reading tags of files, that the program does not handle by default (for example in the event "After reading of properties of a media resource").
Example simply display the tags of current media-resource in the List [Movies, Music, Photo]
Settings - Processing - Add
Name: Display Tags
Check "Button on the main form"
Script:
Code: Select all
var
  FileTags: TWmsScriptFileTags;
  TextTags: TStringList;  
  i: Integer;  
  sProviderName, sValue: string;    
begin
  if InputQuery('Provider Name', 'Exif, FFmpeg, MediaInfo, Shell, Wms, Xmp', sProviderName) then begin
    FileTags := WmsCreateMediaItemTags(sProviderName, WmsCurrentMediaListItem);
    if FileTags <> nil then try
      TextTags := TStringList.Create;
      try           
        for i := 0 to FileTags.GetTagCount - 1 do begin
          sValue := VarToStr(FileTags.GetTagValue(FileTags.GetTagID(i)));
          if (sValue <> '') and (Length(sValue) < 100) then  
            TextTags.Add(Format('%s (%s): %s', [FileTags.GetTagName(i), FileTags.GetTagID(i), sValue]));
        end;      
        ShowMessage(TextTags.Text)
      finally
        TextTags.Free
      end                  
    finally  
      FileTags.Free
    end
  end     
end.
Select a media-resource - click "Display Tags" - specify a provider name - Ok