Skip to content
This repository was archived by the owner on Aug 14, 2024. It is now read-only.

Commit 2883cd6

Browse files
committed
Deprecate music-metadata-browser
1 parent feee1f1 commit 2883cd6

File tree

2 files changed

+10
-269
lines changed

2 files changed

+10
-269
lines changed

.github/dependabot.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ updates:
44
directory: "/"
55
schedule:
66
interval: weekly
7-
open-pull-requests-limit: 10
7+
open-pull-requests-limit: 0
88
labels:
99
- dependencies
1010
versioning-strategy: increase

README.md

+9-268
Original file line numberDiff line numberDiff line change
@@ -1,288 +1,29 @@
1-
[![Karma CI](https://github.com/Borewit/music-metadata-browser/actions/workflows/karma-ci.yml/badge.svg)](https://github.com/Borewit/music-metadata-browser/actions/workflows/karma-ci.yml)
21
[![NPM version](https://badge.fury.io/js/music-metadata-browser.svg)](https://npmjs.org/package/music-metadata-browser)
32
[![npm downloads](http://img.shields.io/npm/dm/music-metadata-browser.svg)](https://npmcharts.com/compare/music-metadata-browser,jsmediatags?start=500&interval=30)
4-
[![Known Vulnerabilities](https://snyk.io/test/github/Borewit/music-metadata-browser/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/music-metadata-browser?targetFile=package.json)
5-
[![CodeQL](https://github.com/Borewit/music-metadata-browser/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/Borewit/music-metadata-browser/actions/workflows/codeql-analysis.yml)
6-
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/77818ccb061e445e907cacbafc6ac8c2)](https://www.codacy.com/app/Borewit/music-metadata-browser?utm_source=github.com&utm_medium=referral&utm_content=Borewit/music-metadata-browser&utm_campaign=Badge_Grade)
7-
[![Coverage Status](https://coveralls.io/repos/github/Borewit/music-metadata-browser/badge.svg?branch=master)](https://coveralls.io/github/Borewit/music-metadata-browser?branch=master)
83
[![Minified size](https://badgen.net/bundlephobia/min/music-metadata-browser)](https://bundlephobia.com/result?p=music-metadata-browser)
9-
[![Chat](https://img.shields.io/discord/460524735235883049.svg)](https://discord.gg/M8EWZk7)
104

115
# music-metadata-browser
126

13-
[music-metadata-browser](https://github.com/Borewit/music-metadata-browser) is a metadata parser, supporting virtual any audio format and tag header around.
7+
### Development of this package is discontinued
148

15-
[music-metadata-browser](https://github.com/Borewit/music-metadata-browser) is a node module, designed for modern browser applications.
16-
Because modules don't run directly in the browser you need a _module bundler_, like [Webpack](https://webpack.js.org) or [Parcel](https://parceljs.org/).
17-
The _module bundler_ turns the modules (dependencies), together with you application code, into a static asset (typically a minified JavaScript file).
18-
The output of _module bundler_ is compatible and optimized for execution by a web browser.
9+
After more than 6 years, 66 releases, this life `music-metadata-browser` will end.
10+
This package was designed as wrapper around [music-metadata](https://github.com/Borewit/music-metadata),
11+
to enable [music-metadata](https://github.com/Borewit/music-metadata) usage in the browser.
12+
That ambition is still alive and kicking, which is now replaced by the hybrid support [music-metadata](https://github.com/Borewit/music-metadata) is offering out if the box.
1913

20-
Integration with React or Angular should not be a problem:
21-
* [example project using React framework](https://github.com/Borewit/music-metadata-react)
22-
* [example project using Angular framework](https://github.com/Borewit/audio-tag-analyzer)
23-
24-
If you prefer to parse files or streams server (node.js) side, you should use [music-metadata](https://github.com/Borewit/music-metadata) instead.
25-
26-
## Features
27-
28-
### Support for audio file types
29-
30-
| Audio format | Description | Wiki | |
31-
| ------------- |---------------------------------| -------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------:|
32-
| AIFF / AIFF-C | Audio Interchange File Format | [:link:](https://wikipedia.org/wiki/Audio_Interchange_File_Format) | <img src="https://upload.wikimedia.org/wikipedia/commons/8/84/Apple_Computer_Logo_rainbow.svg" width="40" alt="Apple rainbow logo"> |
33-
| AAC | ADTS / Advanced Audio Coding | [:link:](https://en.wikipedia.org/wiki/Advanced_Audio_Coding) | <img src="https://svgshare.com/i/UT8.svg" width="40" alt="AAC logo"> |
34-
| APE | Monkey's Audio | [:link:](https://wikipedia.org/wiki/Monkey's_Audio) | <img src="https://foreverhits.files.wordpress.com/2015/05/ape_audio.jpg" width="40" alt="Monkey's Audio logo"> |
35-
| ASF | Advanced Systems Format | [:link:](https://wikipedia.org/wiki/Advanced_Systems_Format) | |
36-
| DSDIFF | Philips DSDIFF | [:link:](https://wikipedia.org/wiki/Direct_Stream_Digital) | <img src="https://upload.wikimedia.org/wikipedia/commons/b/bc/DSDlogo.svg" width="80" alt="DSD logo"> |
37-
| DSF | Sony's DSD Stream File | [:link:](https://wikipedia.org/wiki/Direct_Stream_Digital) | <img src="https://upload.wikimedia.org/wikipedia/commons/b/bc/DSDlogo.svg" width="80" alt="DSD logo"> |
38-
| FLAC | Free Lossless Audio Codec | [:link:](https://wikipedia.org/wiki/FLAC) | <img src="https://upload.wikimedia.org/wikipedia/commons/a/a2/FLAC_logo_vector.svg" width="80" alt="FLAC logo"> |
39-
| MP2 | MPEG-1 Audio Layer II | [:link:](https://wikipedia.org/wiki/MPEG-1_Audio_Layer_II) | |
40-
| Matroska | Matroska (EBML), mka, mkv | [:link:](https://wikipedia.org/wiki/Matroska) | <img src="https://upload.wikimedia.org/wikipedia/commons/1/1a/Matroska_2010.svg" width="80" alt="Matroska logo"> |
41-
| MP3 | MPEG-1 / MPEG-2 Audio Layer III | [:link:](https://wikipedia.org/wiki/MP3) | <img src="https://upload.wikimedia.org/wikipedia/commons/e/ea/Mp3.svg" width="80" alt="MP3 logo"> |
42-
| MPC | Musepack SV7 | [:link:](https://wikipedia.org/wiki/Musepack) | <img src="https://www.musepack.net/pictures/musepack_logo.png" width="80" alt="musepack logo"> |
43-
| MPEG 4 | mp4, m4a, m4v | [:link:](https://wikipedia.org/wiki/MPEG-4) | <img src="https://svgshare.com/i/UU3.svg" width="80" alt="mpeg 4 logo"> |
44-
| Ogg | Open container format | [:link:](https://en.wikipedia.org/wiki/Ogg) | <img src="https://upload.wikimedia.org/wikipedia/commons/a/a1/Ogg_Logo.svg" width="80" alt="Ogg logo"> |
45-
| Opus | | [:link:](https://wikipedia.org/wiki/Opus_(audio_format)) | <img src="https://upload.wikimedia.org/wikipedia/commons/0/02/Opus_logo2.svg" width="80" alt="Opus logo"> |
46-
| Speex | | [:link:](https://wikipedia.org/wiki/Speex) | <img src="https://upload.wikimedia.org/wikipedia/commons/b/b5/Speex_logo_2006.svg" width="80" alt="Speex logo"> |
47-
| Theora | | [:link:](https://en.wikipedia.org/wiki/Theora) | <img src="https://upload.wikimedia.org/wikipedia/commons/5/57/Theora_logo_2007.svg" width="70" alt="Theora logo"> |
48-
| Vorbis | Vorbis audio compression | [:link:](https://wikipedia.org/wiki/Ogg_Vorbis) | <img src="https://upload.wikimedia.org/wikipedia/commons/8/8d/Xiph.Org_logo_square.svg" width="70" alt="Vorbis logo"> |
49-
| WAV | RIFF WAVE | [:link:](https://wikipedia.org/wiki/WAV) | |
50-
| WebM | webm | [:link:](https://wikipedia.org/wiki/WebM) | <img src="https://upload.wikimedia.org/wikipedia/commons/3/34/WebM_logo.svg" width="80" alt="Matroska logo"> |
51-
| WV | WavPack | [:link:](https://wikipedia.org/wiki/WavPack) | <img src="http://www.wavpack.com/wavpacklogo.svg" width="60" alt="WavPack logo"> |
52-
| WMA | Windows Media Audio | [:link:](https://wikipedia.org/wiki/Windows_Media_Audio) | <img src="https://upload.wikimedia.org/wikipedia/commons/7/76/Windows_Media_Player_simplified_logo.svg" width="40" alt="Windows Media logo"> |
53-
54-
### Support for tags
55-
56-
* [APE](https://en.wikipedia.org/wiki/APE_tag)
57-
* [ASF](https://en.wikipedia.org/wiki/Advanced_Systems_Format)
58-
* EXIF 2.3
59-
* [ID3](https://wikipedia.org/wiki/ID3): ID3v1, ID3v1.1, ID3v2.2, [ID3v2.3](http://id3.org/id3v2.3.0) & [ID3v2.4](http://id3.org/id3v2.4.0-frames)
60-
* [RIFF](https://en.wikipedia.org/wiki/Resource_Interchange_File_Format)/INFO
61-
62-
Support for [MusicBrainz](https://musicbrainz.org/) tags as written by [Picard](https://picard.musicbrainz.org/).
63-
64-
### Audio format & encoding details
65-
66-
Support for encoding / format details:
67-
* [Bit rate](https://wikipedia.org/wiki/Bit_rate)
68-
* [Audio bit depth](https://wikipedia.org/wiki/Audio_bit_depth)
69-
* Duration
70-
* encoding profile (e.g. [CBR](https://en.wikipedia.org/wiki/Constant_bitrate), V0, V2)
71-
72-
## Online demo's
73-
* [<img src="https://raw.githubusercontent.com/Borewit/audio-tag-analyzer/master/src/assets/icon/audio-tag-analyzer.svg" width="40"> Audio Tag Analyzer](https://audio-tag-analyzer.netlify.com/)
74-
* [<img src="https://cdn.sanity.io/images/3do82whm/next/ba8c847f13a5fa39d88f8bc9b7846b7886531b18-2500x2500.svg" width="40"> Webamp](https://webamp.org/)
75-
* [<img src="https://raw.githubusercontent.com/hvianna/audioMotion.js/master/public/img/favicon256.png" width="40"> audioMotion](https://hvianna.github.io/audioMotion.js)
76-
* [<img src="https://diffuse.sh/images/diffuse-dark.svg" alt="Diffuse" width="160">](https://github.com/icidasset/diffuse)
77-
* ![](https://raw.githubusercontent.com/tgambet/musicsource/main/src/assets/favicon-32x32.png) [MusicSource](https://github.com/tgambet/musicsource)
14+
[music-metadata](https://github.com/Borewit/music-metadata) can now directly be used by a _module bundler_, like [Webpack](https://webpack.js.org),
15+
and does no longer depend on Node.js specific APIs.
7816

7917
### Sponsor
8018
[Become a sponsor to Borewit](https://github.com/sponsors/Borewit)
8119

82-
## Usage
83-
84-
### Installation
85-
Install via [npm](http://npmjs.org/):
86-
87-
```bash
88-
npm install music-metadata-browser
89-
```
90-
or using [yarn](https://yarnpkg.com/):
91-
```bash
92-
yarn add music-metadata-browser
93-
```
94-
95-
### Import music-metadata
96-
97-
Import music-metadata in JavaScript
98-
```js
99-
const musicMetadata = require('music-metadata-browser');
100-
```
101-
102-
This is how it's done in [TypeScript](https://www.typescriptlang.org/docs/home.html)
103-
```ts
104-
import * as musicMetadata from 'music-metadata-browser';
105-
```
106-
107-
### Module Functions
108-
109-
There are currently three ways to parse (read) audio tracks:
110-
1) parsing a Web API blob or file with the [parseBlob function](#parseblob-function).
111-
2) Using [ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) using the [parseReadableStream function](#parsereadablestream-function).
112-
3) Using [Node.js streams](https://nodejs.org/api/stream.html) using the [parseNodeStream function](#parsenodestream-function).
113-
3) Provide a URL to [fetch the audio track from](#fetchurl-function).
114-
115-
#### parseBlob function
116-
117-
Parse an audio file from a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) or [File](https://developer.mozilla.org/en-US/docs/Web/API/File).
118-
119-
```js
120-
const musicMetadata = require('music-metadata-browser');
121-
122-
let blob;
123-
124-
musicMetadata.parseBlob(blob).then(metadata => {
125-
// metadata has all the metadata found in the blob or file
126-
});
127-
```
128-
Or with async/await if you prefer:
129-
```js
130-
(async () => {
131-
let blob; // File or Blob
132-
133-
const metadata = await musicMetadata.parseBlob(blob);
134-
// metadata has all the metadata found in the blob or file
135-
});
136-
```
137-
138-
#### parseReadableStream function
139-
140-
```js
141-
import * as mm from 'music-metadata-browser';
142-
143-
(async () => {
144-
const metadata = await mm.parseReadableStream(readableStream);
145-
console.log(util.inspect(metadata, { showHidden: false, depth: null }));
146-
});
147-
```
148-
Parse from a Web API [ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) (web stream according [WTWG Streams Standard](https://streams.spec.whatwg.org/)).
149-
150-
If available, pass the mime-type and file-size. Without the mime-type, the content will be audio type will be automatically detected.
151-
152-
It is recommended to provide the corresponding [MIME-type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types).
153-
An extension (e.g.: `.mp3`), filename or path will also work.
154-
If the MIME-type or filename is not provided, or not understood, music-metadata will try to derive the type from the content.
155-
156-
```js
157-
import * as mm from 'music-metadata-browser';
158-
159-
const readableStream = result.node;
160-
161-
mm.parseReadableStream(readableStream, {size: 21032, mimeType: 'audio/mpeg'})
162-
.then( metadata => {
163-
console.log(util.inspect(metadata, { showHidden: false, depth: null }));
164-
someReadStream.cancel();
165-
});
166-
```
167-
168-
#### parseNodeStream function
169-
170-
```js
171-
import * as mm from 'music-metadata-browser';
172-
173-
mm.parseNodeStream(readableStream)
174-
.then( metadata => {
175-
console.log(util.inspect(metadata, { showHidden: false, depth: null }));
176-
readableStream.destroy();
177-
});
178-
```
179-
The readable stream is derived from [Node's readable stream](https://nodejs.org/api/stream.html#stream_readable_streams).
180-
181-
If available, pass the mime-type and file-size. Without the mime-type, the content will be audio type will be automatically detected.
182-
183-
```javascript
184-
import * as mm from 'music-metadata-browser';
185-
186-
(async () => {
187-
const metadata = await mm.parseNodeStream(someReadStream, {mimeType: 'audio/mpeg', size: 26838 });
188-
console.log(util.inspect(metadata, { showHidden: false, depth: null }));
189-
someReadStream.close();
190-
});
191-
```
192-
193-
### fetchUrl function
194-
195-
If you wish to stream your audio track over HTTP you need can use `fetchFromUrl` which is using the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) to retrieve the audio track:
196-
197-
```js
198-
import * as mm from 'music-metadata-browser';
199-
200-
(async () => {
201-
const metadata = await mm.fetchFromUrl(audioTrackUrl, options);
202-
});
203-
```
204-
205-
#### orderTags function
206-
207-
Utility to Converts the native tags to a dictionary index on the tag identifier
208-
209-
```js
210-
orderTags(nativeTags: ITag[]): [tagId: string]: any[]
211-
```
212-
213-
#### ratingToStars function
214-
215-
Can be used to convert the normalized rating value to the 0..5 stars, where 0 an undefined rating, 1 the star the lowest rating and 5 the highest rating.
216-
217-
```js
218-
ratingToStars(rating)
219-
```
220-
221-
`rating` is a number between 0.0 and 1.0
222-
223-
Returns the number of stars: 0, 1, 2, 3, 4 or 5.
224-
225-
#### selectCover function
226-
227-
Select cover image based on image type field, otherwise the first picture in file.
228-
229-
```ts
230-
export function selectCover(pictures?: IPicture[]): IPicture | null
231-
```
232-
233-
```js
234-
import * as mm from 'music-metadata';
235-
236-
(async () => {
237-
const {common} = await mm.parseFile(filePath);
238-
const cover = mm.selectCover(common.picture); // pick the cover image
239-
}
240-
)();
241-
```
242-
243-
### Options
244-
* `duration`: default: `false`, if set to `true`, it will parse the whole media file if required to determine the duration.
245-
* `fileSize`: only provide this in combination with `parseStream` function.
246-
* `observer: (update: MetadataEvent) => void;`: Will be called after each change to `common` (generic) tag, or `format` properties.
247-
* `skipCovers`: default: `false`, if set to `true`, it will not return embedded cover-art (images).
248-
* `skipPostHeaders? boolean` default: `false`, if set to `true`, it will not search all the entire track for additional headers. Only recommenced to use in combination with streams.
249-
* `includeChapters` default: `false`, if set to `true`, it will parse chapters (currently only MP4 files). _experimental functionality_
250-
251-
Although in most cases duration is included, in some cases it requires `music-metadata` parsing the entire file.
252-
To enforce parsing the entire file if needed you should set `duration` to `true`.
253-
254-
### Metadata result
255-
256-
If the returned promise resolves, the metadata (TypeScript `IAudioMetadata` interface) contains:
257-
258-
* [`format: IFormat`](#format) Audio format information
259-
* `native: INativeTags` List of native (original) tags found in the parsed audio file.
260-
* [`common: ICommonTagsResult`](https://github.com/Borewit/music-metadata/blob/master/doc/common_metadata.md) Is a generic (abstract) way of reading metadata information.
261-
262-
#### Format
263-
264-
Audio format information. Defined in the TypeScript `IFormat` interface:
265-
* `container?: string` Audio encoding format. e.g.: 'flac'
266-
* `codec?` Name of the codec (algorithm used for the audio compression)
267-
* `codecProfile?: string` Codec profile / settings
268-
* `tagTypes?: TagType[]` List of tagging formats found in parsed audio file
269-
* `duration?: number` Duration in seconds
270-
* `bitrate?: number` Number bits per second of encoded audio file
271-
* `sampleRate?: number` Sampling rate in Samples per second (S/s)
272-
* `bitsPerSample?: number` Audio bit depth
273-
* `lossless?: boolean` True if lossless, false for lossy encoding
274-
* `numberOfChannels?: number` Number of audio channels
275-
* `numberOfSamples?: number` Number of samples frames, one sample contains all channels. The duration is: numberOfSamples / sampleRate
276-
277-
#### Common
278-
279-
[Common tag documentation](https://github.com/Borewit/music-metadata/blob/master/doc/common_metadata.md) is automatically generated.
20+
<a href="https://www.buymeacoffee.com/borewit" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy me A coffee" height="41" width="174"></a>
28021

28122
## Licence
28223

28324
The MIT License (MIT)
28425

285-
Copyright © 2022 Borewit
26+
Copyright © 2024 Borewit
28627

28728
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
28829

0 commit comments

Comments
 (0)