import { ByteVector } from "../byteVector"; import { IPicture } from "../picture"; import { Tag, TagTypes } from "../tag"; /** * Provides support for reading and writing Xiph comment-style tags. * @remarks * Xiph comment tag properties are stored in "fields" of the form `KEY=value`, where `KEY` * is the "field name". The field name can be defined multiple times in the tag which means * each field can have multiple values. */ export default class XiphComment extends Tag { private static readonly NEW_PICTURE_FIELD; private static readonly OLD_PICTURE_FIELD; private _fields; private _pictures; private _sizeOnDisk; private _vendorId; private constructor(); /** * Constructs and initializes a new instance by reading the contents of a raw Xiph comment from * a {@link ByteVector} object. * @param data Object containing a raw Xiph comment, cannot be falsey * @param lazyLoadPictures Whether or not to load pictures lazily */ static fromData(data: ByteVector, lazyLoadPictures: boolean): XiphComment; /** * Constructs and initializes a new instance with no contents. */ static fromEmpty(): XiphComment; /** * Gets the total number of values contained in the current instance, including the pictures. */ get fieldValueCount(): number; /** * Gets the names of the fields currently stored in the list of fields, excluding the pictures. * @remarks * This getter is useful for iterating over fields defined in this object in * conjunction with {@link getField}. */ get fieldNames(): string[]; /** * Gets the vendor ID for the current instance. */ get vendorId(): string; /** @inheritDoc */ get tagTypes(): TagTypes; /** @inheritDoc */ get sizeOnDisk(): number; /** * @inheritDoc * @remarks Stored in the `TITLE` field */ get title(): string; /** * @inheritDoc * @remarks Stored in the `TITLE` field */ set title(value: string); /** * @inheritDoc * @remarks Stored in the `TITLESORT` field */ get titleSort(): string; /** * @inheritDoc * @remarks Stored in the `TITLESORT` field */ set titleSort(value: string); /** * @inheritDoc * @remarks Stored in the `SUBTITLE` field */ get subtitle(): string; /** * @inheritDoc * @remarks Stored in the `SUBTITLE` field */ set subtitle(value: string); /** * @inheritDoc * @remarks Stored in the `DESCRIPTION` field */ get description(): string; /** * @inheritDoc * @remarks Stored in the `DESCRIPTION` field */ set description(value: string); /** * @inheritDoc * @remarks Stored in the `ARTIST` field */ get performers(): string[]; /** * @inheritDoc * @remarks Stored in the `ARTIST` field */ set performers(value: string[]); /** * @inheritDoc * @remarks Stored in the `ARTISTSORT` field */ get performersSort(): string[]; /** * @inheritDoc * @remarks Stored in the `ARTIST` field */ set performersSort(value: string[]); /** * @inheritDoc * @remarks Stored in the `ARTISTROLE` field */ get performersRole(): string[]; /** * @inheritDoc * @remarks Stored in the `ARTISTROLE` field */ set performersRole(value: string[]); /** * @inheritDoc * @remarks * Stored in the `ALBUMARTIST` as per standard, though `ALBUM ARTIST` and `ENSEMBLE` will be * checked if `ALBUMARTIST` is not set. */ get albumArtists(): string[]; /** * @inheritDoc * @remarks Stored in the `ALBUMARTIST`, as per the standard */ set albumArtists(value: string[]); /** * @inheritDoc * @remarks Stored in the `ALBUMARTISTSORT` field */ get albumArtistsSort(): string[]; /** * @inheritDoc * @remarks Stored in the `ALBUMARTISTSORT` field */ set albumArtistsSort(value: string[]); /** * @inheritDoc * @remarks Stored in the `COMPOSER` field */ get composers(): string[]; /** * @inheritDoc * @remarks Stored in the `COMPOSER` field */ set composers(value: string[]); /** * @inheritDoc * @remarks Stored in the `COMPOSERSORT` field */ get composersSort(): string[]; /** * @inheritDoc * @remarks Stored in the `COMPOSERSORT` field */ set composersSort(value: string[]); /** * @inheritDoc * @remarks Stored in the `ALBUM` field */ get album(): string; /** * @inheritDoc * @remarks Stored in the `ALBUM` field */ set album(value: string); /** * @inheritDoc * @remarks Stored in the `ALBUMSORT` field */ get albumSort(): string; /** * @inheritDoc * @remarks Stored in the `ALBUMSORT` field */ set albumSort(value: string); /** * @inheritDoc * @remarks Stored in the `COMMENT` field */ get comment(): string; /** * @inheritDoc * @remarks Stored in the `COMMENT` field */ set comment(value: string); /** * @inheritDoc * @remarks Stored in the `GENRE` field */ get genres(): string[]; /** * @inheritDoc * @remarks Stored in the `GENRE` field */ set genres(value: string[]); /** * @inheritDoc * @remarks Stored in the `DATE` field */ get year(): number; /** * @inheritDoc * @remarks Stored in the `DATE` field */ set year(value: number); /** * @inheritDoc * @remarks Stored in the `TRACKNUMBER` field */ get track(): number; /** * @inheritDoc * @remarks Stored in the `TRACKNUMBER` field */ set track(value: number); /** * @inheritDoc * @remarks * Stored in the `TRACKTOTAL` as per standard, but the denominator of `TRACKNUMBER` is also * used if `TRACKTOTAL` is not available. */ get trackCount(): number; /** * @inheritDoc * @remarks Stored in the `TRACKNUMBER` field */ set trackCount(value: number); /** * @inheritDoc * @remarks Stored in the `DISCNUMBER` field */ get disc(): number; /** * @inheritDoc * @remarks Stored in the `DISCNUMBER` field */ set disc(value: number); /** * @inheritDoc * @remarks * Stored in the `DISCTOTAL` as per standard, but the denominator of `DISCNUMBER` is also * used if `DISCTOTAL` is not available. */ get discCount(): number; /** * @inheritDoc * @remarks Stored in the `DISCTOTAL` field */ set discCount(value: number); /** * @inheritDoc * @remarks Stored in the `LYRICS` field */ get lyrics(): string; /** * @inheritDoc * @remarks Stored in the `LYRICS` field */ set lyrics(value: string); /** * @inheritDoc * @remarks Stored in the `GROUPING` field */ get grouping(): string; /** * @inheritDoc * @remarks Stored in the `GROUPING` field */ set grouping(value: string); /** * @inheritDoc * @remarks * Stored in the `TEMPO` field preferentially, BPM field is used as a fallback. * The field that stores the value will be used when setting a BPM in the future. This * behavior can be controlled Stored in the {@link XiphSettings.useTempoToStoreBpm}. */ get beatsPerMinute(): number; /** * @inheritDoc * @remarks * Value is stored in the `TEMPO` field if {@link XiphSettings.useTempoToStoreBpm} is * `true`. Value is stored in the `BPM` if {@link XiphSettings.useTempoToStoreBpm} is `false`. * The other field is removed when stored. */ set beatsPerMinute(value: number); /** * @inheritDoc * @remarks Stored in the `CONDUCTOR` field */ get conductor(): string; /** * @inheritDoc * @remarks Stored in the `CONDUCTOR` field */ set conductor(value: string); /** * @inheritDoc * @remarks Stored in the `COPYRIGHT` field */ get copyright(): string; /** * @inheritDoc * @remarks Stored in the `GROUPING` field */ set copyright(value: string); /** * @inheritDoc * @remarks Stored in the `DATETAGGED` field */ get dateTagged(): Date; /** * @inheritDoc * @remarks Stored in the `DATETAGGED` field */ set dateTagged(value: Date | undefined); /** * @inheritDoc * @remarks Stored in the `MUSICBRAINZ_ARTISTID` field */ get musicBrainzArtistId(): string; /** * @inheritDoc * @remarks Stored in the `MUSICBRAINZ_ARTISTID` field */ set musicBrainzArtistId(value: string); /** * @inheritDoc * @remarks Stored in the `MUSICBRAINZ_RELEASEGROUPID` field */ get musicBrainzReleaseGroupId(): string; /** * @inheritDoc * @remarks Stored in the `MUSICBRAINZ_RELEASEGROUPID` field */ set musicBrainzReleaseGroupId(value: string); /** * @inheritDoc * @remarks Stored in the `MUSICBRAINZ_ALBUMID` field */ get musicBrainzReleaseId(): string; /** * @inheritDoc * @remarks Stored in the `MUSICBRAINZ_ALBUMID` field */ set musicBrainzReleaseId(value: string); /** * @inheritDoc * @remarks Stored in the `MUSICBRAINZ_ALBUMARTISTID` field */ get musicBrainzReleaseArtistId(): string; /** * @inheritDoc * @remarks Stored in the `MUSICBRAINZ_ALBUMARTISTID` field */ set musicBrainzReleaseArtistId(value: string); /** * @inheritDoc * @remarks Stored in the `MUSICBRAINZ_TRACKID` field */ get musicBrainzTrackId(): string; /** * @inheritDoc * @remarks Stored in the `MUSICBRAINZ_TRACKID` field */ set musicBrainzTrackId(value: string); /** * @inheritDoc * @remarks Stored in the `MUSICBRAINZ_DISCID` field */ get musicBrainzDiscId(): string; /** * @inheritDoc * @remarks Stored in the `MUSICBRAINZ_DISCID` field */ set musicBrainzDiscId(value: string); /** * @inheritDoc * @remarks Stored in the `MUSICIP_PUID` field */ get musicIpId(): string; /** * @inheritDoc * @remarks Stored in the `MUSICID_PUID` field */ set musicIpId(value: string); /** * @inheritDoc * @remarks Stored in the `ASIN` field */ get amazonId(): string; /** * @inheritDoc * @remarks Stored in the `ASIN` field */ set amazonId(value: string); /** * @inheritDoc * @remarks Stored in the `MUSICBRAINZ_ALBUMSTATUS` field */ get musicBrainzReleaseStatus(): string; /** * @inheritDoc * @remarks Stored in the `MUSICBRAINZ_ALBUMSTATUS` field */ set musicBrainzReleaseStatus(value: string); /** * @inheritDoc * @remarks Stored in the `MUSICBRAINZ_ALBUMTYPE` field */ get musicBrainzReleaseType(): string; /** * @inheritDoc * @remarks Stored in the `MUSICBRAINZ_ALBUMTYPE` field */ set musicBrainzReleaseType(value: string); /** * @inheritDoc * @remarks Stored in the `RELEASECOUNTRY` field */ get musicBrainzReleaseCountry(): string; /** * @inheritDoc * @remarks Stored in the `RELEASECOUNTRY` field */ set musicBrainzReleaseCountry(value: string); /** * @inheritDoc */ get pictures(): IPicture[]; /** * @inheritDoc */ set pictures(value: IPicture[]); /** * @inheritDoc * @remarks Stored in the `COMPILATION` field */ get isCompilation(): boolean; /** * @inheritDoc * @remarks Stored in the `COMPILATION` field */ set isCompilation(value: boolean); /** * @inheritDoc * @remarks Stored in the `REPLAYGAIN_TRACK_GAIN` field */ get replayGainTrackGain(): number; /** * @inheritDoc * @remarks Stored in the `REPLAYGAIN_TRACK_GAIN` field */ set replayGainTrackGain(value: number); /** * @inheritDoc * @remarks Stored in the `REPLAYGAIN_TRACK_PEAK` field */ get replayGainTrackPeak(): number; /** * @inheritDoc * @remarks Stored in the `REPLAYGAIN_TRACK_PEAK` field */ set replayGainTrackPeak(value: number); /** * @inheritDoc * @remarks Stored in the `REPLAYGAIN_ALBUM_GAIN` field */ get replayGainAlbumGain(): number; /** * @inheritDoc * @remarks Stored in the `REPLAYGAIN_ALBUM_GAIN` field */ set replayGainAlbumGain(value: number); /** * @inheritDoc * @remarks Stored in the `REPLAYGAIN_ALBUM_PEAK` field */ get replayGainAlbumPeak(): number; /** * @inheritDoc * @remarks Stored in the `REPLAYGAIN_TRACK_PEAK` field */ set replayGainAlbumPeak(value: number); /** * @inheritDoc * @remarks Stored in the `INITIALKEY` field */ get initialKey(): string; /** * @inheritDoc * @remarks Stored in the `INITIALKEY` field */ set initialKey(value: string); /** * @inheritDoc * @remarks Stored in the `REMIXEDBY` field */ get remixedBy(): string; /** * @inheritDoc * @remarks Stored in the `REMIXEDBY` field */ set remixedBy(value: string); /** * @inheritDoc * @remarks Stored in the `ORGANIZATION` field */ get publisher(): string; /** * @inheritDoc * @remarks Stored in the `ORGANIZATION` field */ set publisher(value: string); /** * @inheritDoc * @remarks Stored in the `ISRC` field */ get isrc(): string; /** * @inheritDoc * @remarks Stored in the `ISRC` field */ set isrc(value: string); /** * @inheritDoc */ get isEmpty(): boolean; /** @inheritDoc */ clear(): void; /** @inheritDoc */ copyTo(target: Tag, overwrite: boolean): void; /** * Gets the field data for a given field identifier. * @param key Field identifier to look up * @returns Field data or undefined if the field cannot be found */ getField(key: string): string[]; /** * Gets the first value in a field for a given field identifier. * @param key Field identifier to look up * @returns Field data or `undefined` if the field was notfound */ getFieldFirstValue(key: string): string; /** * Removes a field and all its values from the current instance. * @param key Field identifier to remove */ removeField(key: string): void; /** * Renders the current instance as a raw Xiph comment, optionally adding a framing bit. * @param addFramingBit Whether or not to add a framing bit to the end of the content. */ render(addFramingBit: boolean): ByteVector; /** * Sets the contents of a specified field to the provided strings. All values are trimmed and * empty/undefined values are excluded. * @param key Field identifier to set * @param values Values to store in the current instance */ setFieldAsStrings(key: string, ...values: string[]): void; /** * Sets the contents of a specified field to the provided number. * @param key Field identifier to set * @param value Value to store, must be a positive, 32-bit integer * @param minPlaces Number of places to include at a minimum, if the number has fewer places * than this, the value will be padded with zeroes. */ setFieldAsUint(key: string, value: number, minPlaces?: number): void; private static isPictureField; }