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,
|
url: result.url,
|
||||||
id: result.mal_id,
|
id: result.mal_id,
|
||||||
|
|
||||||
|
plot: result.synopsis,
|
||||||
genres: result.genres?.map((x: any) => x.name) ?? [],
|
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',
|
duration: result.duration ?? 'unknown',
|
||||||
onlineRating: result.score ?? 0,
|
onlineRating: result.score ?? 0,
|
||||||
actors: [],
|
actors: [],
|
||||||
|
|
@ -139,8 +142,11 @@ export class MALAPI extends APIModel {
|
||||||
url: result.url,
|
url: result.url,
|
||||||
id: result.mal_id,
|
id: result.mal_id,
|
||||||
|
|
||||||
|
plot: result.synopsis,
|
||||||
genres: result.genres?.map((x: any) => x.name) ?? [],
|
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',
|
duration: result.duration ?? 'unknown',
|
||||||
onlineRating: result.score ?? 0,
|
onlineRating: result.score ?? 0,
|
||||||
actors: [],
|
actors: [],
|
||||||
|
|
@ -169,7 +175,8 @@ export class MALAPI extends APIModel {
|
||||||
id: result.mal_id,
|
id: result.mal_id,
|
||||||
|
|
||||||
genres: result.genres?.map((x: any) => x.name) ?? [],
|
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,
|
episodes: result.episodes,
|
||||||
duration: result.duration ?? 'unknown',
|
duration: result.duration ?? 'unknown',
|
||||||
onlineRating: result.score ?? 0,
|
onlineRating: result.score ?? 0,
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ export class MALAPIManga extends APIModel {
|
||||||
new MangaModel({
|
new MangaModel({
|
||||||
subType: type,
|
subType: type,
|
||||||
title: result.title,
|
title: result.title,
|
||||||
synopsis: result.synopsis,
|
plot: result.synopsis,
|
||||||
englishTitle: result.title_english ?? result.title,
|
englishTitle: result.title_english ?? result.title,
|
||||||
alternateTitles: result.titles?.map((x: any) => x.title) ?? [],
|
alternateTitles: result.titles?.map((x: any) => x.title) ?? [],
|
||||||
year: result.year ?? result.published?.prop?.from?.year ?? '',
|
year: result.year ?? result.published?.prop?.from?.year ?? '',
|
||||||
|
|
@ -98,7 +98,6 @@ export class MALAPIManga extends APIModel {
|
||||||
const model = new MangaModel({
|
const model = new MangaModel({
|
||||||
subType: type,
|
subType: type,
|
||||||
title: result.title,
|
title: result.title,
|
||||||
synopsis: result.synopsis,
|
|
||||||
englishTitle: result.title_english ?? result.title,
|
englishTitle: result.title_english ?? result.title,
|
||||||
alternateTitles: result.titles?.map((x: any) => x.title) ?? [],
|
alternateTitles: result.titles?.map((x: any) => x.title) ?? [],
|
||||||
year: result.year ?? result.published?.prop?.from?.year ?? '',
|
year: result.year ?? result.published?.prop?.from?.year ?? '',
|
||||||
|
|
@ -106,6 +105,7 @@ export class MALAPIManga extends APIModel {
|
||||||
url: result.url,
|
url: result.url,
|
||||||
id: result.mal_id,
|
id: result.mal_id,
|
||||||
|
|
||||||
|
plot: result.synopsis,
|
||||||
genres: result.genres?.map((x: any) => x.name) ?? [],
|
genres: result.genres?.map((x: any) => x.name) ?? [],
|
||||||
authors: result.authors?.map((x: any) => x.name) ?? [],
|
authors: result.authors?.map((x: any) => x.name) ?? [],
|
||||||
chapters: result.chapters,
|
chapters: result.chapters,
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,9 @@ export class MusicBrainzAPI extends APIModel {
|
||||||
englishTitle: result.title,
|
englishTitle: result.title,
|
||||||
year: new Date(result['first-release-date']).getFullYear().toString(),
|
year: new Date(result['first-release-date']).getFullYear().toString(),
|
||||||
dataSource: this.apiName,
|
dataSource: this.apiName,
|
||||||
url: '',
|
url: 'https://musicbrainz.org/release-group/' + result.id,
|
||||||
id: result.id,
|
id: result.id,
|
||||||
|
image: 'https://coverartarchive.org/release-group/' + result.id + '/front',
|
||||||
|
|
||||||
artists: result['artist-credit'].map((a: any) => a.name),
|
artists: result['artist-credit'].map((a: any) => a.name),
|
||||||
subType: result['primary-type'],
|
subType: result['primary-type'],
|
||||||
|
|
@ -86,8 +87,9 @@ export class MusicBrainzAPI extends APIModel {
|
||||||
englishTitle: result.title,
|
englishTitle: result.title,
|
||||||
year: new Date(result['first-release-date']).getFullYear().toString(),
|
year: new Date(result['first-release-date']).getFullYear().toString(),
|
||||||
dataSource: this.apiName,
|
dataSource: this.apiName,
|
||||||
url: '',
|
url: 'https://musicbrainz.org/release-group/' + result.id,
|
||||||
id: result.id,
|
id: result.id,
|
||||||
|
image: 'https://coverartarchive.org/release-group/' + result.id + '/front',
|
||||||
|
|
||||||
artists: result['artist-credit'].map((a: any) => a.name),
|
artists: result['artist-credit'].map((a: any) => a.name),
|
||||||
genres: result.genres.map((g: any) => g.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}/`,
|
url: `https://www.imdb.com/title/${result.imdbID}/`,
|
||||||
id: result.imdbID,
|
id: result.imdbID,
|
||||||
|
|
||||||
|
plot: result.Plot ?? '',
|
||||||
genres: result.Genre?.split(', ') ?? [],
|
genres: result.Genre?.split(', ') ?? [],
|
||||||
producer: result.Director ?? 'unknown',
|
director: result.Director?.split(', ') ?? [],
|
||||||
|
writer: result.Writer?.split(', ') ?? [],
|
||||||
|
studio: ['N/A'],
|
||||||
duration: result.Runtime ?? 'unknown',
|
duration: result.Runtime ?? 'unknown',
|
||||||
onlineRating: Number.parseFloat(result.imdbRating ?? 0),
|
onlineRating: Number.parseFloat(result.imdbRating ?? 0),
|
||||||
actors: result.Actors?.split(', ') ?? [],
|
actors: result.Actors?.split(', ') ?? [],
|
||||||
|
|
@ -163,8 +166,10 @@ export class OMDbAPI extends APIModel {
|
||||||
url: `https://www.imdb.com/title/${result.imdbID}/`,
|
url: `https://www.imdb.com/title/${result.imdbID}/`,
|
||||||
id: result.imdbID,
|
id: result.imdbID,
|
||||||
|
|
||||||
|
plot: result.Plot ?? '',
|
||||||
genres: result.Genre?.split(', ') ?? [],
|
genres: result.Genre?.split(', ') ?? [],
|
||||||
studios: [result.Director] ?? 'unknown',
|
writer: result.Writer?.split(', ') ?? [],
|
||||||
|
studio: [],
|
||||||
episodes: 0,
|
episodes: 0,
|
||||||
duration: result.Runtime ?? 'unknown',
|
duration: result.Runtime ?? 'unknown',
|
||||||
onlineRating: Number.parseFloat(result.imdbRating ?? 0),
|
onlineRating: Number.parseFloat(result.imdbRating ?? 0),
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ export class OpenLibraryAPI extends APIModel {
|
||||||
englishTitle: result.title_english ?? result.title,
|
englishTitle: result.title_english ?? result.title,
|
||||||
|
|
||||||
author: result.author_name ?? 'unknown',
|
author: result.author_name ?? 'unknown',
|
||||||
|
plot: result.description ?? 'unknown',
|
||||||
pages: result.number_of_pages_median ?? 'unknown',
|
pages: result.number_of_pages_median ?? 'unknown',
|
||||||
onlineRating: Number.parseFloat(Number(result.ratings_average ?? 0).toFixed(2)),
|
onlineRating: Number.parseFloat(Number(result.ratings_average ?? 0).toFixed(2)),
|
||||||
image: `https://covers.openlibrary.org/b/OLID/` + result.cover_edition_key + `-L.jpg` ?? '',
|
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 {
|
export class BookModel extends MediaTypeModel {
|
||||||
author: string;
|
author: string;
|
||||||
|
plot: string;
|
||||||
pages: number;
|
pages: number;
|
||||||
image: string;
|
image: string;
|
||||||
onlineRating: number;
|
onlineRating: number;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ export class MangaModel extends MediaTypeModel {
|
||||||
type: string;
|
type: string;
|
||||||
subType: string;
|
subType: string;
|
||||||
title: string;
|
title: string;
|
||||||
synopsis: string;
|
plot: string;
|
||||||
englishTitle: string;
|
englishTitle: string;
|
||||||
alternateTitles: string[];
|
alternateTitles: string[];
|
||||||
year: string;
|
year: string;
|
||||||
|
|
@ -35,6 +35,7 @@ export class MangaModel extends MediaTypeModel {
|
||||||
constructor(obj: any = {}) {
|
constructor(obj: any = {}) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
this.plot = undefined;
|
||||||
this.genres = undefined;
|
this.genres = undefined;
|
||||||
this.authors = undefined;
|
this.authors = undefined;
|
||||||
this.alternateTitles = undefined;
|
this.alternateTitles = undefined;
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,11 @@ import { mediaDbTag, migrateObject } from '../utils/Utils';
|
||||||
import { MediaType } from '../utils/MediaType';
|
import { MediaType } from '../utils/MediaType';
|
||||||
|
|
||||||
export class MovieModel extends MediaTypeModel {
|
export class MovieModel extends MediaTypeModel {
|
||||||
|
plot: string;
|
||||||
genres: string[];
|
genres: string[];
|
||||||
producer: string;
|
director: string[];
|
||||||
|
writer: string[];
|
||||||
|
studio: string[];
|
||||||
duration: string;
|
duration: string;
|
||||||
onlineRating: number;
|
onlineRating: number;
|
||||||
actors: string[];
|
actors: string[];
|
||||||
|
|
@ -23,8 +26,11 @@ export class MovieModel extends MediaTypeModel {
|
||||||
constructor(obj: any = {}) {
|
constructor(obj: any = {}) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
this.plot = undefined;
|
||||||
this.genres = undefined;
|
this.genres = undefined;
|
||||||
this.producer = undefined;
|
this.director = undefined;
|
||||||
|
this.writer = undefined;
|
||||||
|
this.studio = undefined;
|
||||||
this.duration = undefined;
|
this.duration = undefined;
|
||||||
this.onlineRating = undefined;
|
this.onlineRating = undefined;
|
||||||
this.actors = undefined;
|
this.actors = undefined;
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ export class MusicReleaseModel extends MediaTypeModel {
|
||||||
dataSource: string;
|
dataSource: string;
|
||||||
url: string;
|
url: string;
|
||||||
id: string;
|
id: string;
|
||||||
|
image: string;
|
||||||
|
|
||||||
genres: string[];
|
genres: string[];
|
||||||
artists: string[];
|
artists: string[];
|
||||||
|
|
@ -25,6 +26,7 @@ export class MusicReleaseModel extends MediaTypeModel {
|
||||||
|
|
||||||
this.genres = undefined;
|
this.genres = undefined;
|
||||||
this.artists = undefined;
|
this.artists = undefined;
|
||||||
|
this.image = undefined;
|
||||||
this.rating = undefined;
|
this.rating = undefined;
|
||||||
this.userData = {
|
this.userData = {
|
||||||
personalRating: undefined,
|
personalRating: undefined,
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,10 @@ export class SeriesModel extends MediaTypeModel {
|
||||||
url: string;
|
url: string;
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
plot: string;
|
||||||
genres: string[];
|
genres: string[];
|
||||||
studios: string[];
|
writer: string[];
|
||||||
|
studio: string[];
|
||||||
episodes: number;
|
episodes: number;
|
||||||
duration: string;
|
duration: string;
|
||||||
onlineRating: number;
|
onlineRating: number;
|
||||||
|
|
@ -35,8 +37,10 @@ export class SeriesModel extends MediaTypeModel {
|
||||||
constructor(obj: any = {}) {
|
constructor(obj: any = {}) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
this.plot = undefined;
|
||||||
this.genres = undefined;
|
this.genres = undefined;
|
||||||
this.studios = undefined;
|
this.writer = undefined;
|
||||||
|
this.studio = undefined;
|
||||||
this.episodes = undefined;
|
this.episodes = undefined;
|
||||||
this.duration = undefined;
|
this.duration = undefined;
|
||||||
this.onlineRating = undefined;
|
this.onlineRating = undefined;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue