import { ByteVector, StringType } from "../../byteVector"; import { Frame, FrameClassType } from "./frame"; import { Id3v2FrameHeader } from "./frameHeader"; /** * Class that extends {@link Frame}, implementing support for ID3v2 Comments (COMM) frames. * A {@link CommentsFrame} should be used for storing user readable comments on the media file. * When reading comments from a file, {@link CommentsFrame.findPreferred} should be used as it * gracefully falls back to comments that you, as a developer, may not be expecting. */ export default class CommentsFrame extends Frame { private _description; private _language; private _text; private _textEncoding; private constructor(); /** * Constructs and initializes a new CommentsFrame from a description * @param description Description of the new frame * @param language Optional, ISO-639-2 language code for the new frame * @param encoding Optional, text encoding to use when rendering the new frame */ static fromDescription(description: string, language?: string, encoding?: StringType): CommentsFrame; /** * Constructs and initializes a new CommentsFrame by reading its raw data in a specified ID3v2 * version. This method allows for offset reading from the data byte vector. * @param data Raw representation of the new frame * @param offset What offset in `data` the frame actually begins. Must be positive, * safe integer * @param header Header of the frame found at `data` in the data * @param version ID3v2 version the frame was originally encoded with */ static fromOffsetRawData(data: ByteVector, offset: number, header: Id3v2FrameHeader, version: number): CommentsFrame; /** * Constructs and initializes a new CommentsFrame by reading its raw data in a specified * ID3v2 version. * @param data Raw representation of the new frame * @param version ID3v2 version the raw frame is encoded with, must be a positive 8-bit integer * @param version ID3v2 version the frame was originally encoded with */ static fromRawData(data: ByteVector, version: number): CommentsFrame; /** @inheritDoc */ get frameClassType(): FrameClassType; /** * Gets the description stored in the current instance, or empty string if not set. */ get description(): string; /** * Sets the description stored in the current instance. * There should only be one frame with a matching description and ISO-639-2 language code per * tag. * @param value Description of the instance */ set description(value: string); /** * Gets the ISO-639-2 language code stored in the current instance or 'XXX' if not set */ get language(): string; /** * Sets the ISO-639-2 language code stored in the current instance * @param value Language code to store */ set language(value: string); /** * Gets the comment text stored in the current instance, or empty string if not set. */ get text(): string; /** * Sets the comment text stored in the current instance. * @param value Comment text to store */ set text(value: string); /** * Gets the text encoding to use when storing the current instance. */ get textEncoding(): StringType; /** * Sets the text encoding to use when storing the current instance. * @param value Text encoding to use when storing the current instance */ set textEncoding(value: StringType); /** * Gets a comment frame that matched the provided parameters from the list of frames * @param frames Frames to search for best matching frame * @param description Description of the comments frame to match * @param language Optional, ISO-639-2 language code to match * @returns Object containing the matching frame or `undefined` if a match was not found */ static find(frames: CommentsFrame[], description: string, language?: string): CommentsFrame; /** * Gets all comment frames that match the provided parameters from the list of frames * @param frames Frames to search * @param description Description of the comments frame to match * @param language Optional, ISO-639-2 language code to match * @returns * Array of comments frames that match the provided parameters or an * empty array if none were found */ static findAll(frames: CommentsFrame[], description: string, language?: string): CommentsFrame[]; /** * Gets a specified comments frame from the specified tag, trying to match the description and * language but accepting an incomplete match. * The method tries matching with the following order of precedence: * * The first frame with a matching description and language * * The first frame with a matching language * * The first frame with a matching description * * The first frame * @param frames Frames to search for best matching frame * @param description Description to match * @param language ISO-639-2 language code to match */ static findPreferred(frames: CommentsFrame[], description: string, language?: string): CommentsFrame; /** @inheritDoc */ clone(): Frame; /** * Gets a string representation of the current instance. * @returns String with the comment text */ toString(): string; protected parseFields(data: ByteVector): void; protected renderFields(version: number): ByteVector; }