Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ Now you select the result you want and the plugin will cast it's magic and creat

- movies (including specials)
- series (including OVAs)
- games
- videogames
- boardgames
- music releases
- wiki articles
- books
Expand All @@ -121,6 +122,7 @@ Now you select the result you want and the plugin will cast it's magic and creat
| [Open Library](https://openlibrary.org) | The OpenLibrary API offers metadata for books | books | No | Cover access is rate-limited when not using CoverID or OLID by max 100 requests/IP every 5 minutes. This plugin uses OLID so there shouldn't be a rate limit. | No |
| [Moby Games](https://www.mobygames.com) | The Moby Games API offers metadata for games for all platforms | games | Yes, by making an account [here](https://www.mobygames.com/user/register/). NOTE: As of September 2024 the API key is no longer free so consider using Giant Bomb or steam instead | API requests are limited to 360 per hour (one every ten seconds). In addition, requests should be made no more frequently than one per second. | No |
| [Giant Bomb](https://www.giantbomb.com) | The Giant Bomb API offers metadata for games for all platforms | games | Yes, by making an account [here](https://www.giantbomb.com/login-signup/) | API requests are limited to 200 requests per resource, per hour. In addition, they implement velocity detection to prevent malicious use. If too many requests are made per second, you may receive temporary blocks to resources. | No |
| [Boardgame Geek](https://boardgamegeek.com) | The Boardgame Geek API offers metadata for boardgames | boardgames | Yes, by making an account [here](https://boardgamegeek.com/join/) and then [requesting an application token](https://boardgamegeek.com/applications) | Exact usage limits are still undetermined | No |
| Comic Vine | The Comic Vine API offers metadata for comic books | comicbooks | Yes, by making an account [here](https://comicvine.gamespot.com/login-signup/) and going to the [api section](https://comicvine.gamespot.com/api/) of the site | 200 requests per resource, per hour. There is also a velocity detection to prevent malicious use. If too many requests are made per second, you may receive temporary blocks to resources. | No |

#### Notes
Expand Down
16 changes: 15 additions & 1 deletion src/api/apis/BoardGameGeekAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class BoardGameGeekAPI extends APIModel {
this.plugin = plugin;
this.apiName = 'BoardGameGeekAPI';
this.apiDescription = 'A free API for BoardGameGeek things.';
this.apiUrl = 'https://api.geekdo.com/xmlapi';
this.apiUrl = 'https://boardgamegeek.com/xmlapi/';
this.types = [MediaType.BoardGame];
}

Expand All @@ -26,8 +26,15 @@ export class BoardGameGeekAPI extends APIModel {
const searchUrl = `${this.apiUrl}/search?search=${encodeURIComponent(title)}`;
const fetchData = await requestUrl({
url: searchUrl,
headers: {
Authorization: `Bearer ${this.plugin.settings.BoardgameGeekKey}`,
},
});

if (fetchData.status === 401) {
throw Error(`MDB | Authentication for ${this.apiName} failed. Check the API key.`);
}

if (fetchData.status !== 200) {
throw Error(`MDB | Received status code ${fetchData.status} from ${this.apiName}.`);
}
Expand Down Expand Up @@ -64,8 +71,15 @@ export class BoardGameGeekAPI extends APIModel {
const searchUrl = `${this.apiUrl}/boardgame/${encodeURIComponent(id)}?stats=1`;
const fetchData = await requestUrl({
url: searchUrl,
headers: {
Authorization: `Bearer ${this.plugin.settings.BoardgameGeekKey}`,
},
});

if (fetchData.status === 401) {
throw Error(`MDB | Authentication for ${this.apiName} failed. Check the API key.`);
}

if (fetchData.status !== 200) {
throw Error(`MDB | Received status code ${fetchData.status} from ${this.apiName}.`);
}
Expand Down
13 changes: 13 additions & 0 deletions src/settings/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface MediaDbPluginSettings {
MobyGamesKey: string;
GiantBombKey: string;
ComicVineKey: string;
BoardgameGeekKey: string;
sfwFilter: boolean;
templates: boolean;
customDateFormat: string;
Expand Down Expand Up @@ -79,6 +80,7 @@ const DEFAULT_SETTINGS: MediaDbPluginSettings = {
MobyGamesKey: '',
GiantBombKey: '',
ComicVineKey: '',
BoardgameGeekKey: '',
sfwFilter: true,
templates: true,
customDateFormat: 'L',
Expand Down Expand Up @@ -222,6 +224,17 @@ export class MediaDbSettingTab extends PluginSettingTab {
void this.plugin.saveSettings();
});
});
new Setting(containerEl)
.setName('Boardgame Geek Key')
.setDesc('API key for "www.boardgamegeek.com".')
.addText(cb => {
cb.setPlaceholder('API key')
.setValue(this.plugin.settings.BoardgameGeekKey)
.onChange(data => {
this.plugin.settings.BoardgameGeekKey = data;
void this.plugin.saveSettings();
});
});

new Setting(containerEl)
.setName('SFW filter')
Expand Down