Migrate from CommonJS to ES Modules
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"reporter": [
|
||||||
|
"lcov",
|
||||||
|
"text"
|
||||||
|
]
|
||||||
|
}
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"env": {
|
"env": {
|
||||||
"browser": true,
|
"browser": true,
|
||||||
"es6": true,
|
"es2021": true,
|
||||||
"node": true
|
"node": true
|
||||||
},
|
},
|
||||||
"extends": [
|
"extends": [
|
||||||
@@ -191,7 +191,7 @@
|
|||||||
"no-unused-labels": "error",
|
"no-unused-labels": "error",
|
||||||
"no-use-before-define": "off",
|
"no-use-before-define": "off",
|
||||||
"no-var": "error",
|
"no-var": "error",
|
||||||
"node/file-extension-in-import": ["off"],
|
"node/file-extension-in-import": ["error", "always"],
|
||||||
"node/no-extraneous-import": "error",
|
"node/no-extraneous-import": "error",
|
||||||
"object-shorthand": "error",
|
"object-shorthand": "error",
|
||||||
"one-var": [
|
"one-var": [
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [10.x, 12.x, 14.x, 16.x]
|
node-version: [12.x, 14.x, 16.x, 17.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"extension": ["ts", "tsx"],
|
||||||
|
"watch-files": ["lib/**/*.ts", "test/**/*.ts"],
|
||||||
|
"spec": ["test/test-*.ts"],
|
||||||
|
"loader": ["ts-node/esm"],
|
||||||
|
"extensions": ["ts", "tsx"]
|
||||||
|
}
|
||||||
+10
-7
@@ -1,16 +1,19 @@
|
|||||||
import * as path from 'path';
|
import * as path from 'node:path';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'node:fs';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import { commonTags } from '../lib/common/GenericTagTypes';
|
import { commonTags } from '../lib/common/GenericTagTypes.js';
|
||||||
import { CombinedTagMapper } from '../lib/common/CombinedTagMapper';
|
import { CombinedTagMapper } from '../lib/common/CombinedTagMapper.js';
|
||||||
|
|
||||||
import * as markDown from './MarkDown';
|
import * as markDown from './MarkDown.js';
|
||||||
|
|
||||||
interface ITagInfoDict {
|
interface ITagInfoDict {
|
||||||
[key: string]: { description: string };
|
[key: string]: { description: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
const combinedTagMapper = new CombinedTagMapper();
|
const combinedTagMapper = new CombinedTagMapper();
|
||||||
|
const filename = fileURLToPath(import.meta.url);
|
||||||
|
const dirname = path.dirname(filename);
|
||||||
|
|
||||||
function getNativeSourceTags(nativeType: string, commonTag: string): string[] {
|
function getNativeSourceTags(nativeType: string, commonTag: string): string[] {
|
||||||
|
|
||||||
@@ -27,7 +30,7 @@ function getNativeSourceTags(nativeType: string, commonTag: string): string[] {
|
|||||||
|
|
||||||
function write(out: fs.WriteStream) {
|
function write(out: fs.WriteStream) {
|
||||||
|
|
||||||
const json = fs.readFileSync(path.join(__dirname, 'common.json'));
|
const json = fs.readFileSync(path.join(dirname, 'common.json'));
|
||||||
const commonDescriptionDict: ITagInfoDict = JSON.parse(json as any);
|
const commonDescriptionDict: ITagInfoDict = JSON.parse(json as any);
|
||||||
|
|
||||||
const table = new markDown.Table();
|
const table = new markDown.Table();
|
||||||
@@ -55,7 +58,7 @@ function write(out: fs.WriteStream) {
|
|||||||
table.writeTo(out);
|
table.writeTo(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
const txt = fs.createWriteStream(path.join(__dirname, '..', 'doc', 'common_metadata.md'));
|
const txt = fs.createWriteStream(path.join(dirname, '..', 'doc', 'common_metadata.md'));
|
||||||
|
|
||||||
txt.write('# Common Metadata\n\n');
|
txt.write('# Common Metadata\n\n');
|
||||||
txt.write('Common tags, and _native_ to _common_ tag mappings. _n_ indicates the multiplicity.\n');
|
txt.write('Common tags, and _native_ to _common_ tag mappings. _n_ indicates the multiplicity.\n');
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import * as mm from '../../lib';
|
import * as mm from '../../lib.js';
|
||||||
import * as util from 'util';
|
import * as util from 'util';
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|||||||
+23
-21
@@ -1,24 +1,26 @@
|
|||||||
import { IOptions, IAudioMetadata, ParserType } from './type';
|
import { fileTypeFromBuffer } from 'file-type';
|
||||||
import { ITokenizer } from 'strtok3/lib/core';
|
import ContentType from 'content-type';
|
||||||
import * as FileType from 'file-type/core';
|
import MimeType from 'media-typer';
|
||||||
import * as ContentType from 'content-type';
|
|
||||||
import * as MimeType from 'media-typer';
|
|
||||||
|
|
||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
import { INativeMetadataCollector, MetadataCollector } from './common/MetadataCollector';
|
import { Buffer } from 'node:buffer';
|
||||||
import { AIFFParser } from './aiff/AiffParser';
|
|
||||||
import { APEv2Parser } from './apev2/APEv2Parser';
|
import { INativeMetadataCollector, MetadataCollector } from './common/MetadataCollector.js';
|
||||||
import { AsfParser } from './asf/AsfParser';
|
import { AIFFParser } from './aiff/AiffParser.js';
|
||||||
import { FlacParser } from './flac/FlacParser';
|
import { APEv2Parser } from './apev2/APEv2Parser.js';
|
||||||
import { MP4Parser } from './mp4/MP4Parser';
|
import { AsfParser } from './asf/AsfParser.js';
|
||||||
import { MpegParser } from './mpeg/MpegParser';
|
import { FlacParser } from './flac/FlacParser.js';
|
||||||
import MusepackParser from './musepack';
|
import { MP4Parser } from './mp4/MP4Parser.js';
|
||||||
import { OggParser } from './ogg/OggParser';
|
import { MpegParser } from './mpeg/MpegParser.js';
|
||||||
import { WaveParser } from './wav/WaveParser';
|
import MusepackParser from './musepack/index.js';
|
||||||
import { WavPackParser } from './wavpack/WavPackParser';
|
import { OggParser } from './ogg/OggParser.js';
|
||||||
import { DsfParser } from './dsf/DsfParser';
|
import { WaveParser } from './wav/WaveParser.js';
|
||||||
import { DsdiffParser } from './dsdiff/DsdiffParser';
|
import { WavPackParser } from './wavpack/WavPackParser.js';
|
||||||
import { MatroskaParser } from './matroska/MatroskaParser';
|
import { DsfParser } from './dsf/DsfParser.js';
|
||||||
|
import { DsdiffParser } from './dsdiff/DsdiffParser.js';
|
||||||
|
import { MatroskaParser } from './matroska/MatroskaParser.js';
|
||||||
|
|
||||||
|
import { IOptions, IAudioMetadata, ParserType } from './type.js';
|
||||||
|
import { ITokenizer } from 'strtok3/core';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:factory');
|
const debug = initDebug('music-metadata:parser:factory');
|
||||||
|
|
||||||
@@ -93,7 +95,7 @@ export class ParserFactory {
|
|||||||
parserId = this.getParserIdForExtension(tokenizer.fileInfo.path);
|
parserId = this.getParserIdForExtension(tokenizer.fileInfo.path);
|
||||||
}
|
}
|
||||||
if (!parserId) {
|
if (!parserId) {
|
||||||
const guessedType = await FileType.fromBuffer(buf);
|
const guessedType = await fileTypeFromBuffer(buf);
|
||||||
if (!guessedType) {
|
if (!guessedType) {
|
||||||
throw new Error('Failed to determine audio format');
|
throw new Error('Failed to determine audio format');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
import * as strtok3 from 'strtok3/lib/core';
|
import * as strtok3 from 'strtok3/core';
|
||||||
|
|
||||||
import { ID3v2Parser } from '../id3v2/ID3v2Parser';
|
import { ID3v2Parser } from '../id3v2/ID3v2Parser.js';
|
||||||
import { FourCcToken } from '../common/FourCC';
|
import { FourCcToken } from '../common/FourCC.js';
|
||||||
import { BasicParser } from '../common/BasicParser';
|
import { BasicParser } from '../common/BasicParser.js';
|
||||||
|
|
||||||
import * as AiffToken from './AiffToken';
|
import * as AiffToken from './AiffToken.js';
|
||||||
import * as iff from '../iff';
|
import * as iff from '../iff/index.js';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:aiff');
|
const debug = initDebug('music-metadata:parser:aiff');
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import { IGetToken } from 'strtok3';
|
import { Buffer } from 'node:buffer';
|
||||||
|
|
||||||
import {FourCcToken} from '../common/FourCC';
|
import { FourCcToken } from '../common/FourCC.js';
|
||||||
import * as iff from '../iff';
|
import * as iff from '../iff/index.js';
|
||||||
|
|
||||||
|
import { IGetToken } from 'strtok3';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Common Chunk.
|
* The Common Chunk.
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
import * as strtok3 from 'strtok3/lib/core';
|
import * as strtok3 from 'strtok3/core';
|
||||||
import { StringType } from 'token-types';
|
import { StringType } from 'token-types';
|
||||||
|
import { Buffer } from 'node:buffer';
|
||||||
|
|
||||||
import * as util from '../common/Util';
|
import * as util from '../common/Util.js';
|
||||||
import { IOptions, IRandomReader, IApeHeader } from '../type';
|
import { IOptions, IRandomReader, IApeHeader } from '../type.js';
|
||||||
import { INativeMetadataCollector } from '../common/MetadataCollector';
|
import { INativeMetadataCollector } from '../common/MetadataCollector.js';
|
||||||
import { BasicParser } from '../common/BasicParser';
|
import { BasicParser } from '../common/BasicParser.js';
|
||||||
import {
|
import {
|
||||||
DataType,
|
DataType,
|
||||||
DescriptorParser,
|
DescriptorParser,
|
||||||
@@ -15,7 +16,7 @@ import {
|
|||||||
IHeader, ITagItemHeader,
|
IHeader, ITagItemHeader,
|
||||||
TagFooter,
|
TagFooter,
|
||||||
TagItemHeader
|
TagItemHeader
|
||||||
} from './APEv2Token';
|
} from './APEv2Token.js';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:APEv2');
|
const debug = initDebug('music-metadata:parser:APEv2');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {INativeTagMap} from '../common/GenericTagTypes';
|
import {INativeTagMap} from '../common/GenericTagTypes.js';
|
||||||
import { CaseInsensitiveTagMap } from '../common/CaseInsensitiveTagMap';
|
import { CaseInsensitiveTagMap } from '../common/CaseInsensitiveTagMap.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID3v2.2 tag mappings
|
* ID3v2.2 tag mappings
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import { IGetToken } from 'strtok3/lib/core';
|
import { IGetToken } from 'strtok3/core';
|
||||||
|
import { Buffer } from 'node:buffer';
|
||||||
|
|
||||||
import { FourCcToken } from '../common/FourCC';
|
import { FourCcToken } from '../common/FourCC.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APETag versionIndex history / supported formats
|
* APETag versionIndex history / supported formats
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
// ASF Objects
|
// ASF Objects
|
||||||
|
|
||||||
import { IGetToken, ITokenizer } from 'strtok3/lib/core';
|
|
||||||
|
|
||||||
import * as util from '../common/Util';
|
|
||||||
import { IPicture, ITag } from '../type';
|
|
||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import GUID from './GUID';
|
import { IGetToken, ITokenizer } from 'strtok3/core';
|
||||||
import { AsfUtil } from './AsfUtil';
|
import { Buffer } from 'node:buffer';
|
||||||
import { AttachedPictureType } from '../id3v2/ID3v2Token';
|
|
||||||
|
import * as util from '../common/Util.js';
|
||||||
|
import { IPicture, ITag } from '../type.js';
|
||||||
|
import GUID from './GUID.js';
|
||||||
|
import { AsfUtil } from './AsfUtil.js';
|
||||||
|
import { AttachedPictureType } from '../id3v2/ID3v2Token.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data Type: Specifies the type of information being stored. The following values are recognized.
|
* Data Type: Specifies the type of information being stored. The following values are recognized.
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
|
|
||||||
import { ITag, TrackType } from '../type';
|
import { ITag, TrackType } from '../type.js';
|
||||||
import GUID from './GUID';
|
import GUID from './GUID.js';
|
||||||
import * as AsfObject from './AsfObject';
|
import * as AsfObject from './AsfObject.js';
|
||||||
import { BasicParser } from '../common/BasicParser';
|
import { BasicParser } from '../common/BasicParser.js';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:ASF');
|
const debug = initDebug('music-metadata:parser:ASF');
|
||||||
const headerType = 'asf';
|
const headerType = 'asf';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import {INativeTagMap} from '../common/GenericTagTypes';
|
import {INativeTagMap} from '../common/GenericTagTypes.js';
|
||||||
import {CommonTagMapper} from '../common/GenericTagMapper';
|
import {CommonTagMapper} from '../common/GenericTagMapper.js';
|
||||||
import {IRating, ITag} from '../type';
|
import {IRating, ITag} from '../type.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ASF Metadata tag mappings.
|
* ASF Metadata tag mappings.
|
||||||
|
|||||||
+3
-2
@@ -1,7 +1,8 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
|
import { Buffer } from 'node:buffer';
|
||||||
|
|
||||||
import * as util from '../common/Util';
|
import * as util from '../common/Util.js';
|
||||||
import { DataType } from './AsfObject';
|
import { DataType } from './AsfObject.js';
|
||||||
|
|
||||||
export type AttributeParser = (buf: Buffer) => boolean | string | number | bigint | Buffer;
|
export type AttributeParser = (buf: Buffer) => boolean | string | number | bigint | Buffer;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { ITokenizer } from 'strtok3/lib/core';
|
import { ITokenizer } from 'strtok3/core';
|
||||||
|
|
||||||
import { ITokenParser } from '../ParserFactory';
|
import { ITokenParser } from '../ParserFactory.js';
|
||||||
import { IOptions, IPrivateOptions } from '../type';
|
import { IOptions, IPrivateOptions } from '../type.js';
|
||||||
import { INativeMetadataCollector } from './MetadataCollector';
|
import { INativeMetadataCollector } from './MetadataCollector.js';
|
||||||
|
|
||||||
export abstract class BasicParser implements ITokenParser {
|
export abstract class BasicParser implements ITokenParser {
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { INativeTagMap, TagType } from './GenericTagTypes';
|
import { INativeTagMap, TagType } from './GenericTagTypes.js';
|
||||||
import { CommonTagMapper } from './GenericTagMapper';
|
import { CommonTagMapper } from './GenericTagMapper.js';
|
||||||
|
|
||||||
export class CaseInsensitiveTagMap extends CommonTagMapper {
|
export class CaseInsensitiveTagMap extends CommonTagMapper {
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import { ID3v1TagMapper } from '../id3v1/ID3v1TagMap';
|
import { ID3v1TagMapper } from '../id3v1/ID3v1TagMap.js';
|
||||||
import { ID3v24TagMapper } from '../id3v2/ID3v24TagMapper';
|
import { ID3v24TagMapper } from '../id3v2/ID3v24TagMapper.js';
|
||||||
import { AsfTagMapper } from '../asf/AsfTagMapper';
|
import { AsfTagMapper } from '../asf/AsfTagMapper.js';
|
||||||
import { IGenericTag, TagType } from './GenericTagTypes';
|
import { IGenericTag, TagType } from './GenericTagTypes.js';
|
||||||
import { ID3v22TagMapper } from '../id3v2/ID3v22TagMapper';
|
import { ID3v22TagMapper } from '../id3v2/ID3v22TagMapper.js';
|
||||||
import { APEv2TagMapper } from '../apev2/APEv2TagMapper';
|
import { APEv2TagMapper } from '../apev2/APEv2TagMapper.js';
|
||||||
import { IGenericTagMapper } from './GenericTagMapper';
|
import { IGenericTagMapper } from './GenericTagMapper.js';
|
||||||
import { MP4TagMapper } from '../mp4/MP4TagMapper';
|
import { MP4TagMapper } from '../mp4/MP4TagMapper.js';
|
||||||
import { VorbisTagMapper } from '../ogg/vorbis/VorbisTagMapper';
|
import { VorbisTagMapper } from '../ogg/vorbis/VorbisTagMapper.js';
|
||||||
import { RiffInfoTagMapper } from '../riff/RiffInfoTagMap';
|
import { RiffInfoTagMapper } from '../riff/RiffInfoTagMap.js';
|
||||||
import { ITag } from '../type';
|
import { ITag } from '../type.js';
|
||||||
import { INativeMetadataCollector } from './MetadataCollector';
|
import { INativeMetadataCollector } from './MetadataCollector.js';
|
||||||
import { MatroskaTagMapper } from '../matroska/MatroskaTagMapper';
|
import { MatroskaTagMapper } from '../matroska/MatroskaTagMapper.js';
|
||||||
|
|
||||||
export class CombinedTagMapper {
|
export class CombinedTagMapper {
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import * as util from './Util';
|
import { IToken } from 'strtok3/core';
|
||||||
import { IToken } from 'strtok3/lib/core';
|
|
||||||
|
import * as util from './Util.js';
|
||||||
|
|
||||||
const validFourCC = /^[\x21-\x7e©][\x20-\x7e\x00()]{3}/;
|
const validFourCC = /^[\x21-\x7e©][\x20-\x7e\x00()]{3}/;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import * as generic from './GenericTagTypes';
|
import * as generic from './GenericTagTypes.js';
|
||||||
import { ITag } from '../type';
|
import {ITag} from '../type.js';
|
||||||
import { INativeMetadataCollector, IWarningCollector } from './MetadataCollector';
|
import { INativeMetadataCollector, IWarningCollector } from './MetadataCollector.js';
|
||||||
|
|
||||||
export interface IGenericTagMapper {
|
export interface IGenericTagMapper {
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ export class CommonTagMapper implements IGenericTagMapper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert native tag key to common tag key
|
* Convert native tag key to common tag key
|
||||||
* @tag Native header tag
|
* @param tag Native header tag
|
||||||
* @return common tag name (alias)
|
* @return common tag name (alias)
|
||||||
*/
|
*/
|
||||||
protected getCommonName(tag: string): generic.GenericTagId {
|
protected getCommonName(tag: string): generic.GenericTagId {
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ import {
|
|||||||
IAudioMetadata, ICommonTagsResult,
|
IAudioMetadata, ICommonTagsResult,
|
||||||
IFormat,
|
IFormat,
|
||||||
INativeTags, IOptions, IQualityInformation, IPicture, ITrackInfo, TrackType
|
INativeTags, IOptions, IQualityInformation, IPicture, ITrackInfo, TrackType
|
||||||
} from '../type';
|
} from '../type.js';
|
||||||
|
|
||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
import { IGenericTag, TagType, isSingleton, isUnique } from './GenericTagTypes';
|
import { IGenericTag, TagType, isSingleton, isUnique } from './GenericTagTypes.js';
|
||||||
import { CombinedTagMapper } from './CombinedTagMapper';
|
import { CombinedTagMapper } from './CombinedTagMapper.js';
|
||||||
import { CommonTagMapper } from './GenericTagMapper';
|
import { CommonTagMapper } from './GenericTagMapper.js';
|
||||||
import { toRatio } from './Util';
|
import { toRatio } from './Util.js';
|
||||||
import * as FileType from 'file-type/core';
|
import { fileTypeFromBuffer } from 'file-type';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:collector');
|
const debug = initDebug('music-metadata:collector');
|
||||||
|
|
||||||
@@ -281,7 +281,7 @@ export class MetadataCollector implements INativeMetadataCollector {
|
|||||||
private async postFixPicture(picture: IPicture): Promise<IPicture> {
|
private async postFixPicture(picture: IPicture): Promise<IPicture> {
|
||||||
if (picture.data && picture.data.length > 0) {
|
if (picture.data && picture.data.length > 0) {
|
||||||
if (!picture.format) {
|
if (!picture.format) {
|
||||||
const fileType = await FileType.fromBuffer(picture.data);
|
const fileType = await fileTypeFromBuffer(picture.data);
|
||||||
if (fileType) {
|
if (fileType) {
|
||||||
picture.format = fileType.mime;
|
picture.format = fileType.mime;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
import { IRandomReader } from '../type';
|
import { IRandomReader } from '../type.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides abstract file access via the IRandomRead interface
|
* Provides abstract file access via the IRandomRead interface
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { IRandomReader } from '../type';
|
import { IRandomReader } from '../type.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides abstract Uint8Array access via the IRandomRead interface
|
* Provides abstract Uint8Array access via the IRandomRead interface
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { IRatio } from '../type';
|
import { IRatio } from '../type.js';
|
||||||
|
|
||||||
export type StringEncoding =
|
export type StringEncoding =
|
||||||
'ascii' // Use 'utf-8' or latin1 instead
|
'ascii' // Use 'utf-8' or latin1 instead
|
||||||
|
|||||||
+9
-8
@@ -1,14 +1,15 @@
|
|||||||
import { Readable } from 'stream';
|
import { Readable } from 'stream';
|
||||||
import * as strtok3 from 'strtok3/lib/core';
|
import * as strtok3 from 'strtok3/core';
|
||||||
|
|
||||||
import { ParserFactory } from './ParserFactory';
|
import { ParserFactory } from './ParserFactory.js';
|
||||||
import { IAudioMetadata, INativeTagDict, IOptions, IPicture, IPrivateOptions, IRandomReader, ITag } from './type';
|
import { RandomUint8ArrayReader } from './common/RandomUint8ArrayReader.js';
|
||||||
import { RandomUint8ArrayReader } from './common/RandomUint8ArrayReader';
|
import { APEv2Parser } from './apev2/APEv2Parser.js';
|
||||||
import { APEv2Parser } from './apev2/APEv2Parser';
|
import { hasID3v1Header } from './id3v1/ID3v1Parser.js';
|
||||||
import { hasID3v1Header } from './id3v1/ID3v1Parser';
|
import { getLyricsHeaderLength } from './lyrics3/Lyrics3.js';
|
||||||
import { getLyricsHeaderLength } from './lyrics3/Lyrics3';
|
|
||||||
|
|
||||||
export { IFileInfo } from 'strtok3/lib/core';
|
import { IAudioMetadata, INativeTagDict, IOptions, IPicture, IPrivateOptions, IRandomReader, ITag } from './type.js';
|
||||||
|
|
||||||
|
export { IFileInfo } from 'strtok3/core';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse audio from Node Stream.Readable
|
* Parse audio from Node Stream.Readable
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
import * as strtok3 from 'strtok3/lib/core';
|
import * as strtok3 from 'strtok3/core';
|
||||||
|
|
||||||
import { FourCcToken } from '../common/FourCC';
|
import { FourCcToken } from '../common/FourCC.js';
|
||||||
import { BasicParser } from '../common/BasicParser';
|
import { BasicParser } from '../common/BasicParser.js';
|
||||||
import { ID3v2Parser } from '../id3v2/ID3v2Parser';
|
import { ID3v2Parser } from '../id3v2/ID3v2Parser.js';
|
||||||
|
|
||||||
import { ChunkHeader64, IChunkHeader64 } from './DsdiffToken';
|
import { ChunkHeader64, IChunkHeader64 } from './DsdiffToken.js';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:aiff');
|
const debug = initDebug('music-metadata:parser:aiff');
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import { IGetToken } from 'strtok3/lib/core';
|
import { IGetToken } from 'strtok3/core';
|
||||||
|
|
||||||
import { FourCcToken } from '../common/FourCC';
|
import { FourCcToken } from '../common/FourCC.js';
|
||||||
import { IChunkHeader64 } from '../iff';
|
import { IChunkHeader64 } from '../iff/index.js';
|
||||||
export { IChunkHeader64 } from '../iff';
|
export { IChunkHeader64 } from '../iff/index.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DSDIFF chunk header
|
* DSDIFF chunk header
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import { IGetToken } from 'strtok3/lib/core';
|
import { IGetToken } from 'strtok3/core';
|
||||||
|
|
||||||
import { FourCcToken } from '../common/FourCC';
|
import { FourCcToken } from '../common/FourCC.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common interface for the common chunk DSD header
|
* Common interface for the common chunk DSD header
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
|
|
||||||
import { AbstractID3Parser } from '../id3v2/AbstractID3Parser';
|
import { AbstractID3Parser } from '../id3v2/AbstractID3Parser.js';
|
||||||
import { ChunkHeader, DsdChunk, FormatChunk, IChunkHeader, IDsdChunk, IFormatChunk } from './DsfChunk';
|
import { ChunkHeader, DsdChunk, FormatChunk, IChunkHeader, IDsdChunk, IFormatChunk } from './DsfChunk.js';
|
||||||
import { ID3v2Parser } from "../id3v2/ID3v2Parser";
|
import { ID3v2Parser } from "../id3v2/ID3v2Parser.js";
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:DSF');
|
const debug = initDebug('music-metadata:parser:DSF');
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -1,16 +1,16 @@
|
|||||||
import { UINT16_BE, UINT24_BE, Uint8ArrayType } from 'token-types';
|
import { UINT16_BE, UINT24_BE, Uint8ArrayType } from 'token-types';
|
||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
import { ITokenizer, IGetToken } from 'strtok3/lib/core';
|
import { ITokenizer, IGetToken } from 'strtok3/core';
|
||||||
|
|
||||||
import * as util from '../common/Util';
|
import * as util from '../common/Util.js';
|
||||||
import { IVorbisPicture, VorbisPictureToken } from '../ogg/vorbis/Vorbis';
|
import { IVorbisPicture, VorbisPictureToken } from '../ogg/vorbis/Vorbis.js';
|
||||||
import { AbstractID3Parser } from '../id3v2/AbstractID3Parser';
|
import { AbstractID3Parser } from '../id3v2/AbstractID3Parser.js';
|
||||||
import { FourCcToken } from '../common/FourCC';
|
import { FourCcToken } from '../common/FourCC.js';
|
||||||
import { VorbisParser } from '../ogg/vorbis/VorbisParser';
|
import { VorbisParser } from '../ogg/vorbis/VorbisParser.js';
|
||||||
import { INativeMetadataCollector } from '../common/MetadataCollector';
|
import { INativeMetadataCollector } from '../common/MetadataCollector.js';
|
||||||
import { IOptions } from '../type';
|
import { IOptions } from '../type.js';
|
||||||
import { ITokenParser } from '../ParserFactory';
|
import { ITokenParser } from '../ParserFactory.js';
|
||||||
import { VorbisDecoder } from '../ogg/vorbis/VorbisDecoder';
|
import { VorbisDecoder } from '../ogg/vorbis/VorbisDecoder.js';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:FLAC');
|
const debug = initDebug('music-metadata:parser:FLAC');
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
import { StringType, UINT8 } from 'token-types';
|
import { StringType, UINT8 } from 'token-types';
|
||||||
import { IGetToken } from 'strtok3/lib/core';
|
|
||||||
|
|
||||||
import * as util from '../common/Util';
|
import * as util from '../common/Util.js';
|
||||||
import { BasicParser } from '../common/BasicParser';
|
|
||||||
import { APEv2Parser } from '../apev2/APEv2Parser';
|
import { IGetToken } from 'strtok3/core';
|
||||||
import { IRandomReader } from '../type';
|
import { BasicParser } from '../common/BasicParser.js';
|
||||||
|
import { APEv2Parser } from '../apev2/APEv2Parser.js';
|
||||||
|
import { IRandomReader } from '../type.js';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:ID3v1');
|
const debug = initDebug('music-metadata:parser:ID3v1');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { INativeTagMap } from '../common/GenericTagTypes';
|
import { INativeTagMap } from '../common/GenericTagTypes.js';
|
||||||
import { CommonTagMapper } from '../common/GenericTagMapper';
|
import { CommonTagMapper } from '../common/GenericTagMapper.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID3v1 tag mappings
|
* ID3v1 tag mappings
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { EndOfStreamError, ITokenizer } from 'strtok3/lib/core';
|
import { EndOfStreamError, ITokenizer } from 'strtok3/core';
|
||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
|
|
||||||
import { ID3v2Header } from './ID3v2Token';
|
import { ID3v2Header } from './ID3v2Token.js';
|
||||||
import { ID3v2Parser } from './ID3v2Parser';
|
import { ID3v2Parser } from './ID3v2Parser.js';
|
||||||
import { ID3v1Parser } from '../id3v1/ID3v1Parser';
|
import { ID3v1Parser } from '../id3v1/ID3v1Parser.js';
|
||||||
import { BasicParser } from '../common/BasicParser';
|
import { BasicParser } from '../common/BasicParser.js';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:ID3');
|
const debug = initDebug('music-metadata:parser:ID3');
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
|
|
||||||
import * as util from '../common/Util';
|
import * as util from '../common/Util.js';
|
||||||
import { AttachedPictureType, ID3v2MajorVersion, TextEncodingToken } from './ID3v2Token';
|
import { AttachedPictureType, ID3v2MajorVersion, TextEncodingToken } from './ID3v2Token.js';
|
||||||
import { IWarningCollector } from '../common/MetadataCollector';
|
import { Genres } from '../id3v1/ID3v1Parser.js';
|
||||||
import { Genres } from '../id3v1/ID3v1Parser';
|
|
||||||
|
import { IWarningCollector } from '../common/MetadataCollector.js';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:id3v2:frame-parser');
|
const debug = initDebug('music-metadata:id3v2:frame-parser');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {INativeTagMap} from '../common/GenericTagTypes';
|
import {INativeTagMap} from '../common/GenericTagTypes.js';
|
||||||
import {CaseInsensitiveTagMap} from '../common/CaseInsensitiveTagMap';
|
import {CaseInsensitiveTagMap} from '../common/CaseInsensitiveTagMap.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID3v2.2 tag mappings
|
* ID3v2.2 tag mappings
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { INativeTagMap } from '../common/GenericTagTypes';
|
import { INativeTagMap } from '../common/GenericTagTypes.js';
|
||||||
import { CommonTagMapper } from '../common/GenericTagMapper';
|
import { CommonTagMapper } from '../common/GenericTagMapper.js';
|
||||||
import { INativeMetadataCollector } from '../common/MetadataCollector';
|
import { CaseInsensitiveTagMap } from '../common/CaseInsensitiveTagMap.js';
|
||||||
import { CaseInsensitiveTagMap } from '../common/CaseInsensitiveTagMap';
|
import * as util from '../common/Util.js';
|
||||||
import * as util from '../common/Util';
|
|
||||||
|
|
||||||
import { IRating, ITag } from '../type';
|
import { INativeMetadataCollector } from '../common/MetadataCollector.js';
|
||||||
|
import { IRating, ITag } from '../type.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID3v2.3/ID3v2.4 tag mappings
|
* ID3v2.3/ID3v2.4 tag mappings
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import { ITokenizer } from 'strtok3/lib/core';
|
import { ITokenizer } from 'strtok3/core';
|
||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
|
|
||||||
import * as util from '../common/Util';
|
import * as util from '../common/Util.js';
|
||||||
import { TagType } from '../common/GenericTagTypes';
|
import { TagType } from '../common/GenericTagTypes.js';
|
||||||
import { ITag, IOptions } from '../type';
|
import { FrameParser } from './FrameParser.js';
|
||||||
import { FrameParser } from './FrameParser';
|
import { ExtendedHeader, ID3v2Header, ID3v2MajorVersion, IID3v2header, UINT32SYNCSAFE } from './ID3v2Token.js';
|
||||||
import { ExtendedHeader, ID3v2Header, ID3v2MajorVersion, IID3v2header, UINT32SYNCSAFE } from './ID3v2Token';
|
|
||||||
import { INativeMetadataCollector, IWarningCollector } from '../common/MetadataCollector';
|
import { ITag, IOptions } from '../type.js';
|
||||||
|
import { INativeMetadataCollector, IWarningCollector } from '../common/MetadataCollector.js';
|
||||||
|
|
||||||
interface IFrameFlags {
|
interface IFrameFlags {
|
||||||
status: {
|
status: {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import { IGetToken } from 'strtok3/lib/core';
|
import { IGetToken } from 'strtok3/core';
|
||||||
|
|
||||||
import * as util from '../common/Util';
|
import * as util from '../common/Util.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The picture type according to the ID3v2 APIC frame
|
* The picture type according to the ID3v2 APIC frame
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import { IGetToken } from 'strtok3/lib/core';
|
import { IGetToken } from 'strtok3/core';
|
||||||
|
|
||||||
import { FourCcToken } from '../common/FourCC';
|
import { FourCcToken } from '../common/FourCC.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "EA IFF 85" Standard for Interchange Format Files
|
* "EA IFF 85" Standard for Interchange Format Files
|
||||||
|
|||||||
+9
-35
@@ -1,17 +1,16 @@
|
|||||||
import * as Stream from 'stream';
|
import * as Stream from 'stream';
|
||||||
import * as strtok3 from 'strtok3';
|
import * as strtok3 from 'strtok3';
|
||||||
|
|
||||||
import * as Core from './core';
|
|
||||||
import { ParserFactory } from './ParserFactory';
|
|
||||||
import { IAudioMetadata, IOptions } from './type';
|
|
||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
import { RandomFileReader } from './common/RandomFileReader';
|
|
||||||
|
|
||||||
export { IAudioMetadata, IOptions, ITag, INativeTagDict, ICommonTagsResult, IFormat, IPicture, IRatio, IChapter } from './type';
|
import { parseFromTokenizer, scanAppendingHeaders } from './core.js';
|
||||||
|
import { ParserFactory } from './ParserFactory.js';
|
||||||
|
import { IAudioMetadata, IOptions } from './type.js';
|
||||||
|
import { RandomFileReader } from './common/RandomFileReader.js';
|
||||||
|
|
||||||
const debug = initDebug("music-metadata:parser");
|
export { IAudioMetadata, IOptions, ITag, INativeTagDict, ICommonTagsResult, IFormat, IPicture, IRatio, IChapter } from './type.js';
|
||||||
|
export { parseFromTokenizer, parseBuffer, selectCover, orderTags, ratingToStars, IFileInfo } from './core.js';
|
||||||
|
|
||||||
export { parseFromTokenizer, parseBuffer, IFileInfo, selectCover } from './core';
|
const debug = initDebug('music-metadata:parser');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse audio from Node Stream.Readable
|
* Parse audio from Node Stream.Readable
|
||||||
@@ -22,7 +21,7 @@ export { parseFromTokenizer, parseBuffer, IFileInfo, selectCover } from './core'
|
|||||||
*/
|
*/
|
||||||
export async function parseStream(stream: Stream.Readable, fileInfo?: strtok3.IFileInfo | string, options: IOptions = {}): Promise<IAudioMetadata> {
|
export async function parseStream(stream: Stream.Readable, fileInfo?: strtok3.IFileInfo | string, options: IOptions = {}): Promise<IAudioMetadata> {
|
||||||
const tokenizer = await strtok3.fromStream(stream, typeof fileInfo === 'string' ? {mimeType: fileInfo} : fileInfo);
|
const tokenizer = await strtok3.fromStream(stream, typeof fileInfo === 'string' ? {mimeType: fileInfo} : fileInfo);
|
||||||
return Core.parseFromTokenizer(tokenizer, options);
|
return parseFromTokenizer(tokenizer, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,7 +38,7 @@ export async function parseFile(filePath: string, options: IOptions = {}): Promi
|
|||||||
|
|
||||||
const fileReader = await RandomFileReader.init(filePath, fileTokenizer.fileInfo.size);
|
const fileReader = await RandomFileReader.init(filePath, fileTokenizer.fileInfo.size);
|
||||||
try {
|
try {
|
||||||
await Core.scanAppendingHeaders(fileReader, options);
|
await scanAppendingHeaders(fileReader, options);
|
||||||
} finally {
|
} finally {
|
||||||
await fileReader.close();
|
await fileReader.close();
|
||||||
}
|
}
|
||||||
@@ -54,28 +53,3 @@ export async function parseFile(filePath: string, options: IOptions = {}): Promi
|
|||||||
await fileTokenizer.close();
|
await fileTokenizer.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a dictionary ordered by their tag id (key)
|
|
||||||
* @param nativeTags - List of tags
|
|
||||||
* @returns Tags indexed by id
|
|
||||||
*/
|
|
||||||
export const orderTags = Core.orderTags;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert rating to 1-5 star rating
|
|
||||||
* @param rating - Normalized rating [0..1] (common.rating[n].rating)
|
|
||||||
* @returns Number of stars: 1, 2, 3, 4 or 5 stars
|
|
||||||
*/
|
|
||||||
export const ratingToStars = Core.ratingToStars;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define default module exports
|
|
||||||
*/
|
|
||||||
export default {
|
|
||||||
parseStream,
|
|
||||||
parseFile,
|
|
||||||
parseFromTokenizer: Core.parseFromTokenizer,
|
|
||||||
parseBuffer: Core.parseBuffer,
|
|
||||||
selectCover: Core.selectCover
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { IRandomReader } from '../type';
|
import { IRandomReader } from '../type.js';
|
||||||
|
|
||||||
export const endTag2 = 'LYRICS200';
|
export const endTag2 = 'LYRICS200';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { DataType, IContainerType } from './types';
|
import { DataType, IContainerType } from './types.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Elements of document type description
|
* Elements of document type description
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { Float32_BE, Float64_BE, StringType, UINT8 } from 'token-types';
|
import { Float32_BE, Float64_BE, StringType, UINT8 } from 'token-types';
|
||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
import { ITokenizer } from 'strtok3/lib/core';
|
import { ITokenizer } from 'strtok3/core';
|
||||||
|
|
||||||
import { INativeMetadataCollector } from '../common/MetadataCollector';
|
import { INativeMetadataCollector } from '../common/MetadataCollector.js';
|
||||||
import { IOptions, ITrackInfo } from '../type';
|
import { BasicParser } from '../common/BasicParser.js';
|
||||||
import { ITokenParser } from '../ParserFactory';
|
import * as matroskaDtd from './MatroskaDtd.js';
|
||||||
import { BasicParser } from '../common/BasicParser';
|
import { DataType, IContainerType, IHeader, IMatroskaDoc, ITree, TargetType, TrackType } from './types.js';
|
||||||
|
|
||||||
import { DataType, IContainerType, IHeader, IMatroskaDoc, ITree, TargetType, TrackType } from './types';
|
import { IOptions, ITrackInfo } from '../type.js';
|
||||||
import * as matroskaDtd from './MatroskaDtd';
|
import { ITokenParser } from '../ParserFactory.js';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:matroska');
|
const debug = initDebug('music-metadata:parser:matroska');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { INativeTagMap } from '../common/GenericTagTypes';
|
import {INativeTagMap} from '../common/GenericTagTypes.js';
|
||||||
import { CaseInsensitiveTagMap } from '../common/CaseInsensitiveTagMap';
|
import { CaseInsensitiveTagMap } from '../common/CaseInsensitiveTagMap.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EBML Tag map
|
* EBML Tag map
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import { ITokenizer } from 'strtok3/lib/core';
|
|
||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
|
import * as AtomToken from './AtomToken.js';
|
||||||
|
|
||||||
import * as AtomToken from './AtomToken';
|
import { ITokenizer } from 'strtok3/core';
|
||||||
|
|
||||||
export type AtomDataHandler = (atom: Atom, remaining: number) => Promise<void>;
|
export type AtomDataHandler = (atom: Atom, remaining: number) => Promise<void>;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
import { IToken, IGetToken } from 'strtok3/lib/core';
|
|
||||||
|
|
||||||
import { FourCcToken } from '../common/FourCC';
|
import { FourCcToken } from '../common/FourCC.js';
|
||||||
|
|
||||||
|
import { IToken, IGetToken } from 'strtok3/core';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:MP4:atom');
|
const debug = initDebug('music-metadata:parser:MP4:atom');
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
|
|
||||||
|
import { BasicParser } from '../common/BasicParser.js';
|
||||||
|
import { Genres } from '../id3v1/ID3v1Parser.js';
|
||||||
|
import { Atom } from './Atom.js';
|
||||||
|
import * as AtomToken from './AtomToken.js';
|
||||||
|
import { IChapter, ITrackInfo, TrackType } from '../type.js';
|
||||||
|
|
||||||
import { IGetToken } from '@tokenizer/token';
|
import { IGetToken } from '@tokenizer/token';
|
||||||
|
|
||||||
import { BasicParser } from '../common/BasicParser';
|
|
||||||
import { Genres } from '../id3v1/ID3v1Parser';
|
|
||||||
import { IChapter, ITrackInfo, TrackType } from '../type';
|
|
||||||
|
|
||||||
import { Atom } from './Atom';
|
|
||||||
import * as AtomToken from './AtomToken';
|
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:MP4');
|
const debug = initDebug('music-metadata:parser:MP4');
|
||||||
const tagFormat = 'iTunes';
|
const tagFormat = 'iTunes';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {INativeTagMap} from '../common/GenericTagTypes';
|
import { CaseInsensitiveTagMap } from '../common/CaseInsensitiveTagMap.js';
|
||||||
import {CaseInsensitiveTagMap} from '../common/CaseInsensitiveTagMap';
|
import { INativeTagMap } from '../common/GenericTagTypes.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ref: https://github.com/sergiomb2/libmp4v2/wiki/iTunesMetadata
|
* Ref: https://github.com/sergiomb2/libmp4v2/wiki/iTunesMetadata
|
||||||
@@ -112,7 +112,7 @@ export const tagType = 'iTunes';
|
|||||||
export class MP4TagMapper extends CaseInsensitiveTagMap {
|
export class MP4TagMapper extends CaseInsensitiveTagMap {
|
||||||
|
|
||||||
public constructor() {
|
public constructor() {
|
||||||
super([tagType], mp4TagMap);
|
super([tagType], mp4TagMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
* Extended Lame Header
|
* Extended Lame Header
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IGetToken } from 'strtok3/lib/core';
|
import { IGetToken } from 'strtok3/core';
|
||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import * as common from '../common/Util';
|
|
||||||
import { ReplayGain, IReplayGain } from './ReplayGainDataFormat';
|
import * as common from '../common/Util.js';
|
||||||
|
import { ReplayGain, IReplayGain } from './ReplayGainDataFormat.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LAME Tag, extends the Xing header format
|
* LAME Tag, extends the Xing header format
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import { EndOfStreamError } from 'strtok3/lib/core';
|
import { EndOfStreamError } from 'strtok3/core';
|
||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
|
|
||||||
import * as common from '../common/Util';
|
import * as common from '../common/Util.js';
|
||||||
import { AbstractID3Parser } from '../id3v2/AbstractID3Parser';
|
import { AbstractID3Parser } from '../id3v2/AbstractID3Parser.js';
|
||||||
import { InfoTagHeaderTag, IXingInfoTag, LameEncoderVersion, readXingHeader } from './XingTag';
|
import { InfoTagHeaderTag, IXingInfoTag, LameEncoderVersion, readXingHeader } from './XingTag.js';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:mpeg');
|
const debug = initDebug('music-metadata:parser:mpeg');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { IGetToken } from 'strtok3/lib/core';
|
import { IGetToken } from 'strtok3/core';
|
||||||
import * as common from '../common/Util';
|
import * as common from '../common/Util.js';
|
||||||
|
|
||||||
export interface IReplayGain {
|
export interface IReplayGain {
|
||||||
type: NameCode;
|
type: NameCode;
|
||||||
|
|||||||
+4
-3
@@ -1,7 +1,8 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import { IGetToken, ITokenizer } from 'strtok3/lib/core';
|
import { IGetToken, ITokenizer } from 'strtok3/core';
|
||||||
import * as util from '../common/Util';
|
|
||||||
import { ExtendedLameHeader, IExtendedLameHeader } from './ExtendedLameHeader';
|
import * as util from '../common/Util.js';
|
||||||
|
import { ExtendedLameHeader, IExtendedLameHeader } from './ExtendedLameHeader.js';
|
||||||
|
|
||||||
export interface IXingHeaderFlags {
|
export interface IXingHeaderFlags {
|
||||||
frames: boolean;
|
frames: boolean;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
|
|
||||||
import { ITokenParser } from '../ParserFactory';
|
import { ITokenParser } from '../ParserFactory.js';
|
||||||
import { AbstractID3Parser } from '../id3v2/AbstractID3Parser';
|
import { AbstractID3Parser } from '../id3v2/AbstractID3Parser.js';
|
||||||
|
|
||||||
import { MpcSv8Parser } from './sv8/MpcSv8Parser';
|
import { MpcSv8Parser } from './sv8/MpcSv8Parser.js';
|
||||||
import { MpcSv7Parser } from './sv7/MpcSv7Parser';
|
import { MpcSv7Parser } from './sv7/MpcSv7Parser.js';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:musepack');
|
const debug = initDebug('music-metadata:parser:musepack');
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ITokenizer } from 'strtok3/lib/core';
|
import { ITokenizer } from 'strtok3/core';
|
||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
|
|
||||||
export class BitReader {
|
export class BitReader {
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
|
|
||||||
import { BasicParser } from '../../common/BasicParser';
|
import { BasicParser } from '../../common/BasicParser.js';
|
||||||
import { APEv2Parser } from '../../apev2/APEv2Parser';
|
import { APEv2Parser } from '../../apev2/APEv2Parser.js';
|
||||||
|
import { BitReader } from './BitReader.js';
|
||||||
import { BitReader } from './BitReader';
|
import * as SV7 from './StreamVersion7.js';
|
||||||
import * as SV7 from './StreamVersion7';
|
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:musepack');
|
const debug = initDebug('music-metadata:parser:musepack');
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import { IGetToken } from 'strtok3/lib/core';
|
import { IGetToken } from 'strtok3/core';
|
||||||
|
|
||||||
import * as util from '../../common/Util';
|
import * as util from '../../common/Util.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MusePack stream version 7 format specification
|
* MusePack stream version 7 format specification
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
|
|
||||||
import { BasicParser } from '../../common/BasicParser';
|
import { BasicParser } from '../../common/BasicParser.js';
|
||||||
import { APEv2Parser } from '../../apev2/APEv2Parser';
|
import { APEv2Parser } from '../../apev2/APEv2Parser.js';
|
||||||
import { FourCcToken } from '../../common/FourCC';
|
import { FourCcToken } from '../../common/FourCC.js';
|
||||||
|
import * as SV8 from './StreamVersion8.js';
|
||||||
import * as SV8 from './StreamVersion8';
|
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:musepack');
|
const debug = initDebug('music-metadata:parser:musepack');
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import { ITokenizer, IGetToken } from 'strtok3/lib/core';
|
import { ITokenizer, IGetToken } from 'strtok3/core';
|
||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
|
|
||||||
import * as util from '../../common/Util';
|
import * as util from '../../common/Util.js';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:musepack:sv8');
|
const debug = initDebug('music-metadata:parser:musepack:sv8');
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import { IGetToken, EndOfStreamError } from 'strtok3/lib/core';
|
import { IGetToken, EndOfStreamError } from 'strtok3/core';
|
||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
|
|
||||||
import * as util from '../common/Util';
|
import * as util from '../common/Util.js';
|
||||||
import { FourCcToken } from '../common/FourCC';
|
import { FourCcToken } from '../common/FourCC.js';
|
||||||
import { BasicParser } from '../common/BasicParser';
|
import { BasicParser } from '../common/BasicParser.js';
|
||||||
|
|
||||||
import { VorbisParser } from './vorbis/VorbisParser';
|
import { VorbisParser } from './vorbis/VorbisParser.js';
|
||||||
import { OpusParser } from './opus/OpusParser';
|
import { OpusParser } from './opus/OpusParser.js';
|
||||||
import { SpeexParser } from './speex/SpeexParser';
|
import { SpeexParser } from './speex/SpeexParser.js';
|
||||||
import { TheoraParser } from './theora/TheoraParser';
|
import { TheoraParser } from './theora/TheoraParser.js';
|
||||||
|
|
||||||
import * as Ogg from './Ogg';
|
import * as Ogg from './Ogg.js';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:ogg');
|
const debug = initDebug('music-metadata:parser:ogg');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import { IGetToken } from 'strtok3/lib/core';
|
import { IGetToken } from 'strtok3/core';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opus ID Header interface
|
* Opus ID Header interface
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import {ITokenizer} from 'strtok3/lib/core';
|
import {ITokenizer} from 'strtok3/core';
|
||||||
|
|
||||||
import {IPageHeader} from '../Ogg';
|
import {IPageHeader} from '../Ogg.js';
|
||||||
import {VorbisParser} from '../vorbis/VorbisParser';
|
import {VorbisParser} from '../vorbis/VorbisParser.js';
|
||||||
import {IOptions} from '../../type';
|
import {IOptions} from '../../type.js';
|
||||||
import {INativeMetadataCollector} from '../../common/MetadataCollector';
|
import {INativeMetadataCollector} from '../../common/MetadataCollector.js';
|
||||||
|
|
||||||
import * as Opus from './Opus';
|
import * as Opus from './Opus.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opus parser
|
* Opus parser
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import { IGetToken } from 'strtok3/lib/core';
|
import { IGetToken } from 'strtok3/core';
|
||||||
|
|
||||||
import * as util from '../../common/Util';
|
import * as util from '../../common/Util.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Speex Header Packet
|
* Speex Header Packet
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import {ITokenizer} from 'strtok3/lib/core';
|
import { ITokenizer } from 'strtok3/core';
|
||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
|
|
||||||
import {IPageHeader} from '../Ogg';
|
import { IPageHeader } from '../Ogg.js';
|
||||||
import {VorbisParser} from '../vorbis/VorbisParser';
|
import { VorbisParser } from '../vorbis/VorbisParser.js';
|
||||||
import {IOptions} from '../../type';
|
import * as Speex from './Speex.js';
|
||||||
import {INativeMetadataCollector} from '../../common/MetadataCollector';
|
|
||||||
|
|
||||||
import * as Speex from './Speex';
|
import { IOptions } from '../../type.js';
|
||||||
|
import { INativeMetadataCollector } from '../../common/MetadataCollector.js';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:ogg:speex');
|
const debug = initDebug('music-metadata:parser:ogg:speex');
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import { IGetToken } from 'strtok3/lib/core';
|
import { IGetToken } from 'strtok3/core';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 6.2 Identification Header
|
* 6.2 Identification Header
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import { ITokenizer } from 'strtok3/lib/core';
|
import { ITokenizer } from 'strtok3/core';
|
||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
|
|
||||||
import { IOptions } from '../../type';
|
import * as Ogg from '../Ogg.js';
|
||||||
import { INativeMetadataCollector } from '../../common/MetadataCollector';
|
import { IOptions } from '../../type.js';
|
||||||
import * as Ogg from '../Ogg';
|
import { INativeMetadataCollector } from '../../common/MetadataCollector.js';
|
||||||
|
import { IdentificationHeader } from './Theora.js';
|
||||||
import { IdentificationHeader } from './Theora';
|
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:ogg:theora');
|
const debug = initDebug('music-metadata:parser:ogg:theora');
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import { IGetToken } from 'strtok3/lib/core';
|
|
||||||
|
|
||||||
import {AttachedPictureType} from '../../id3v2/ID3v2Token';
|
import { AttachedPictureType } from '../../id3v2/ID3v2Token.js';
|
||||||
import {IPicture} from '../../type';
|
|
||||||
|
import { IPicture } from '../../type.js';
|
||||||
|
import { IGetToken } from 'strtok3/core';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface to parsed result of METADATA_BLOCK_PICTURE
|
* Interface to parsed result of METADATA_BLOCK_PICTURE
|
||||||
@@ -40,6 +41,7 @@ export class VorbisPictureToken implements IGetToken<IVorbisPicture> {
|
|||||||
const pic = new VorbisPictureToken(buffer.length);
|
const pic = new VorbisPictureToken(buffer.length);
|
||||||
return pic.get(buffer, 0);
|
return pic.get(buffer, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(public len) {
|
constructor(public len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import initDebug from 'debug';
|
import debugInit from 'debug';
|
||||||
|
|
||||||
import {IOptions} from '../../type';
|
import { VorbisDecoder } from './VorbisDecoder.js';
|
||||||
import {INativeMetadataCollector} from '../../common/MetadataCollector';
|
import { CommonHeader, IdentificationHeader, IVorbisPicture, VorbisPictureToken } from './Vorbis.js';
|
||||||
import * as Ogg from '../Ogg';
|
|
||||||
|
|
||||||
import { VorbisDecoder } from './VorbisDecoder';
|
import { IPageConsumer, IPageHeader } from '../Ogg.js';
|
||||||
import { CommonHeader, IdentificationHeader, IVorbisPicture, VorbisPictureToken } from './Vorbis';
|
import { IOptions } from '../../type.js';
|
||||||
|
import { INativeMetadataCollector } from '../../common/MetadataCollector.js';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:ogg:vorbis1');
|
const debug = debugInit('music-metadata:parser:ogg:vorbis1');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vorbis 1 Parser.
|
* Vorbis 1 Parser.
|
||||||
* Used by OggParser
|
* Used by OggParser
|
||||||
*/
|
*/
|
||||||
export class VorbisParser implements Ogg.IPageConsumer {
|
export class VorbisParser implements IPageConsumer {
|
||||||
|
|
||||||
private pageSegments: Buffer[] = [];
|
private pageSegments: Buffer[] = [];
|
||||||
|
|
||||||
@@ -26,13 +26,13 @@ export class VorbisParser implements Ogg.IPageConsumer {
|
|||||||
* @param header Ogg Page Header
|
* @param header Ogg Page Header
|
||||||
* @param pageData Page data
|
* @param pageData Page data
|
||||||
*/
|
*/
|
||||||
public parsePage(header: Ogg.IPageHeader, pageData: Buffer) {
|
public parsePage(header: IPageHeader, pageData: Buffer) {
|
||||||
if (header.headerType.firstPage) {
|
if (header.headerType.firstPage) {
|
||||||
this.parseFirstPage(header, pageData);
|
this.parseFirstPage(header, pageData);
|
||||||
} else {
|
} else {
|
||||||
if (header.headerType.continued) {
|
if (header.headerType.continued) {
|
||||||
if (this.pageSegments.length === 0) {
|
if (this.pageSegments.length === 0) {
|
||||||
throw new Error("Cannot continue on previous page");
|
throw new Error('Cannot continue on previous page');
|
||||||
}
|
}
|
||||||
this.pageSegments.push(pageData);
|
this.pageSegments.push(pageData);
|
||||||
}
|
}
|
||||||
@@ -79,22 +79,22 @@ export class VorbisParser implements Ogg.IPageConsumer {
|
|||||||
this.metadata.addTag('vorbis', id, value);
|
this.metadata.addTag('vorbis', id, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public calculateDuration(header: Ogg.IPageHeader) {
|
public calculateDuration(header: IPageHeader) {
|
||||||
if (this.metadata.format.sampleRate && header.absoluteGranulePosition >= 0) {
|
if (this.metadata.format.sampleRate && header.absoluteGranulePosition >= 0) {
|
||||||
// Calculate duration
|
// Calculate duration
|
||||||
this.metadata.setFormat('numberOfSamples', header.absoluteGranulePosition);
|
this.metadata.setFormat('numberOfSamples', header.absoluteGranulePosition);
|
||||||
this.metadata.setFormat('duration', this.metadata.format.numberOfSamples / this.metadata.format.sampleRate);
|
this.metadata.setFormat('duration', this.metadata.format.numberOfSamples / this.metadata.format.sampleRate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse first Ogg/Vorbis page
|
* Parse first Ogg/Vorbis page
|
||||||
* @param {IPageHeader} header
|
* @param header
|
||||||
* @param {Buffer} pageData
|
* @param pageData
|
||||||
*/
|
*/
|
||||||
protected parseFirstPage(header: Ogg.IPageHeader, pageData: Buffer) {
|
protected parseFirstPage(header: IPageHeader, pageData: Buffer) {
|
||||||
this.metadata.setFormat('codec', 'Vorbis I');
|
this.metadata.setFormat('codec', 'Vorbis I');
|
||||||
debug("Parse first page");
|
debug('Parse first page');
|
||||||
// Parse Vorbis common header
|
// Parse Vorbis common header
|
||||||
const commonHeader = CommonHeader.get(pageData, 0);
|
const commonHeader = CommonHeader.get(pageData, 0);
|
||||||
if (commonHeader.vorbis !== 'vorbis')
|
if (commonHeader.vorbis !== 'vorbis')
|
||||||
@@ -105,14 +105,14 @@ export class VorbisParser implements Ogg.IPageConsumer {
|
|||||||
this.metadata.setFormat('sampleRate', idHeader.sampleRate);
|
this.metadata.setFormat('sampleRate', idHeader.sampleRate);
|
||||||
this.metadata.setFormat('bitrate', idHeader.bitrateNominal);
|
this.metadata.setFormat('bitrate', idHeader.bitrateNominal);
|
||||||
this.metadata.setFormat('numberOfChannels', idHeader.channelMode);
|
this.metadata.setFormat('numberOfChannels', idHeader.channelMode);
|
||||||
debug("sample-rate=%s[hz], bitrate=%s[b/s], channel-mode=%s", idHeader.sampleRate, idHeader.bitrateNominal, idHeader.channelMode);
|
debug('sample-rate=%s[hz], bitrate=%s[b/s], channel-mode=%s', idHeader.sampleRate, idHeader.bitrateNominal, idHeader.channelMode);
|
||||||
} else throw new Error('First Ogg page should be type 1: the identification header');
|
} else throw new Error('First Ogg page should be type 1: the identification header');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected parseFullPage(pageData: Buffer) {
|
protected parseFullPage(pageData: Buffer) {
|
||||||
// New page
|
// New page
|
||||||
const commonHeader = CommonHeader.get(pageData, 0);
|
const commonHeader = CommonHeader.get(pageData, 0);
|
||||||
debug("Parse full page: type=%s, byteLength=%s", commonHeader.packetType, pageData.byteLength);
|
debug('Parse full page: type=%s, byteLength=%s', commonHeader.packetType, pageData.byteLength);
|
||||||
switch (commonHeader.packetType) {
|
switch (commonHeader.packetType) {
|
||||||
|
|
||||||
case 3: // type 3: comment header
|
case 3: // type 3: comment header
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { INativeTagMap } from '../../common/GenericTagTypes';
|
import { INativeTagMap } from '../../common/GenericTagTypes.js';
|
||||||
import { CommonTagMapper } from '../../common/GenericTagMapper';
|
import { CommonTagMapper } from '../../common/GenericTagMapper.js';
|
||||||
import { IRating, ITag } from '../../type';
|
|
||||||
|
import { IRating, ITag } from '../../type.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vorbis tag mappings
|
* Vorbis tag mappings
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import { IGetToken } from 'strtok3/lib/core';
|
import { IGetToken } from 'strtok3/core';
|
||||||
|
import { IChunkHeader } from '../iff/index.js';
|
||||||
|
|
||||||
import {IChunkHeader} from '../iff';
|
export { IChunkHeader } from '../iff/index.js';
|
||||||
export {IChunkHeader} from '../iff';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common RIFF chunk header
|
* Common RIFF chunk header
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {INativeTagMap} from '../common/GenericTagTypes';
|
import {INativeTagMap} from '../common/GenericTagTypes.js';
|
||||||
import {CommonTagMapper} from '../common/GenericTagMapper';
|
import {CommonTagMapper} from '../common/GenericTagMapper.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RIFF Info Tags; part of the EXIF 2.3
|
* RIFF Info Tags; part of the EXIF 2.3
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "../tsconfig.json",
|
"extends": "../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declaration": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-4
@@ -1,8 +1,10 @@
|
|||||||
import { GenericTagId, TagType } from './common/GenericTagTypes';
|
import { Buffer } from 'node:buffer';
|
||||||
import { IFooter } from './apev2/APEv2Token';
|
|
||||||
import { TrackType } from './matroska/types';
|
|
||||||
|
|
||||||
export { TrackType } from './matroska/types';
|
import { GenericTagId, TagType } from './common/GenericTagTypes.js';
|
||||||
|
import { IFooter } from './apev2/APEv2Token.js';
|
||||||
|
import { TrackType } from './matroska/types.js';
|
||||||
|
|
||||||
|
export { TrackType } from './matroska/types.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attached picture, typically used for cover art
|
* Attached picture, typically used for cover art
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { IGetToken } from 'strtok3/lib/core';
|
import { IGetToken } from 'strtok3/lib/core.js';
|
||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
|
|
||||||
export interface IBroadcastAudioExtensionChunk {
|
export interface IBroadcastAudioExtensionChunk {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { IGetToken } from 'strtok3/lib/core';
|
import { IGetToken } from 'strtok3/core';
|
||||||
|
import { IChunkHeader } from '../iff/index.js';
|
||||||
import { IChunkHeader } from '../iff';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/dd317599(v=vs.85).aspx
|
* Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/dd317599(v=vs.85).aspx
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import * as strtok3 from 'strtok3/lib/core';
|
import * as strtok3 from 'strtok3/core';
|
||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
|
|
||||||
import * as riff from '../riff/RiffChunk';
|
import * as riff from '../riff/RiffChunk.js';
|
||||||
import * as WaveChunk from './../wav/WaveChunk';
|
import * as WaveChunk from './../wav/WaveChunk.js';
|
||||||
import { ID3v2Parser } from '../id3v2/ID3v2Parser';
|
import { ID3v2Parser } from '../id3v2/ID3v2Parser.js';
|
||||||
import * as util from '../common/Util';
|
import * as util from '../common/Util.js';
|
||||||
import { FourCcToken } from '../common/FourCC';
|
import { FourCcToken } from '../common/FourCC.js';
|
||||||
import { BasicParser } from '../common/BasicParser';
|
import { BasicParser } from '../common/BasicParser.js';
|
||||||
import { BroadcastAudioExtensionChunk } from '../wav/BwfChunk';
|
import { BroadcastAudioExtensionChunk } from '../wav/BwfChunk.js';
|
||||||
|
|
||||||
const debug = initDebug('music-metadata:parser:RIFF');
|
const debug = initDebug('music-metadata:parser:RIFF');
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
|
|
||||||
import { APEv2Parser } from '../apev2/APEv2Parser';
|
import { APEv2Parser } from '../apev2/APEv2Parser.js';
|
||||||
import { FourCcToken } from '../common/FourCC';
|
import { FourCcToken } from '../common/FourCC.js';
|
||||||
import { BasicParser } from '../common/BasicParser';
|
import { BasicParser } from '../common/BasicParser.js';
|
||||||
|
import { IBlockHeader, IMetadataId, WavPack } from './WavPackToken.js';
|
||||||
import { IBlockHeader, IMetadataId, WavPack } from './WavPackToken';
|
|
||||||
|
|
||||||
import initDebug from 'debug';
|
import initDebug from 'debug';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import * as Token from 'token-types';
|
import * as Token from 'token-types';
|
||||||
import { IGetToken } from 'strtok3/lib/core';
|
|
||||||
|
|
||||||
import { FourCcToken } from '../common/FourCC';
|
import { FourCcToken } from '../common/FourCC.js';
|
||||||
|
|
||||||
|
import { IGetToken } from 'strtok3/core';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WavPack Block Header
|
* WavPack Block Header
|
||||||
|
|||||||
+23
-33
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "music-metadata",
|
"name": "music-metadata",
|
||||||
"description": "Music metadata parser for Node.js, supporting virtual any audio and tag format.",
|
"description": "Music metadata parser for Node.js, supporting virtual any audio and tag format.",
|
||||||
"version": "7.12.1",
|
"version": "8.0.0-alpha.0",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Borewit",
|
"name": "Borewit",
|
||||||
"url": "https://github.com/Borewit"
|
"url": "https://github.com/Borewit"
|
||||||
@@ -10,6 +10,18 @@
|
|||||||
"type": "github",
|
"type": "github",
|
||||||
"url": "https://github.com/sponsors/Borewit"
|
"url": "https://github.com/sponsors/Borewit"
|
||||||
},
|
},
|
||||||
|
"type": "module",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"node": "./lib/index.js",
|
||||||
|
"default": "./lib/core.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"types": "lib/index.d.ts",
|
||||||
|
"files": [
|
||||||
|
"lib/**/*.js",
|
||||||
|
"lib/**/*.d.ts"
|
||||||
|
],
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"music",
|
"music",
|
||||||
"metadata",
|
"metadata",
|
||||||
@@ -60,12 +72,6 @@
|
|||||||
"parser",
|
"parser",
|
||||||
"bwf"
|
"bwf"
|
||||||
],
|
],
|
||||||
"main": "lib/index.js",
|
|
||||||
"types": "lib/index.d.ts",
|
|
||||||
"files": [
|
|
||||||
"lib/**/*.js",
|
|
||||||
"lib/**/*.d.ts"
|
|
||||||
],
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts src/**/*.d.ts test/**/*.js test/**/*.js.map test/**/*.js test/**/*.js.map doc-gen/**/*.js doc-gen/**/*.js.map",
|
"clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts src/**/*.d.ts test/**/*.js test/**/*.js.map test/**/*.js test/**/*.js.map doc-gen/**/*.js doc-gen/**/*.js.map",
|
||||||
"compile-src": "tsc -p lib",
|
"compile-src": "tsc -p lib",
|
||||||
@@ -75,22 +81,22 @@
|
|||||||
"eslint": "eslint lib/**/*.ts --ignore-pattern lib/**/*.d.ts example/typescript/**/*.ts test/**/*.ts doc-gen/**/*.ts",
|
"eslint": "eslint lib/**/*.ts --ignore-pattern lib/**/*.d.ts example/typescript/**/*.ts test/**/*.ts doc-gen/**/*.ts",
|
||||||
"lint-md": "remark -u preset-lint-recommended .",
|
"lint-md": "remark -u preset-lint-recommended .",
|
||||||
"lint": "npm run lint-md && npm run eslint",
|
"lint": "npm run lint-md && npm run eslint",
|
||||||
"test": "mocha --require ts-node/register --require source-map-support/register --full-trace test/test-*.ts",
|
"test": "mocha",
|
||||||
"build": "npm run clean && npm run compile && npm run doc-gen",
|
"build": "npm run clean && npm run compile && npm run doc-gen",
|
||||||
"start": "npm-run-all compile lint cover-test",
|
"start": "npm-run-all compile lint cover-test",
|
||||||
"test-coverage": "nyc npm run test",
|
"test-coverage": "c8 npm run test",
|
||||||
"send-coveralls": "nyc report --reporter=text-lcov | coveralls",
|
"send-coveralls": "c8 report --reporter=text-lcov | coveralls",
|
||||||
"send-codacy": "nyc report --reporter=text-lcov | codacy-coverage",
|
"send-codacy": "c8 report --reporter=text-lcov | codacy-coverage",
|
||||||
"doc-gen": "node doc-gen/gen.js"
|
"doc-gen": "node doc-gen/gen.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tokenizer/token": "^0.3.0",
|
"@tokenizer/token": "^0.3.0",
|
||||||
"content-type": "^1.0.4",
|
"content-type": "^1.0.4",
|
||||||
"debug": "^4.3.3",
|
"debug": "^4.3.3",
|
||||||
"file-type": "16.5.3",
|
"file-type": "^17.1.1",
|
||||||
"media-typer": "^1.1.0",
|
"media-typer": "^1.1.0",
|
||||||
"strtok3": "^6.2.4",
|
"strtok3": "^7.0.0-alpha.8",
|
||||||
"token-types": "^4.2.0"
|
"token-types": "^5.0.0-alpha.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chai": "^4.3.0",
|
"@types/chai": "^4.3.0",
|
||||||
@@ -100,6 +106,7 @@
|
|||||||
"@types/node": "^17.0.21",
|
"@types/node": "^17.0.21",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.12.1",
|
"@typescript-eslint/eslint-plugin": "^5.12.1",
|
||||||
"@typescript-eslint/parser": "^5.12.1",
|
"@typescript-eslint/parser": "^5.12.1",
|
||||||
|
"c8": "^7.10.0",
|
||||||
"chai": "^4.3.6",
|
"chai": "^4.3.6",
|
||||||
"coveralls": "^3.1.1",
|
"coveralls": "^3.1.1",
|
||||||
"del-cli": "4.0.1",
|
"del-cli": "4.0.1",
|
||||||
@@ -113,15 +120,14 @@
|
|||||||
"mime": "^3.0.0",
|
"mime": "^3.0.0",
|
||||||
"mocha": "^9.2.1",
|
"mocha": "^9.2.1",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"nyc": "^15.1.0",
|
"prettier": "^2.5.1",
|
||||||
"remark-cli": "^10.0.1",
|
"remark-cli": "^10.0.1",
|
||||||
"remark-preset-lint-recommended": "^6.1.2",
|
"remark-preset-lint-recommended": "^6.1.2",
|
||||||
"source-map-support": "^0.5.21",
|
|
||||||
"ts-node": "^10.5.0",
|
"ts-node": "^10.5.0",
|
||||||
"typescript": "^4.5.5"
|
"typescript": "^4.5.5"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10"
|
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -130,21 +136,5 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/Borewit/music-metadata/issues"
|
"url": "https://github.com/Borewit/music-metadata/issues"
|
||||||
},
|
|
||||||
"nyc": {
|
|
||||||
"exclude": [
|
|
||||||
"test/**/*.ts",
|
|
||||||
"src/**/*.js"
|
|
||||||
],
|
|
||||||
"extension": [
|
|
||||||
".ts"
|
|
||||||
],
|
|
||||||
"sourceMap": true,
|
|
||||||
"instrument": true,
|
|
||||||
"reporter": [
|
|
||||||
"lcov",
|
|
||||||
"text"
|
|
||||||
],
|
|
||||||
"report-dir": "coverage"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as fs from 'fs';
|
import fs from 'node:fs';
|
||||||
|
|
||||||
import * as mm from '../lib';
|
import * as mm from '../lib/index.js';
|
||||||
import { IAudioMetadata, IOptions } from '../lib/type';
|
import { IAudioMetadata, IOptions } from '../lib/index.js';
|
||||||
|
|
||||||
type ParseFileMethod = (filePath: string, mimeType?: string, options?: IOptions) => Promise<IAudioMetadata>;
|
type ParseFileMethod = (filePath: string, mimeType?: string, options?: IOptions) => Promise<IAudioMetadata>;
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import * as mm from '../lib';
|
import * as mm from '../lib/index.js';
|
||||||
import { samplePath } from './util';
|
import { samplePath } from './util.js';
|
||||||
|
|
||||||
describe('Asynchronous observer updates', () => {
|
describe('Asynchronous observer updates', () => {
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import { samplePath } from './util';
|
import { samplePath } from './util.js';
|
||||||
import * as mm from '../lib';
|
import * as mm from '../lib/index.js';
|
||||||
|
|
||||||
const t = assert;
|
const t = assert;
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -1,13 +1,13 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import { commonTags, isSingleton } from '../lib/common/GenericTagTypes';
|
import { commonTags, isSingleton } from '../lib/common/GenericTagTypes.js';
|
||||||
import * as mm from '../lib';
|
import * as mm from '../lib/index.js';
|
||||||
import { CombinedTagMapper } from '../lib/common/CombinedTagMapper';
|
import { CombinedTagMapper } from '../lib/common/CombinedTagMapper.js';
|
||||||
import { joinArtists } from '../lib/common/MetadataCollector';
|
import { joinArtists } from '../lib/common/MetadataCollector.js';
|
||||||
import { parseHttpContentType } from '../lib/ParserFactory';
|
import { parseHttpContentType } from '../lib/ParserFactory.js';
|
||||||
|
|
||||||
import { samplePath } from './util';
|
import { samplePath } from './util.js';
|
||||||
|
|
||||||
describe('GenericTagMap', () => {
|
describe('GenericTagMap', () => {
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ describe('GenericTagMap', () => {
|
|||||||
|
|
||||||
it('parse RIFF tags', async () => {
|
it('parse RIFF tags', async () => {
|
||||||
|
|
||||||
const filePath = path.join(__dirname, 'samples', 'issue-89 no-artist.aiff');
|
const filePath = path.join(samplePath, 'issue-89 no-artist.aiff');
|
||||||
|
|
||||||
const metadata = await mm.parseFile(filePath, {duration: true});
|
const metadata = await mm.parseFile(filePath, {duration: true});
|
||||||
assert.deepEqual(metadata.common.artists, ['Beth Hart', 'Joe Bonamassa'], 'common.artists directly via WM/ARTISTS');
|
assert.deepEqual(metadata.common.artists, ['Beth Hart', 'Joe Bonamassa'], 'common.artists directly via WM/ARTISTS');
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import {assert} from 'chai';
|
import {assert} from 'chai';
|
||||||
import * as mm from '../lib';
|
import * as mm from '../lib/index.js';
|
||||||
import * as fs from 'fs';
|
import fs from 'node:fs';
|
||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
import { samplePath } from './util';
|
import { samplePath } from './util.js';
|
||||||
|
|
||||||
const t = assert;
|
const t = assert;
|
||||||
|
|
||||||
it("should handle concurrent parsing of pictures", () => {
|
it("should handle concurrent parsing of pictures", () => {
|
||||||
|
|
||||||
const files = [path.join(samplePath, 'flac.flac'), path.join(__dirname, 'samples', 'flac-bug.flac')];
|
const files = [path.join(samplePath, 'flac.flac'), path.join(samplePath, 'flac-bug.flac')];
|
||||||
|
|
||||||
return Promise.all<any>(files.map(file => {
|
return Promise.all<any>(files.map(file => {
|
||||||
return mm.parseFile(file).then(result => {
|
return mm.parseFile(file).then(result => {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import * as mm from '../lib';
|
import * as mm from '../lib/index.js';
|
||||||
import { ID3v24TagMapper } from '../lib/id3v2/ID3v24TagMapper';
|
import { ID3v24TagMapper } from '../lib/id3v2/ID3v24TagMapper.js';
|
||||||
import { VorbisTagMapper } from '../lib/ogg/vorbis/VorbisTagMapper';
|
import { VorbisTagMapper } from '../lib/ogg/vorbis/VorbisTagMapper.js';
|
||||||
import { samplePath } from './util';
|
import { samplePath } from './util.js';
|
||||||
|
|
||||||
describe('Discogs mappings', () => {
|
describe('Discogs mappings', () => {
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -1,8 +1,9 @@
|
|||||||
import {assert} from 'chai';
|
import {assert} from 'chai';
|
||||||
import * as path from 'path';
|
|
||||||
|
|
||||||
import * as mm from '../lib';
|
import path from 'node:path';
|
||||||
import { samplePath } from './util';
|
|
||||||
|
import * as mm from '../lib/index.js';
|
||||||
|
import { samplePath } from './util.js';
|
||||||
|
|
||||||
describe('Parse Philips DSDIFF', () => {
|
describe('Parse Philips DSDIFF', () => {
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
import { Parsers } from './metadata-parsers';
|
|
||||||
import { IFormat } from '../lib';
|
import { Parsers } from './metadata-parsers.js';
|
||||||
import { samplePath } from './util';
|
|
||||||
|
import { IFormat } from '../lib/index.js';
|
||||||
|
import { samplePath } from './util.js';
|
||||||
|
|
||||||
const aacSamplePath = path.join(samplePath, 'aac');
|
const aacSamplePath = path.join(samplePath, 'aac');
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
import { Parsers } from './metadata-parsers';
|
import { Parsers } from './metadata-parsers.js';
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import * as mm from '../lib';
|
import * as mm from '../lib/index.js';
|
||||||
import { samplePath } from './util';
|
import { samplePath} from './util.js';
|
||||||
|
|
||||||
describe('Parse AIFF (Audio Interchange File Format)', () => {
|
describe('Parse AIFF (Audio Interchange File Format)', () => {
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import * as mm from '../lib';
|
import * as mm from '../lib/index.js';
|
||||||
import { Parsers } from './metadata-parsers';
|
import { Parsers } from './metadata-parsers.js';
|
||||||
import { samplePath } from './util';
|
import { samplePath } from './util.js';
|
||||||
|
|
||||||
describe('Parse APE (Monkey\'s Audio)', () => {
|
describe('Parse APE (Monkey\'s Audio)', () => {
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import * as mm from '../lib';
|
import * as mm from '../lib/index.js';
|
||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
import GUID from '../lib/asf/GUID';
|
import GUID from '../lib/asf/GUID.js';
|
||||||
import { AsfUtil } from '../lib/asf/AsfUtil';
|
import { AsfUtil } from '../lib/asf/AsfUtil.js';
|
||||||
import { DataType } from '../lib/asf/AsfObject';
|
import { DataType } from '../lib/asf/AsfObject.js';
|
||||||
import { Parsers } from './metadata-parsers';
|
import { Parsers } from './metadata-parsers.js';
|
||||||
import { samplePath } from './util';
|
|
||||||
|
import { samplePath } from './util.js';
|
||||||
|
|
||||||
describe('Parse ASF', () => {
|
describe('Parse ASF', () => {
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import {assert} from 'chai';
|
import {assert} from 'chai';
|
||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import * as mm from '../lib';
|
import * as mm from '../lib/index.js';
|
||||||
import { samplePath } from './util';
|
import { samplePath } from './util.js';
|
||||||
|
|
||||||
describe('Parse Sony DSF (DSD Stream File)', () => {
|
describe('Parse Sony DSF (DSD Stream File)', () => {
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import * as mm from '../lib';
|
import fs from 'node:fs';
|
||||||
import * as fs from 'fs';
|
import * as path from 'node:path';
|
||||||
import * as path from 'path';
|
|
||||||
import { Parsers } from './metadata-parsers';
|
import * as mm from '../lib/index.js';
|
||||||
import { samplePath } from './util';
|
import { Parsers } from './metadata-parsers.js';
|
||||||
|
import { samplePath } from './util.js';
|
||||||
|
|
||||||
const t = assert;
|
const t = assert;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
import * as mm from '../lib';
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { samplePath } from './util';
|
|
||||||
|
import * as mm from '../lib/index.js';
|
||||||
|
import { samplePath } from './util.js';
|
||||||
|
|
||||||
describe('Matroska formats', () => {
|
describe('Matroska formats', () => {
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import * as mm from '../lib';
|
import * as mm from '../lib/index.js';
|
||||||
import { Parsers } from './metadata-parsers';
|
import { Parsers } from './metadata-parsers.js';
|
||||||
import { samplePath } from './util';
|
import { samplePath } from './util.js';
|
||||||
|
|
||||||
describe('Parse MP3 files', () => {
|
describe('Parse MP3 files', () => {
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
import * as fs from 'fs';
|
import fs from 'node:fs';
|
||||||
|
|
||||||
import * as mm from '../lib';
|
import * as mm from '../lib/index.js';
|
||||||
import { Parsers } from './metadata-parsers';
|
import { Parsers } from './metadata-parsers.js';
|
||||||
import { samplePath } from './util';
|
import { samplePath } from './util.js';
|
||||||
|
|
||||||
const t = assert;
|
const t = assert;
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import * as fs from 'fs';
|
import fs from 'node:fs';
|
||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import { samplePath, SourceStream } from './util';
|
import { samplePath, SourceStream } from './util.js';
|
||||||
import { ID3v24TagMapper } from '../lib/id3v2/ID3v24TagMapper';
|
import { ID3v24TagMapper } from '../lib/id3v2/ID3v24TagMapper.js';
|
||||||
import { Parsers } from './metadata-parsers';
|
import { Parsers } from './metadata-parsers.js';
|
||||||
import * as mm from '../lib';
|
import * as mm from '../lib/index.js';
|
||||||
|
|
||||||
const t = assert;
|
const t = assert;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import { Parsers } from './metadata-parsers';
|
import { Parsers } from './metadata-parsers.js';
|
||||||
import { samplePath } from './util';
|
import { samplePath } from './util.js';
|
||||||
|
|
||||||
describe('Parse Musepack (.mpc)', () => {
|
describe('Parse Musepack (.mpc)', () => {
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { assert, expect } from 'chai';
|
import { assert, expect } from 'chai';
|
||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import { Parsers } from './metadata-parsers';
|
import { Parsers } from './metadata-parsers.js';
|
||||||
import * as mm from '../lib';
|
import * as mm from '../lib/index.js';
|
||||||
import { samplePath } from './util';
|
import { samplePath } from './util.js';
|
||||||
import { IdHeader } from '../lib/ogg/opus/Opus';
|
import { IdHeader } from '../lib/ogg/opus/Opus.js';
|
||||||
|
|
||||||
const oggSamplePath = path.join(samplePath, 'ogg');
|
const oggSamplePath = path.join(samplePath, 'ogg');
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import * as mm from '../lib';
|
import * as mm from '../lib/index.js';
|
||||||
import { samplePath } from './util';
|
import { samplePath } from './util.js';
|
||||||
|
|
||||||
import { IFormat, INativeTagDict } from '../lib/type';
|
import { IFormat, INativeTagDict } from '../lib/index.js';
|
||||||
|
|
||||||
const wavSamples = path.join(samplePath, 'wav');
|
const wavSamples = path.join(samplePath, 'wav');
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ describe('Parse RIFF/WAVE audio format', () => {
|
|||||||
it('should map RIFF tags to common', async () => {
|
it('should map RIFF tags to common', async () => {
|
||||||
|
|
||||||
// Metadata edited with Adobe Audition CC 2018.1
|
// Metadata edited with Adobe Audition CC 2018.1
|
||||||
const filePath = path.join(__dirname, 'samples', 'riff_adobe_audition.wav');
|
const filePath = path.join(samplePath, 'riff_adobe_audition.wav');
|
||||||
|
|
||||||
const metadata = await mm.parseFile(filePath);
|
const metadata = await mm.parseFile(filePath);
|
||||||
const format = metadata.format;
|
const format = metadata.format;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import * as path from 'path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import { Parsers } from './metadata-parsers';
|
import { Parsers } from './metadata-parsers.js';
|
||||||
import { samplePath } from './util';
|
import { samplePath } from './util.js';
|
||||||
|
|
||||||
const t = assert;
|
const t = assert;
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user