import { ByteVector } from "../byteVector"; import { File } from "../file"; import { Tag, TagTypes } from "../tag"; /** * Extends {@link Tag} to provide support for reading and writing tags stored in the ID3v1.1 format. */ export default class Id3v1Tag extends Tag { private static readonly COMMENT_LENGTH; private static readonly TITLE_ARTIST_ALBUM_LENGTH; private static readonly YEAR_LENGTH; /** * Identifier used to recognize an ID3v1 tag. */ static readonly FILE_IDENTIFIER: ByteVector; /** * Size of an ID3v1 tag. */ static readonly TOTAL_SIZE = 128; private _album; private _artist; private _comment; private _genre; private _title; private _track; private _year; private constructor(); /** * Constructs and initializes a new instance of {@link Id3v1Tag} with no contents. */ static fromEmpty(): Id3v1Tag; /** * Constructs and initializes a new instance from the provided data. * @param data Raw data for the ID3v1 tag */ static fromData(data: ByteVector): Id3v1Tag; /** * Constructs and initializes a new instance by reading from a position in a file. * @param file File to read the tag from * @param position Offset into the file where the tag begins */ static fromFile(file: File, position: number): Id3v1Tag; /** * Renders the current instance as a raw ID3v1 tag. */ render(): ByteVector; /** @inheritDoc */ get tagTypes(): TagTypes; /** @inheritDoc */ get sizeOnDisk(): number; /** @inheritDoc */ get title(): string; /** * @inheritDoc * @remarks * When stored on disk, only the first 30 bytes of the latin-1 encoded value will * be stored. This may result in lost data. */ set title(value: string); /** @inheritDoc */ get performers(): string[]; /** * @inheritDoc * @remarks * When stored on disk, only the first 30 bytes of the latin-1 encoded value will * be stored, minus a byte for each additional performer (ie, two performers will only have * 29 bytes and three performers will only have 28 bytes). This may result in data loss. */ set performers(value: string[]); /** @inheritDoc */ get album(): string; /** * @inheritDoc * @remarks * When stored on disk, only the first 30 bytes of the latin-1 encoded value will * be stored. This may result in data loss. */ set album(value: string); /** @inheritDoc */ get comment(): string; /** * @inheritDoc * @remarks * When stored on disk, only the first 28 bytes of the latin-1 encoded value will * be stored. This may result in lost data. */ set comment(value: string); /** @inheritDoc */ get genres(): string[]; /** * @inheritDoc * @remarks * Only first genre will be stored and only if it is an exact match for a value in * the list of audio genres. All other values will result in the property being cleared. */ set genres(value: string[]); /** @inheritDoc */ get year(): number; /** * @inheritDoc * @remarks * Only values betweenInclusive 1 and 9999 will be stored. All other values will result in * the property being zeroed. */ set year(value: number); /** @inheritDoc */ get track(): number; /** * @inheritDoc * @remarks * Only values betweenInclusive 1 and 255 will be stored. All other values will result in * the property being zeroed. */ set track(value: number); /** @inheritDoc */ clear(): void; private parse; private static parseString; private static renderField; }