import MatroskaAttachment from "./matroskaAttachment"; import MatroskaTag from "./matroskaTag"; import { IPicture } from "../picture"; import { Tag, TagTypes } from "../tag"; /** * Class that represents a collection of Matroska "tags". This class implements the {@link Tag} * unified tagging interface. * @remarks * The Matroska tagging interface is very open-ended and allows a high level of * customization. In particular, Matroska files may contain multiple subunits that can be * independently tagged (eg, multiple episodes of a TV show in a single file). The unified * tagging interface assumes that a file only represents a single unit (eg, episode). This * can cause problems when, eg, a title is defined multiple times in a file to provide the * title for multiple, eg, episodes contained within the file. Matroska also defines multiple * tagging "levels" at which a tag applies (eg, episode, chapter, collection). This confuses * the interface even more because tags (eg, title) are expected to be used for different * purposes at different levels (eg, title at the episode level means the title of the episode, * but title at the collection level may mean the title of the TV show). There are no well- * established conventions here so, unified tagging for Matroska files is very much best * effort. If special tagging is needed, one will need to directly access the {@link tags} * that make up the tag collection. */ export default class MatroskaTagCollection extends Tag { private static readonly PERFORMER_AUDIO_KEY; private static readonly PERFORMER_VIDEO_KEY; private readonly _albumPartTagLevel; private readonly _albumTagLevel; private readonly _isVideo; private readonly _fileTagLevel; private readonly _performerKey; private readonly _sizeOnDisk; private _attachments; private _tags; /** * Constructs and initializes a new instance using based on the information read from the file. * @param sizeOnDisk Size of the tag in bytes * @param isVideo Whether or not the file contains video * @param tags Collection of tag objects found in the file * @param attachments Collection of attachments found in the file */ constructor(sizeOnDisk: number, isVideo: boolean, tags: MatroskaTag[], attachments: MatroskaAttachment[]); /** * Gets the list of attachments that are stored in the file. */ get attachments(): MatroskaAttachment[]; /** * Sets the list of attachments that are stored in the file. */ set attachments(value: MatroskaAttachment[]); /** * Gets the list of tags that are inside the file. */ get tags(): MatroskaTag[]; /** * Sets the list of tags that are inside the file. */ set tags(value: MatroskaTag[]); /** @inheritDoc */ get tagTypes(): TagTypes; /** @inheritDoc */ get sizeOnDisk(): number; /** @inheritDoc */ get title(): string; /** @inheritDoc */ get titleSort(): string; /** @inheritDoc */ get subtitle(): string; /** @inheritDoc */ get description(): string; /** @inheritDoc */ get performers(): string[]; /** @inheritDoc */ get performersSort(): string[]; /** @inheritDoc */ get performersRole(): string[]; /** @inheritDoc */ get albumArtists(): string[]; /** @inheritDoc */ get albumArtistsSort(): string[]; /** @inheritDoc */ get composers(): string[]; /** @inheritDoc */ get composersSort(): string[]; /** @inheritDoc */ get album(): string; /** @inheritDoc */ get albumSort(): string; /** @inheritDoc */ get comment(): string; /** @inheritDoc */ get genres(): string[]; /** @inheritDoc */ get year(): number; /** @inheritDoc */ get track(): number; /** @inheritDoc */ get trackCount(): number; /** @inheritDoc */ get disc(): number; /** @inheritDoc */ get discCount(): number; /** @inheritDoc */ get lyrics(): string; /** @inheritDoc */ get grouping(): string; /** @inheritDoc */ get beatsPerMinute(): number; /** @inheritDoc */ get conductor(): string; /** @inheritDoc */ get copyright(): string; /** @inheritDoc */ get dateTagged(): Date; /** @inheritDoc */ get pictures(): IPicture[]; /** @inheritDoc */ get isEmpty(): boolean; /** @inheritDoc */ clear(): void; /** * Looks for tags with the given {@paramref key} starting at the provided {@paramref level}. If * no tags are found, the process is repeated at the next highest level. If the top level is * reached but no tags were found, a final attempt is made using the un-targeted level. * @param level Target level to begin searching for the desired tag at * @param key Key of the desired tag * @private */ private getTagValuesRecursively; /** * Looks for tags with the given {@paramref key} at the "file" target level. If no tags are * found, the process is repeated at the un-targeted level. * @remarks * The "file" target level is either {@link MatroskaTagTarget.TRACK} or * {@link MatroskaTagTarget.EPISODE} level, depending on whether the file is audio or video. * This is somewhat convention based due to Matroska tagging being so open-ended. This * method should only be used for retrieving tags for the unified tagging interface, which * is best-effort in following conventions. * @param key Key of the desired tag * @private */ private getFileTagValues; /** * Looks for tags with the given {@paramref key} at a given {@paramref level}. * @param level Target level to search for the given tags. If `undefined`, the un-targeted * level is searched. * @param key Key of the desired tag. * @private */ private getTagValues; }