Merge pull request #114 from ltctceplrm/master
Added album covers to the musicbrainz api
This commit is contained in:
commit
26cf166a54
10 changed files with 43 additions and 14 deletions
|
|
@ -108,8 +108,11 @@ 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',
|
||||
director: [],
|
||||
writer: [],
|
||||
studio: result.studios?.map((x: any) => x.name).join(', ') ?? 'unknown',
|
||||
duration: result.duration ?? 'unknown',
|
||||
onlineRating: result.score ?? 0,
|
||||
actors: [],
|
||||
|
|
@ -139,8 +142,11 @@ 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',
|
||||
director: [],
|
||||
writer: [],
|
||||
studio: result.studios?.map((x: any) => x.name).join(', ') ?? 'unknown',
|
||||
duration: result.duration ?? 'unknown',
|
||||
onlineRating: result.score ?? 0,
|
||||
actors: [],
|
||||
|
|
@ -169,7 +175,8 @@ export class MALAPI extends APIModel {
|
|||
id: result.mal_id,
|
||||
|
||||
genres: result.genres?.map((x: any) => x.name) ?? [],
|
||||
studios: result.studios?.map((x: any) => x.name) ?? [],
|
||||
writer: [],
|
||||
studio: result.studios?.map((x: any) => x.name) ?? [],
|
||||
episodes: result.episodes,
|
||||
duration: result.duration ?? 'unknown',
|
||||
onlineRating: result.score ?? 0,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -49,8 +49,9 @@ export class MusicBrainzAPI extends APIModel {
|
|||
englishTitle: result.title,
|
||||
year: new Date(result['first-release-date']).getFullYear().toString(),
|
||||
dataSource: this.apiName,
|
||||
url: '',
|
||||
url: 'https://musicbrainz.org/release-group/' + result.id,
|
||||
id: result.id,
|
||||
image: 'https://coverartarchive.org/release-group/' + result.id + '/front',
|
||||
|
||||
artists: result['artist-credit'].map((a: any) => a.name),
|
||||
subType: result['primary-type'],
|
||||
|
|
@ -86,8 +87,9 @@ export class MusicBrainzAPI extends APIModel {
|
|||
englishTitle: result.title,
|
||||
year: new Date(result['first-release-date']).getFullYear().toString(),
|
||||
dataSource: this.apiName,
|
||||
url: '',
|
||||
url: 'https://musicbrainz.org/release-group/' + result.id,
|
||||
id: result.id,
|
||||
image: 'https://coverartarchive.org/release-group/' + result.id + '/front',
|
||||
|
||||
artists: result['artist-credit'].map((a: any) => a.name),
|
||||
genres: result.genres.map((g: any) => g.name),
|
||||
|
|
|
|||
|
|
@ -134,8 +134,11 @@ 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',
|
||||
director: result.Director?.split(', ') ?? [],
|
||||
writer: result.Writer?.split(', ') ?? [],
|
||||
studio: ['N/A'],
|
||||
duration: result.Runtime ?? 'unknown',
|
||||
onlineRating: Number.parseFloat(result.imdbRating ?? 0),
|
||||
actors: result.Actors?.split(', ') ?? [],
|
||||
|
|
@ -163,8 +166,10 @@ 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',
|
||||
writer: result.Writer?.split(', ') ?? [],
|
||||
studio: [],
|
||||
episodes: 0,
|
||||
duration: result.Runtime ?? 'unknown',
|
||||
onlineRating: Number.parseFloat(result.imdbRating ?? 0),
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ export class OpenLibraryAPI extends APIModel {
|
|||
englishTitle: result.title_english ?? result.title,
|
||||
|
||||
author: result.author_name ?? 'unknown',
|
||||
plot: result.description ?? 'unknown',
|
||||
pages: result.number_of_pages_median ?? 'unknown',
|
||||
onlineRating: Number.parseFloat(Number(result.ratings_average ?? 0).toFixed(2)),
|
||||
image: `https://covers.openlibrary.org/b/OLID/` + result.cover_edition_key + `-L.jpg` ?? '',
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { MediaType } from '../utils/MediaType';
|
|||
|
||||
export class BookModel extends MediaTypeModel {
|
||||
author: string;
|
||||
plot: string;
|
||||
pages: number;
|
||||
image: string;
|
||||
onlineRating: number;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,11 @@ import { mediaDbTag, migrateObject } from '../utils/Utils';
|
|||
import { MediaType } from '../utils/MediaType';
|
||||
|
||||
export class MovieModel extends MediaTypeModel {
|
||||
plot: string;
|
||||
genres: string[];
|
||||
producer: string;
|
||||
director: string[];
|
||||
writer: string[];
|
||||
studio: string[];
|
||||
duration: string;
|
||||
onlineRating: number;
|
||||
actors: string[];
|
||||
|
|
@ -23,8 +26,11 @@ export class MovieModel extends MediaTypeModel {
|
|||
constructor(obj: any = {}) {
|
||||
super();
|
||||
|
||||
this.plot = undefined;
|
||||
this.genres = undefined;
|
||||
this.producer = undefined;
|
||||
this.director = undefined;
|
||||
this.writer = undefined;
|
||||
this.studio = undefined;
|
||||
this.duration = undefined;
|
||||
this.onlineRating = undefined;
|
||||
this.actors = undefined;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ export class MusicReleaseModel extends MediaTypeModel {
|
|||
dataSource: string;
|
||||
url: string;
|
||||
id: string;
|
||||
image: string;
|
||||
|
||||
genres: string[];
|
||||
artists: string[];
|
||||
|
|
@ -25,6 +26,7 @@ export class MusicReleaseModel extends MediaTypeModel {
|
|||
|
||||
this.genres = undefined;
|
||||
this.artists = undefined;
|
||||
this.image = undefined;
|
||||
this.rating = undefined;
|
||||
this.userData = {
|
||||
personalRating: undefined,
|
||||
|
|
|
|||
|
|
@ -12,8 +12,10 @@ export class SeriesModel extends MediaTypeModel {
|
|||
url: string;
|
||||
id: string;
|
||||
|
||||
plot: string;
|
||||
genres: string[];
|
||||
studios: string[];
|
||||
writer: string[];
|
||||
studio: string[];
|
||||
episodes: number;
|
||||
duration: string;
|
||||
onlineRating: number;
|
||||
|
|
@ -35,8 +37,10 @@ export class SeriesModel extends MediaTypeModel {
|
|||
constructor(obj: any = {}) {
|
||||
super();
|
||||
|
||||
this.plot = undefined;
|
||||
this.genres = undefined;
|
||||
this.studios = undefined;
|
||||
this.writer = undefined;
|
||||
this.studio = undefined;
|
||||
this.episodes = undefined;
|
||||
this.duration = undefined;
|
||||
this.onlineRating = undefined;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue