unit XSPF;
interface
uses
SysUtils, Classes;
type
TOptions =
set of (opAllowUrls, opAllowRelativePaths, opAllowLocalFiles);
type
TTrack =
record
Location:
String;
//filename (also relative) or url, see TOptions
Identifier:
String;
//file hash, etc...
Title:
String;
Creator:
String;
//artist
Annotation:
String;
//comment
Info:
String;
//homepage for more informations
Image:
String;
//e. g. a cover. URL or filename required
Album:
String;
TrackNum: Integer;
//track number/position in the playlist or on the cd
Duration: Integer;
//length in miliseconds
end;
TTrackCollection =
Array of TTrack;
type
TTracks =
class(TComponent)
public
function Add(Track: TTrack):Integer;
end;
type
TXSPF =
class(TComponent)
private
FOptions: TOptions;
FFilename:
String;
FTracks: TTracks;
protected
FTrackCollection: TTrackCollection;
public
property Tracks: TTracks
read FTracks;
published
constructor Create(AOwner: TComponent);
override;
property Options: TOptions
read FOptions
write FOptions;
property Filename:
String read FFilename
write FFilename;
end;
procedure Register;
implementation
{$R 'TXSPF.dcr'}
procedure Register;
begin
RegisterComponents('
CapSystems', [TXSPF]);
end;
constructor TXSPF.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FOptions := [opAllowUrls, opAllowRelativePaths, opAllowLocalFiles];
FFilename := '
';
SetLength(FTrackCollection, 0);
end;
function TTracks.Add(Track: TTrack):Integer;
begin
if Length(FTrackCollection) <> 0
then
begin
SetLength(FTrackCollection, Length(FTrackCollection) + 1);
end;
FTrackCollection[Length(FTrackCollection)] := Track;
Result := Length(FTrackCollection);
end;
end.