Skip to content

Commit 1cc9f99

Browse files
committed
Improve README
1 parent 52d05f9 commit 1cc9f99

File tree

1 file changed

+64
-59
lines changed

1 file changed

+64
-59
lines changed

README.md

+64-59
Original file line numberDiff line numberDiff line change
@@ -14,98 +14,108 @@
1414
A MusicBrainz-API-client for reading and submitting metadata
1515

1616
## Features
17-
- Access metadata from MusicBrainz
18-
- Submit metadata
19-
- Smart and adjustable throttling, like MusicBrainz, it allows a bursts of requests
20-
- Build in TypeScript definitions
17+
- **Access Metadata**: Retrieve detailed metadata from the [MusicBrainz database](https://musicbrainz.org/).
18+
- **Submit metadata**: Easily submit new metadata to [MusicBrainz](https://musicbrainz.org/).
19+
- **Smart throttling**: Implements intelligent throttling, allowing bursts of requests while adhering to [MusicBrainz rate limits](https://musicbrainz.org/doc/MusicBrainz_API/Rate_Limiting).
20+
- **TypeScript Definitions**: Fully typed with built-in [TypeScript](https://www.typescriptlang.org/) definitions for a seamless development experience.
2121

2222
## Compatibility
2323

24-
Module: [Pure ECMAScript Module (ESM)](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
24+
Module: version 8 migrated from [CommonJS](https://en.wikipedia.org/wiki/CommonJS) to [pure ECMAScript Module (ESM)](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
2525
The distributed JavaScript codebase is compliant with the [ECMAScript 2020 (11th Edition)](https://en.wikipedia.org/wiki/ECMAScript_version_history#11th_Edition_%E2%80%93_ECMAScript_2020) standard.
2626

27-
This module requires a [Node.js ≥ 20](https://nodejs.org/en/about/previous-releases) engine.
27+
### Requirements
28+
- Node.js: Requires [Node.js version 16](https://nodejs.org/en/about/previous-releases)) or higher.
29+
- Browser: Can be used in browser environments when bundled with a module bundler (not actively tested).
2830

2931
> [!NOTE]
3032
> We are looking into making this package usable in the browser as well.
3133
32-
## Sponsor
33-
If you appreciate my work and want to support the development of open-source projects like [musicbrainz-api](https://github.com/Borewit/musicbrainz-api), [music-metadata](https://github.com/Borewit/music-metadata), [file-type](https://github.com/sindresorhus/file-type), [listFix()](https://github.com/Borewit/listFix), [lizzy](https://github.com/Borewit/lizzy), [strtok3](https://github.com/Borewit/strtok3), or [tokenizer-s3](https://github.com/Borewit/tokenizer-s3), please consider becoming a sponsor or making a small contribution.
34-
Your support helps sustain ongoing development and improvements.
35-
[Become a sponsor to Borewit](https://github.com/sponsors/Borewit)
34+
## Support the Project
35+
If you find this project useful and would like to support its development, consider sponsoring or contributing:
36+
37+
- [Become a sponsor to Borewit](https://github.com/sponsors/Borewit)
38+
39+
- Buy me a coffee:
40+
41+
<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>
3642

37-
This package is currently only developed for the use in a [node.js environment](http://nodejs.org/).
38-
We are looking into making this package usable in the browser as well.
43+
## Getting Started
3944

40-
## Before using this library
45+
### Identifying Your Application
4146

42-
MusicBrainz asks that you to [identify your application](https://wiki.musicbrainz.org/Development/XML_Web_Service/Version_2#User%20Data) by filling in the ['User-Agent' Header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent).
43-
By passing `appName`, `appVersion`, `appMail` musicbrainz-api takes care of that.
47+
MusicBrainz requires all API clients to [identify their application](https://wiki.musicbrainz.org/Development/XML_Web_Service/Version_2#User%20Data).
48+
Ensure you set the User-Agent header by providing `appName`, `appVersion`, and `appContactInfo` when configuring the client.
49+
This library will automatically handle this for you.
4450

45-
## Submitting metadata
51+
### Submitting metadata
4652

4753
If you plan to use this module for submitting metadata, please ensure you comply with [the MusicBrainz Code of conduct/Bots](https://wiki.musicbrainz.org/Code_of_Conduct/Bots).
4854

49-
## Example
55+
## Example Usage
56+
57+
### Importing the Library
5058

51-
Example, how to import 'musicbrainz-api:
5259
```js
53-
import {MusicBrainzApi} from 'musicbrainz-api';
60+
import { MusicBrainzApi } from 'musicbrainz-api';
5461

5562
const mbApi = new MusicBrainzApi({
56-
appName: 'my-app',
57-
appVersion: '0.1.0',
58-
appContactInfo: 'user@mail.org'
63+
appName: 'my-app',
64+
appVersion: '0.1.0',
65+
appContactInfo: 'user@mail.org',
5966
});
6067
```
6168

62-
The following configuration settings can be passed
63-
```js
64-
import {MusicBrainzApi} from 'musicbrainz-api';
69+
### Configuration Options
6570

71+
```js
6672
const config = {
67-
// MusicBrainz bot account username & password (optional)
68-
botAccount: {
69-
username: 'myUserName_bot',
70-
password: 'myPassword'
71-
},
72-
73-
// API base URL, default: 'https://musicbrainz.org' (optional)
74-
baseUrl: 'https://musicbrainz.org',
75-
76-
appName: 'my-app',
77-
appVersion: '0.1.0',
78-
79-
// Optional, default: no proxy server
80-
proxy: {
81-
host: 'localhost',
82-
port: 8888
83-
},
73+
// Optional: MusicBrainz bot account credentials
74+
botAccount: {
75+
username: 'myUserName_bot',
76+
password: 'myPassword',
77+
},
78+
79+
// Optional: API base URL (default: 'https://musicbrainz.org')
80+
baseUrl: 'https://musicbrainz.org',
81+
82+
// Required: Application details
83+
appName: 'my-app',
84+
appVersion: '0.1.0',
85+
appMail: 'user@mail.org',
86+
87+
// Optional: Proxy settings (default: no proxy server)
88+
proxy: {
89+
host: 'localhost',
90+
port: 8888,
91+
},
92+
93+
// Optional: Disable rate limiting (default: false)
94+
disableRateLimiting: false,
95+
};
96+
97+
const mbApi = new MusicBrainzApi(config);
98+
```
8499

85-
// Your e-mail address, required for submitting ISRCs
86-
appMail: string,
100+
## Accessing MusicBrainz Data
87101

88-
// Helpful if you have your own MusicBrainz server, default: false (optional)
89-
disableRateLimiting: false,
90-
}
91-
92-
const mbApi = new MusicbrainzApi(config);
93-
```
102+
The MusicBrainz API allows you to look up various entities. Here’s how to use the lookup function:
94103

95104
## Lookup MusicBrainz Entities
96105

97106
MusicBrainz API documentation: [XML Web Service/Version 2 Lookups](https://wiki.musicbrainz.org/Development/XML_Web_Service/Version_2#Lookups)
98107

99-
### Generic lookup function
108+
### Lookup Function
109+
110+
```js
111+
const artist = await mbApi.lookup('artist', 'ab2528d9-719f-4261-8098-21849222a0f2');
112+
```
100113

101114
Arguments:
102115
- entity: `'area'` | `'artist'` | `'collection'` | `'instrument'` | `'label'` | `'place'` | `'release'` | `'release-group'` | `'recording'` | `'series'` | `'work'` | `'url'` | `'event'`
103116
- MBID [(MusicBrainz identifier)](https://wiki.musicbrainz.org/MusicBrainz_Identifier)
104117
- query
105118

106-
```js
107-
const artist = await mbApi.lookup('artist', 'ab2528d9-719f-4261-8098-21849222a0f2');
108-
```
109119

110120
| Query argument | Query value |
111121
|-----------------------|-----------------|
@@ -453,8 +463,3 @@ async function getCoverArt(releaseGroupMbid, coverType = '') {
453463

454464
```
455465
456-
457-
## Compatibility
458-
459-
The JavaScript in runtime is compliant with [ECMAScript 2017 (ES8)](https://en.wikipedia.org/wiki/ECMAScript#8th_Edition_-_ECMAScript_2017).
460-
Requires [Node.js®](https://nodejs.org/) version 6 or higher.

0 commit comments

Comments
 (0)