The interface (and implementation) has changed in v3.1. IPlaylistItem.GetPicture and the IPlaylistItemPicture interface have been discontinued in favor of the following three new methods in IPlaylistItem:
function GetIconFilename: string;
procedure SetIconFilename(iValue: string);
function GetIconData: IInlineData;
The IInlineData interface looks like this:
IInlineData = interface(IUpdateObject) ['{E054EA6F-161B-44BC-BD85-A52E9C7EB6B9}']
procedure Assign(iValue: IInlineData);
procedure Clear;
function HasData: boolean;
function GetBase64String: string;
procedure SetBase64String(iValue: string);
procedure WriteToStream(iStream: TStream);
procedure LoadFromFile(iFilename: string);
end;
Like before, you can either use a reference to an external icon by specifying its filename, or store the icon as inline data. In the latter case, you will also have to specify the original filename (possibly without a path) so that mAirList knows what file format the icon is in.
To store the icon as a reference to an external file, set the icon file name to the (full) path of the icon, and clear the inline data:
PlaylistItem.SetIconFilename('c:\wherever\icon.png');
PlaylistItem.GetIconData.Clear;
To store the icon as inline data inside the playlist item (MMD etc.), load the inline data from the particular file, and also set the file name so that mAirList
PlaylistItem.GetIconData.LoadFromFile('c:\wherever\icon.png');
PlaylistItem.SetIconFilename('icon.png');
In eitehr case, it’s a good idea to wrap the calls in BeginUpdate…EndUpdate (and also try…finally) statements in order to set both fields virtually at the same time to prevent the playlist GUI from seeing inconsistent data in between the two calls (data does not match filename etc.):
PlaylistItem.BeginUpdate;
try
PlaylistItem.SetIconFilename('c:\wherever\icon.png');
PlaylistItem.GetIconData.Clear;
finally
PlaylistItem.EndUpdate;
end;
I shall update the .chm file soon, but I need to install the relevant tools on my new development PC first.