Skip to content

Commit a685d82

Browse files
Merge pull request #196 from ltctceplrm/omdbapi
Add country, boxOffice and ageRating fields for movies and series
2 parents aab9ee6 + ece6650 commit a685d82

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

src/api/apis/MALAPI.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ export class MALAPI extends APIModel {
119119
image: result.images?.jpg?.image_url ?? '',
120120

121121
released: true,
122+
country: [],
123+
boxOffice: '',
124+
ageRating: result.rating ?? '',
122125
premiere: this.plugin.dateFormatter.format(result.aired?.from, this.apiDateFormat) ?? 'unknown',
123126
streamingServices: result.streaming?.map((x: any) => x.name) ?? [],
124127

@@ -151,6 +154,9 @@ export class MALAPI extends APIModel {
151154
image: result.images?.jpg?.image_url ?? '',
152155

153156
released: true,
157+
country: [],
158+
boxOffice: '',
159+
ageRating: result.rating ?? '',
154160
premiere: this.plugin.dateFormatter.format(result.aired?.from, this.apiDateFormat) ?? 'unknown',
155161
streamingServices: result.streaming?.map((x: any) => x.name) ?? [],
156162

@@ -181,6 +187,8 @@ export class MALAPI extends APIModel {
181187
image: result.images?.jpg?.image_url ?? '',
182188

183189
released: true,
190+
country: [],
191+
ageRating: result.rating ?? '',
184192
airedFrom: this.plugin.dateFormatter.format(result.aired?.from, this.apiDateFormat) ?? 'unknown',
185193
airedTo: this.plugin.dateFormatter.format(result.aired?.to, this.apiDateFormat) ?? 'unknown',
186194
airing: result.airing,

src/api/apis/OMDbAPI.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ export class OMDbAPI extends APIModel {
154154
image: result.Poster ? result.Poster.replace('_SX300', '_SX600') : '',
155155

156156
released: true,
157+
country: result.Country?.split(', ') ?? [],
158+
boxOffice: result.BoxOffice,
159+
ageRating: result.Rated,
157160
streamingServices: [],
158161
premiere: this.plugin.dateFormatter.format(result.Released, this.apiDateFormat) ?? 'unknown',
159162

@@ -184,6 +187,8 @@ export class OMDbAPI extends APIModel {
184187
image: result.Poster ? result.Poster.replace('_SX300', '_SX600') : '',
185188

186189
released: true,
190+
country: result.Country?.split(', ') ?? [],
191+
ageRating: result.Rated,
187192
streamingServices: [],
188193
airing: false,
189194
airedFrom: this.plugin.dateFormatter.format(result.Released, this.apiDateFormat) ?? 'unknown',

src/models/MovieModel.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ export class MovieModel extends MediaTypeModel {
1717
image: string;
1818

1919
released: boolean;
20+
country: string[];
21+
boxOffice: string;
22+
ageRating: string;
2023
streamingServices: string[];
2124
premiere: string;
2225

@@ -40,6 +43,9 @@ export class MovieModel extends MediaTypeModel {
4043
this.image = '';
4144

4245
this.released = false;
46+
this.country = [];
47+
this.boxOffice = '';
48+
this.ageRating = '';
4349
this.streamingServices = [];
4450
this.premiere = '';
4551

src/models/SeriesModel.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export class SeriesModel extends MediaTypeModel {
1717
image: string;
1818

1919
released: boolean;
20+
country: string[];
21+
ageRating: string;
2022
streamingServices: string[];
2123
airing: boolean;
2224
airedFrom: string;
@@ -42,6 +44,8 @@ export class SeriesModel extends MediaTypeModel {
4244
this.image = '';
4345

4446
this.released = false;
47+
this.country = [];
48+
this.ageRating = '';
4549
this.streamingServices = [];
4650
this.airing = false;
4751
this.airedFrom = '';

0 commit comments

Comments
 (0)