From 8bb8c2d791d6dbec1146373822923dd330e58323 Mon Sep 17 00:00:00 2001 From: ltctceplrm <14954927+ltctceplrm@users.noreply.github.com> Date: Sat, 13 Jan 2024 15:01:38 +0100 Subject: [PATCH 1/3] Added developers and publishers field to games OMDB doesn't have this field so I mapped it to be empty. --- src/api/apis/OMDbAPI.ts | 2 ++ src/api/apis/SteamAPI.ts | 2 ++ src/models/GameModel.ts | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/src/api/apis/OMDbAPI.ts b/src/api/apis/OMDbAPI.ts index 7c9d5a1..13308f6 100644 --- a/src/api/apis/OMDbAPI.ts +++ b/src/api/apis/OMDbAPI.ts @@ -200,6 +200,8 @@ export class OMDbAPI extends APIModel { url: `https://www.imdb.com/title/${result.imdbID}/`, id: result.imdbID, + developers: [], + publishers: [], genres: result.Genre?.split(', ') ?? [], onlineRating: Number.parseFloat(result.imdbRating ?? 0), image: result.Poster ?? '', diff --git a/src/api/apis/SteamAPI.ts b/src/api/apis/SteamAPI.ts index 57f4150..1f06ace 100644 --- a/src/api/apis/SteamAPI.ts +++ b/src/api/apis/SteamAPI.ts @@ -105,6 +105,8 @@ export class SteamAPI extends APIModel { url: `https://store.steampowered.com/app/${result.steam_appid}`, id: result.steam_appid, + developers: result['developers'], + publishers: result['publishers'], genres: result.genres?.map((x: any) => x.description) ?? [], onlineRating: Number.parseFloat(result.metacritic?.score ?? 0), image: result.header_image ?? '', diff --git a/src/models/GameModel.ts b/src/models/GameModel.ts index 7077ab4..cdddff1 100644 --- a/src/models/GameModel.ts +++ b/src/models/GameModel.ts @@ -3,6 +3,8 @@ import { mediaDbTag, migrateObject } from '../utils/Utils'; import { MediaType } from '../utils/MediaType'; export class GameModel extends MediaTypeModel { + developers: string[]; + publishers: string[]; genres: string[]; onlineRating: number; image: string; @@ -18,6 +20,8 @@ export class GameModel extends MediaTypeModel { constructor(obj: any = {}) { super(); + this.developers = undefined; + this.publishers = undefined; this.genres = undefined; this.onlineRating = undefined; this.image = undefined; From 99bf06dda98cafb39a19860a39459c90ee5564ed Mon Sep 17 00:00:00 2001 From: ltctceplrm <14954927+ltctceplrm@users.noreply.github.com> Date: Sun, 14 Jan 2024 18:19:26 +0100 Subject: [PATCH 2/3] Fixed bug in OpenLibraryAPI when no isbn was present --- src/api/apis/OpenLibraryAPI.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/apis/OpenLibraryAPI.ts b/src/api/apis/OpenLibraryAPI.ts index 4591b14..725db0e 100644 --- a/src/api/apis/OpenLibraryAPI.ts +++ b/src/api/apis/OpenLibraryAPI.ts @@ -70,8 +70,8 @@ export class OpenLibraryAPI extends APIModel { dataSource: this.apiName, url: `https://openlibrary.org` + result.key, id: result.key, - isbn: result.isbn.find((el: string | any[]) => el.length <= 10) ?? 'unknown', - isbn13: result.isbn.find((el: string | any[]) => el.length == 13) ?? 'unknown', + isbn: (result.isbn ?? []).find((el: string | any[]) => el.length <= 10) ?? 'unknown', + isbn13: (result.isbn ?? []).find((el: string | any[]) => el.length == 13) ?? 'unknown', englishTitle: result.title_english ?? result.title, author: result.author_name ?? 'unknown', From 93c46e58485fc5d3d92d65a653efc281a27eb0a6 Mon Sep 17 00:00:00 2001 From: ltctceplrm <14954927+ltctceplrm@users.noreply.github.com> Date: Mon, 22 Jan 2024 20:27:51 +0100 Subject: [PATCH 3/3] Fixed manga import by replacing double quotes to single quotes When using the default double quotes the YAML formatting was no longer correct. --- src/api/apis/MALAPIManga.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/apis/MALAPIManga.ts b/src/api/apis/MALAPIManga.ts index a50b5ff..7cea003 100644 --- a/src/api/apis/MALAPIManga.ts +++ b/src/api/apis/MALAPIManga.ts @@ -105,7 +105,7 @@ export class MALAPIManga extends APIModel { url: result.url, id: result.mal_id, - plot: result.synopsis, + plot: (result.synopsis ?? 'unknown').replace(/"/g, "'") ?? 'unknown', genres: result.genres?.map((x: any) => x.name) ?? [], authors: result.authors?.map((x: any) => x.name) ?? [], chapters: result.chapters,