Fix unhandled null in VN release date
This commit is contained in:
parent
86f003b916
commit
0e51e1b15c
2 changed files with 5 additions and 4 deletions
|
|
@ -113,7 +113,6 @@ Now you select the result you want and the plugin will cast it's magic and creat
|
|||
|
||||
### Currently supported APIs:
|
||||
|
||||
|
||||
| Name | Description | Supported formats | Authentification | Rate limiting | SFW filter support |
|
||||
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
|
||||
| [Jikan](https://jikan.moe/) | Jikan is an API that uses [My Anime List](https://myanimelist.net) and offers metadata for anime. | series, movies, specials, OVAs, manga, manwha, novels | No | 60 per minute and 3 per second | Yes |
|
||||
|
|
@ -124,7 +123,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 |
|
||||
| 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
|
||||
| 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 |
|
||||
| [VNDB](https://vndb.org/) | The VNDB API offers metadata for visual novels | games | No | 200 requests per 5 minutes | Yes |
|
||||
|
||||
#### Notes
|
||||
|
|
|
|||
|
|
@ -168,6 +168,8 @@ export class VNDBAPI extends APIModel {
|
|||
|
||||
if (vnData.results.length !== 1) throw Error(`MDB | Expected 1 result from query, got ${vnData.results.length}.`);
|
||||
const vn = vnData.results[0];
|
||||
const releasedIsDate = vn.released !== null && vn.released !== 'TBA';
|
||||
vn.released ??= 'Unknown';
|
||||
|
||||
const releaseData = await this.postReleaseQuery(`{
|
||||
"filters": ["and"
|
||||
|
|
@ -184,7 +186,7 @@ export class VNDBAPI extends APIModel {
|
|||
type: MediaType.Game,
|
||||
title: vn.title,
|
||||
englishTitle: vn.titles.find(t => t.lang === 'en')?.title ?? vn.title,
|
||||
year: vn.released && vn.released !== 'TBA' ? new Date(vn.released).getFullYear().toString() : 'TBA',
|
||||
year: releasedIsDate ? new Date(vn.released).getFullYear().toString() : vn.released,
|
||||
dataSource: this.apiName,
|
||||
url: `https://vndb.org/${vn.id}`,
|
||||
id: vn.id,
|
||||
|
|
@ -205,7 +207,7 @@ export class VNDBAPI extends APIModel {
|
|||
image: this.plugin.settings.sfwFilter && (vn.image?.sexual ?? 0) > 0.5 ? 'NSFW' : vn.image?.url,
|
||||
|
||||
released: vn.devstatus === 0,
|
||||
releaseDate: this.plugin.dateFormatter.format(vn.released, this.apiDateFormat),
|
||||
releaseDate: releasedIsDate ? this.plugin.dateFormatter.format(vn.released, this.apiDateFormat) : vn.released,
|
||||
|
||||
userData: {
|
||||
played: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue