Add country, boxOffice and ageRating fields for movies and series

OMDbAPI has all 3 of these fields and MALAPI only has ageRating. While most anime is japanese there are some korean or chinese anime also on MAL so I thought it best to just set country and boxOffice as empty.

boxOffice isn't applicable for series so I removed that field
This commit is contained in:
ltctceplrm 2025-07-19 19:14:11 +02:00
parent c87cb098b2
commit ece6650376
4 changed files with 23 additions and 0 deletions

View file

@ -119,6 +119,9 @@ export class MALAPI extends APIModel {
image: result.images?.jpg?.image_url ?? '',
released: true,
country: [],
boxOffice: '',
ageRating: result.rating ?? '',
premiere: this.plugin.dateFormatter.format(result.aired?.from, this.apiDateFormat) ?? 'unknown',
streamingServices: result.streaming?.map((x: any) => x.name) ?? [],
@ -151,6 +154,9 @@ export class MALAPI extends APIModel {
image: result.images?.jpg?.image_url ?? '',
released: true,
country: [],
boxOffice: '',
ageRating: result.rating ?? '',
premiere: this.plugin.dateFormatter.format(result.aired?.from, this.apiDateFormat) ?? 'unknown',
streamingServices: result.streaming?.map((x: any) => x.name) ?? [],
@ -181,6 +187,8 @@ export class MALAPI extends APIModel {
image: result.images?.jpg?.image_url ?? '',
released: true,
country: [],
ageRating: result.rating ?? '',
airedFrom: this.plugin.dateFormatter.format(result.aired?.from, this.apiDateFormat) ?? 'unknown',
airedTo: this.plugin.dateFormatter.format(result.aired?.to, this.apiDateFormat) ?? 'unknown',
airing: result.airing,

View file

@ -154,6 +154,9 @@ export class OMDbAPI extends APIModel {
image: result.Poster ? result.Poster.replace('_SX300', '_SX600') : '',
released: true,
country: result.Country?.split(', ') ?? [],
boxOffice: result.BoxOffice,
ageRating: result.Rated,
streamingServices: [],
premiere: this.plugin.dateFormatter.format(result.Released, this.apiDateFormat) ?? 'unknown',
@ -184,6 +187,8 @@ export class OMDbAPI extends APIModel {
image: result.Poster ? result.Poster.replace('_SX300', '_SX600') : '',
released: true,
country: result.Country?.split(', ') ?? [],
ageRating: result.Rated,
streamingServices: [],
airing: false,
airedFrom: this.plugin.dateFormatter.format(result.Released, this.apiDateFormat) ?? 'unknown',

View file

@ -17,6 +17,9 @@ export class MovieModel extends MediaTypeModel {
image: string;
released: boolean;
country: string[];
boxOffice: string;
ageRating: string;
streamingServices: string[];
premiere: string;
@ -40,6 +43,9 @@ export class MovieModel extends MediaTypeModel {
this.image = '';
this.released = false;
this.country = [];
this.boxOffice = '';
this.ageRating = '';
this.streamingServices = [];
this.premiere = '';

View file

@ -17,6 +17,8 @@ export class SeriesModel extends MediaTypeModel {
image: string;
released: boolean;
country: string[];
ageRating: string;
streamingServices: string[];
airing: boolean;
airedFrom: string;
@ -42,6 +44,8 @@ export class SeriesModel extends MediaTypeModel {
this.image = '';
this.released = false;
this.country = [];
this.ageRating = '';
this.streamingServices = [];
this.airing = false;
this.airedFrom = '';