import { ByteVector } from "../../byteVector"; import { Frame, FrameClassType } from "./frame"; import { Id3v2FrameHeader } from "./frameHeader"; /** * This class extends {@link Frame} implementing support for ID3v2 popularimeter (POPM) frames. */ export default class PopularimeterFrame extends Frame { private _playCount; private _rating; private _user; private constructor(); /** * Constructs and initializes a new instance 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): PopularimeterFrame; /** * Constructs and initializes a new instance 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 */ static fromRawData(data: ByteVector, version: number): PopularimeterFrame; /** * Constructs and initializes a new instance for a specified user with a rating and play count * of zero. * @param user Email of the user that gave the rating */ static fromUser(user: string): PopularimeterFrame; /** @inheritDoc */ get frameClassType(): FrameClassType; /** * Gets the play count of the current instance */ get playCount(): bigint; /** * Sets the play count of the current instance * @param value Play count of the current instance */ set playCount(value: bigint); /** * Gets the rating of the current instance */ get rating(): number; /** * Sets the rating of the current instance * @param value Rating of the current instance, must be an 8-bit unsigned integer. */ set rating(value: number); /** * Gets the email address of the user to whom the current instance belongs */ get user(): string; /** * Sets the email address of the user to whom the current instance belongs * @param value */ set user(value: string); /** * Gets a popularimeter frame from a specified tag that matches the given parameters * @param frames List of frames to search * @param user User email to use to match the frame in the `tag` * @returns Frame containing the matching user or `undefined` if a match was not found */ static find(frames: PopularimeterFrame[], user: string): PopularimeterFrame; /** @inheritDoc */ clone(): Frame; /** @inheritDoc */ protected parseFields(data: ByteVector): void; /** @inheritDoc */ protected renderFields(): ByteVector; }