📄 jvqid3v2.pas
字号:
if (Pos('jpg', AClassName) > 0) or (Pos('jpeg', AClassName) > 0) then
Result := 'image/jpeg'
else
if (Pos('bmp', AClassName) > 0) or (Pos('bitmap', AClassName) > 0) then
Result := 'image/bitmap'
else
if (Pos('gif', AClassName) > 0) then
Result := 'image/gif'
else
Result := 'image/';
end;
//=== { TJvID3Images } =======================================================
constructor TJvID3Images.Create(AController: TJvID3Controller);
begin
inherited Create(AController);
FPictures := TJvID3Pictures.Create(AController);
FInfos := TJvID3PicturesDesc.Create(AController);
end;
destructor TJvID3Images.Destroy;
begin
FPictures.Free;
FInfos.Free;
inherited Destroy;
end;
//=== { TJvID3Ipl } ==========================================================
function TJvID3Ipl.GetItemCount: Integer;
var
Frame: TJvID3DoubleListFrame;
begin
if not FController.Active then
Result := 0
else
begin
Frame := TJvID3DoubleListFrame.Find(FController, fiInvolvedPeople);
if Assigned(Frame) then
Result := Frame.List.Count
else
Result := 0;
end;
end;
function TJvID3Ipl.GetJob: string;
var
Frame: TJvID3DoubleListFrame;
begin
if ItemIndex < 0 then
Result := ''
else
begin
Frame := TJvID3DoubleListFrame.Find(FController, fiInvolvedPeople);
if Assigned(Frame) and (ItemIndex < Frame.List.Count) then
Result := Frame.Values[ItemIndex]
else
Result := '';
end;
end;
function TJvID3Ipl.GetPerson: string;
var
Frame: TJvID3DoubleListFrame;
begin
if ItemIndex < 0 then
Result := ''
else
begin
Frame := TJvID3DoubleListFrame.Find(FController, fiInvolvedPeople);
if Assigned(Frame) and (ItemIndex < Frame.List.Count) then
Result := Frame.List.Names[ItemIndex]
else
Result := '';
end;
end;
procedure TJvID3Ipl.SetItemIndex(const Value: Integer);
begin
if Value <> FItemIndex then
begin
FItemIndex := Min(Value, ItemCount - 1);
end;
end;
procedure TJvID3Ipl.SetJob(const Value: string);
var
LPerson: string;
Frame: TJvID3DoubleListFrame;
begin
if FController.Active and (ItemIndex >= 0) then
begin
Frame := TJvID3DoubleListFrame.FindOrCreate(FController, fiInvolvedPeople);
if (0 <= ItemIndex) and (ItemIndex < Frame.List.Count) then
begin
LPerson := Frame.List.Names[ItemIndex];
Frame.List[ItemIndex] := Format('%s=%s', [LPerson, Value]);
end;
end;
end;
procedure TJvID3Ipl.SetPerson(const Value: string);
var
LJob: string;
Frame: TJvID3DoubleListFrame;
begin
if FController.Active and (ItemIndex >= 0) then
begin
Frame := TJvID3DoubleListFrame.FindOrCreate(FController, fiInvolvedPeople);
if (0 <= ItemIndex) and (ItemIndex < Frame.List.Count) then
begin
LJob := Frame.Values[ItemIndex];
Frame.List[ItemIndex] := Format('%s=%s', [Value, LJob]);
end;
end;
end;
//=== { TJvID3Owner } ========================================================
function TJvID3Owner.GetDatePurchased: TDateTime;
var
Frame: TJvID3OwnershipFrame;
begin
Frame := TJvID3OwnershipFrame.Find(FController);
if Assigned(Frame) then
Result := Frame.DateOfPurch
else
Result := 0;
end;
function TJvID3Owner.GetPrice: string;
var
Frame: TJvID3OwnershipFrame;
begin
Frame := TJvID3OwnershipFrame.Find(FController);
if Assigned(Frame) then
Result := Frame.PricePayed
else
Result := '';
end;
function TJvID3Owner.GetSeller: string;
var
Frame: TJvID3OwnershipFrame;
begin
Frame := TJvID3OwnershipFrame.Find(FController);
if Assigned(Frame) then
Result := Frame.Seller
else
Result := '';
end;
procedure TJvID3Owner.SetDatePurchased(const Value: TDateTime);
begin
if FController.Active then
TJvID3OwnershipFrame.FindOrCreate(FController).DateOfPurch := Value;
end;
procedure TJvID3Owner.SetPrice(const Value: string);
begin
if FController.Active then
TJvID3OwnershipFrame.FindOrCreate(FController).PricePayed := Value;
end;
procedure TJvID3Owner.SetSeller(const Value: string);
begin
if FController.Active then
TJvID3OwnershipFrame.FindOrCreate(FController).Seller := Value;
end;
//=== { TJvID3Persistent } ===================================================
constructor TJvID3Persistent.Create(AController: TJvID3Controller);
begin
inherited Create;
FController := AController;
end;
//=== { TJvID3Pictures } =====================================================
constructor TJvID3Pictures.Create(AController: TJvID3Controller);
var
Index: TJvID3PictureType;
begin
inherited Create(AController);
for Index := Low(TJvID3PictureType) to High(TJvID3PictureType) do
begin
FPictures[Index] := TPicture.Create;
FPictures[Index].OnChange := PictureChanged;
end;
end;
destructor TJvID3Pictures.Destroy;
var
Index: TJvID3PictureType;
begin
for Index := Low(TJvID3PictureType) to High(TJvID3PictureType) do
FPictures[Index].Free;
inherited Destroy;
end;
function TJvID3Pictures.GetPicture(const AType: Integer{TJvID3PictureType}): TPicture;
begin
Result := FPictures[TJvID3PictureType(AType)];
end;
procedure TJvID3Pictures.PictureChanged(Sender: TObject);
var
Index: TJvID3PictureType;
begin
if FUpdating then
Exit;
for Index := Low(TJvID3PictureType) to High(TJvID3PictureType) do
if FPictures[Index] = Sender then
begin
PictureToFrame(Index);
Exit;
end;
end;
procedure TJvID3Pictures.PictureToFrame(const AType: TJvID3PictureType);
var
Frame: TJvID3PictureFrame;
begin
if not FController.Active then
Exit;
Frame := TJvID3PictureFrame.FindOrCreate(FController, AType);
Frame.Assign(FPictures[AType]);
{ Borland has made it hard for us to determine the type of picture; let's
just look at the Picture.Graphic classname :) This is no way a reliable
method thus I don't recommend using TJvID3v2 for pictures }
Frame.MIMEType := ExtractMIMETypeFromClassName(FPictures[AType].Graphic.ClassName);
end;
procedure TJvID3Pictures.RemovePictures;
var
Index: TJvID3PictureType;
begin
FUpdating := True;
try
for Index := Low(TJvID3PictureType) to High(TJvID3PictureType) do
FPictures[Index].Assign(nil);
finally
FUpdating := False;
end;
end;
procedure TJvID3Pictures.RetrievePictures;
var
Frame: TJvID3PictureFrame;
Index: TJvID3PictureType;
begin
FUpdating := True;
try
for Index := Low(TJvID3PictureType) to High(TJvID3PictureType) do
begin
Frame := TJvID3PictureFrame.Find(FController, Index);
FPictures[Index].Assign(Frame);
end;
finally
FUpdating := False;
end;
end;
procedure TJvID3Pictures.SetPicture(const AType: Integer{TJvID3PictureType};
const Value: TPicture);
begin
FPictures[TJvID3PictureType(AType)].Assign(Value);
//ChangePicture(AType);
end;
//=== { TJvID3PicturesDesc } =================================================
function TJvID3PicturesDesc.GetText(const AType: Integer{TJvID3PictureType}): string;
var
Frame: TJvID3PictureFrame;
begin
Frame := TJvID3PictureFrame.Find(FController, TJvID3PictureType(AType));
if Assigned(Frame) then
Result := Frame.Description
else
Result := '';
end;
procedure TJvID3PicturesDesc.SetText(const AType: Integer{TJvID3PictureType};
const Value: string);
begin
if FController.Active then
TJvID3PictureFrame.FindOrCreate(FController, TJvID3PictureType(AType)).Description := Value;
end;
//=== { TJvID3Popularimeter } ================================================
function TJvID3Popularimeter.GetCounter: Cardinal;
var
Frame: TJvID3PopularimeterFrame;
begin
Frame := TJvID3PopularimeterFrame.Find(FController);
if Assigned(Frame) then
Result := Frame.Counter
else
Result := 0;
end;
function TJvID3Popularimeter.GetEMailAddress: string;
var
Frame: TJvID3PopularimeterFrame;
begin
Frame := TJvID3PopularimeterFrame.Find(FController);
if Assigned(Frame) then
Result := Frame.EMailAddress
else
Result := '';
end;
function TJvID3Popularimeter.GetRating: Byte;
var
Frame: TJvID3PopularimeterFrame;
begin
Frame := TJvID3PopularimeterFrame.Find(FController);
if Assigned(Frame) then
Result := Frame.Rating
else
Result := 0;
end;
procedure TJvID3Popularimeter.SetCounter(const Value: Cardinal);
begin
if FController.Active then
TJvID3PopularimeterFrame.FindOrCreate(FController).Counter := Value;
end;
procedure TJvID3Popularimeter.SetEMailAddress(const Value: string);
begin
if FController.Active then
TJvID3PopularimeterFrame.FindOrCreate(FController).EMailAddress := Value;
end;
procedure TJvID3Popularimeter.SetRating(const Value: Byte);
begin
if FController.Active then
TJvID3PopularimeterFrame.FindOrCreate(FController).Rating := Value;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -