From 57de3d614c3ef0a2c777d61cbe2c65972adce2eb Mon Sep 17 00:00:00 2001 From: ltctceplrm <14954927+ltctceplrm@users.noreply.github.com> Date: Fri, 8 Dec 2023 03:32:07 +0100 Subject: [PATCH] Modified the PR by onesvat to add plot to media I modified synopsis in manga to plot and added the plot in MALapi that also uses the movie model, I did the same thing for series --- src/api/apis/MALAPI.ts | 2 ++ src/api/apis/MALAPIManga.ts | 4 ++-- src/api/apis/OMDbAPI.ts | 2 ++ src/models/MangaModel.ts | 3 ++- src/models/MovieModel.ts | 4 +++- src/models/SeriesModel.ts | 2 ++ 6 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/api/apis/MALAPI.ts b/src/api/apis/MALAPI.ts index 50566cc..f5c1793 100644 --- a/src/api/apis/MALAPI.ts +++ b/src/api/apis/MALAPI.ts @@ -108,6 +108,7 @@ export class MALAPI extends APIModel { url: result.url, id: result.mal_id, + plot: result.synopsis, genres: result.genres?.map((x: any) => x.name) ?? [], producer: result.studios?.map((x: any) => x.name).join(', ') ?? 'unknown', duration: result.duration ?? 'unknown', @@ -139,6 +140,7 @@ export class MALAPI extends APIModel { url: result.url, id: result.mal_id, + plot: result.synopsis, genres: result.genres?.map((x: any) => x.name) ?? [], producer: result.studios?.map((x: any) => x.name).join(', ') ?? 'unknown', duration: result.duration ?? 'unknown', diff --git a/src/api/apis/MALAPIManga.ts b/src/api/apis/MALAPIManga.ts index ee34817..b2fd80a 100644 --- a/src/api/apis/MALAPIManga.ts +++ b/src/api/apis/MALAPIManga.ts @@ -48,7 +48,7 @@ export class MALAPIManga extends APIModel { new MangaModel({ subType: type, title: result.title, - synopsis: result.synopsis, + plot: result.synopsis, englishTitle: result.title_english ?? result.title, alternateTitles: result.titles?.map((x: any) => x.title) ?? [], year: result.year ?? result.published?.prop?.from?.year ?? '', @@ -98,7 +98,6 @@ export class MALAPIManga extends APIModel { const model = new MangaModel({ subType: type, title: result.title, - synopsis: result.synopsis, englishTitle: result.title_english ?? result.title, alternateTitles: result.titles?.map((x: any) => x.title) ?? [], year: result.year ?? result.published?.prop?.from?.year ?? '', @@ -106,6 +105,7 @@ export class MALAPIManga extends APIModel { url: result.url, id: result.mal_id, + plot: result.synopsis, genres: result.genres?.map((x: any) => x.name) ?? [], authors: result.authors?.map((x: any) => x.name) ?? [], chapters: result.chapters, diff --git a/src/api/apis/OMDbAPI.ts b/src/api/apis/OMDbAPI.ts index ad3fb45..1e73787 100644 --- a/src/api/apis/OMDbAPI.ts +++ b/src/api/apis/OMDbAPI.ts @@ -134,6 +134,7 @@ export class OMDbAPI extends APIModel { url: `https://www.imdb.com/title/${result.imdbID}/`, id: result.imdbID, + plot: result.Plot ?? '', genres: result.Genre?.split(', ') ?? [], producer: result.Director ?? 'unknown', duration: result.Runtime ?? 'unknown', @@ -163,6 +164,7 @@ export class OMDbAPI extends APIModel { url: `https://www.imdb.com/title/${result.imdbID}/`, id: result.imdbID, + plot: result.Plot ?? '', genres: result.Genre?.split(', ') ?? [], studios: [result.Director] ?? 'unknown', episodes: 0, diff --git a/src/models/MangaModel.ts b/src/models/MangaModel.ts index c43f7be..244a7af 100644 --- a/src/models/MangaModel.ts +++ b/src/models/MangaModel.ts @@ -6,7 +6,7 @@ export class MangaModel extends MediaTypeModel { type: string; subType: string; title: string; - synopsis: string; + plot: string; englishTitle: string; alternateTitles: string[]; year: string; @@ -35,6 +35,7 @@ export class MangaModel extends MediaTypeModel { constructor(obj: any = {}) { super(); + this.plot = undefined; this.genres = undefined; this.authors = undefined; this.alternateTitles = undefined; diff --git a/src/models/MovieModel.ts b/src/models/MovieModel.ts index 83d874f..716161d 100644 --- a/src/models/MovieModel.ts +++ b/src/models/MovieModel.ts @@ -3,6 +3,7 @@ import { mediaDbTag, migrateObject } from '../utils/Utils'; import { MediaType } from '../utils/MediaType'; export class MovieModel extends MediaTypeModel { + plot: string; genres: string[]; producer: string; duration: string; @@ -23,6 +24,7 @@ export class MovieModel extends MediaTypeModel { constructor(obj: any = {}) { super(); + this.plot = undefined; this.genres = undefined; this.producer = undefined; this.duration = undefined; @@ -60,4 +62,4 @@ export class MovieModel extends MediaTypeModel { getSummary(): string { return this.englishTitle + ' (' + this.year + ')'; } -} +} \ No newline at end of file diff --git a/src/models/SeriesModel.ts b/src/models/SeriesModel.ts index 5132f1e..0e2224e 100644 --- a/src/models/SeriesModel.ts +++ b/src/models/SeriesModel.ts @@ -12,6 +12,7 @@ export class SeriesModel extends MediaTypeModel { url: string; id: string; + plot: string; genres: string[]; studios: string[]; episodes: number; @@ -35,6 +36,7 @@ export class SeriesModel extends MediaTypeModel { constructor(obj: any = {}) { super(); + this.plot = undefined; this.genres = undefined; this.studios = undefined; this.episodes = undefined;