music-metadata
Advanced tools
Comparing version 7.12.6 to 7.13.0
@@ -14,2 +14,3 @@ import { BasicParser } from '../common/BasicParser'; | ||
readData(header: iff.IChunkHeader): Promise<number>; | ||
readTextChunk(header: iff.IChunkHeader): Promise<number>; | ||
} |
@@ -54,3 +54,2 @@ "use strict"; | ||
const chunkHeader = await this.tokenizer.readToken(iff.Header); | ||
debug(`Chunk id=${chunkHeader.chunkID}`); | ||
const nextChunk = 2 * Math.round(chunkHeader.chunkSize / 2); | ||
@@ -92,7 +91,20 @@ const bytesRead = await this.readData(chunkHeader); | ||
return 0; | ||
case 'NAME': // Sample name chunk | ||
case 'AUTH': // Author chunk | ||
case '(c) ': // Copyright chunk | ||
case 'ANNO': // Annotation chunk | ||
return this.readTextChunk(header); | ||
default: | ||
debug(`Ignore chunk id=${header.chunkID}, size=${header.chunkSize}`); | ||
return 0; | ||
} | ||
} | ||
async readTextChunk(header) { | ||
const value = await this.tokenizer.readToken(new Token.StringType(header.chunkSize, 'ascii')); | ||
value.split('\0').map(v => v.trim()).filter(v => v && v.length > 0).forEach(v => { | ||
this.metadata.addTag('AIFF', header.chunkID, v.trim()); | ||
}); | ||
return header.chunkSize; | ||
} | ||
} | ||
exports.AIFFParser = AIFFParser; |
@@ -13,2 +13,3 @@ "use strict"; | ||
const MatroskaTagMapper_1 = require("../matroska/MatroskaTagMapper"); | ||
const AiffTagMap_1 = require("../aiff/AiffTagMap"); | ||
class CombinedTagMapper { | ||
@@ -27,3 +28,4 @@ constructor() { | ||
new RiffInfoTagMap_1.RiffInfoTagMapper(), | ||
new MatroskaTagMapper_1.MatroskaTagMapper() | ||
new MatroskaTagMapper_1.MatroskaTagMapper(), | ||
new AiffTagMap_1.AiffTagMapper() | ||
].forEach(mapper => { | ||
@@ -30,0 +32,0 @@ this.registerTagMapper(mapper); |
@@ -14,7 +14,4 @@ "use strict"; | ||
const id = buf.toString('binary', off, off + exports.FourCcToken.len); | ||
switch (id) { | ||
default: | ||
if (!id.match(validFourCC)) { | ||
throw new Error(`FourCC contains invalid characters: ${util.a2hex(id)} "${id}"`); | ||
} | ||
if (!id.match(validFourCC)) { | ||
throw new Error(`FourCC contains invalid characters: ${util.a2hex(id)} "${id}"`); | ||
} | ||
@@ -21,0 +18,0 @@ return id; |
@@ -1,2 +0,2 @@ | ||
export declare type TagType = 'vorbis' | 'ID3v1' | 'ID3v2.2' | 'ID3v2.3' | 'ID3v2.4' | 'APEv2' | 'asf' | 'iTunes' | 'exif' | 'matroska'; | ||
export declare type TagType = 'vorbis' | 'ID3v1' | 'ID3v2.2' | 'ID3v2.3' | 'ID3v2.4' | 'APEv2' | 'asf' | 'iTunes' | 'exif' | 'matroska' | 'AIFF'; | ||
export interface IGenericTag { | ||
@@ -3,0 +3,0 @@ id: GenericTagId; |
@@ -12,3 +12,3 @@ "use strict"; | ||
const debug = (0, debug_1.default)('music-metadata:collector'); | ||
const TagPriority = ['matroska', 'APEv2', 'vorbis', 'ID3v2.4', 'ID3v2.3', 'ID3v2.2', 'exif', 'asf', 'iTunes', 'ID3v1']; | ||
const TagPriority = ['matroska', 'APEv2', 'vorbis', 'ID3v2.4', 'ID3v2.3', 'ID3v2.2', 'exif', 'asf', 'iTunes', 'AIFF', 'ID3v1']; | ||
/** | ||
@@ -48,3 +48,3 @@ * Provided to the parser to uodate the metadata result. | ||
this.originPriority.artificial = 500; // Filled using alternative tags | ||
this.originPriority.id3v1 = 600; // Consider worst due to field length limit | ||
this.originPriority.id3v1 = 600; // Consider as the worst because of the field length limit | ||
} | ||
@@ -51,0 +51,0 @@ /** |
{ | ||
"name": "music-metadata", | ||
"description": "Music metadata parser for Node.js, supporting virtual any audio and tag format.", | ||
"version": "7.12.6", | ||
"version": "7.13.0", | ||
"author": { | ||
@@ -92,6 +92,6 @@ "name": "Borewit", | ||
"strtok3": "^6.3.0", | ||
"token-types": "^4.2.0" | ||
"token-types": "^4.2.1" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.3.1", | ||
"@types/chai": "^4.3.3", | ||
"@types/chai-as-promised": "^7.1.5", | ||
@@ -101,13 +101,13 @@ "@types/debug": "^4.1.7", | ||
"@types/mocha": "^9.1.0", | ||
"@types/node": "^18.6.3", | ||
"@typescript-eslint/eslint-plugin": "^5.32.0", | ||
"@typescript-eslint/parser": "^5.32.0", | ||
"@types/node": "^18.7.14", | ||
"@typescript-eslint/eslint-plugin": "^5.37.0", | ||
"@typescript-eslint/parser": "^5.37.0", | ||
"chai": "^4.3.6", | ||
"chai-as-promised": "^7.1.1", | ||
"del-cli": "5.0.0", | ||
"eslint": "^8.21.0", | ||
"eslint": "^8.23.1", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-import-resolver-typescript": "^3.4.0", | ||
"eslint-import-resolver-typescript": "^3.5.1", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-jsdoc": "^39.3.4", | ||
"eslint-plugin-jsdoc": "^39.3.6", | ||
"eslint-plugin-node": "^11.1.0", | ||
@@ -123,3 +123,3 @@ "eslint-plugin-unicorn": "^43.0.2", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^4.7.4" | ||
"typescript": "^4.8.3" | ||
}, | ||
@@ -126,0 +126,0 @@ "engines": { |
@@ -58,2 +58,3 @@ ![Node.js CI](https://github.com/Borewit/music-metadata/workflows/Node.js%20CI/badge.svg) | ||
* [Vorbis comment](https://wikipedia.org/wiki/Vorbis_comment) | ||
* [AIFF](https://wikipedia.org/wiki/Audio_Interchange_File_Format) | ||
@@ -94,4 +95,4 @@ It allows many tags to be accessed in audio format, and tag format independent way. | ||
| function | `music-metadata` | `music-metadata/lib/core` | | ||
| -----------------------------------------------------| ---------------------------|----------------------------| | ||
| [`parseBuffer`](#parsefile-function) | ✓ | ✓ | | ||
|------------------------------------------------------| ---------------------------|----------------------------| | ||
| [`parseBuffer`](#parsebuffer-function) | ✓ | ✓ | | ||
| [`parseStream`](#parsestream-function) * | ✓ | ✓ | | ||
@@ -98,0 +99,0 @@ | [`parseFromTokenizer`](#parsefromtokenizer-function) | ✓ | ✓ | |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
473683
157
11587
436
Updatedtoken-types@^4.2.1