Merge pull request #198 from ZackBoe/mb-releasedate

MusicBrainz: Add releaseDate to music releases
This commit is contained in:
Moritz Jung 2025-07-25 11:05:40 +02:00 committed by GitHub
commit aab9ee64c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View file

@ -8,6 +8,7 @@ import { APIModel } from '../APIModel';
export class MusicBrainzAPI extends APIModel {
plugin: MediaDbPlugin;
apiDateFormat: string = 'YYYY-MM-DD';
constructor(plugin: MediaDbPlugin) {
super();
@ -48,6 +49,7 @@ export class MusicBrainzAPI extends APIModel {
title: result.title,
englishTitle: result.title,
year: new Date(result['first-release-date']).getFullYear().toString(),
releaseDate: this.plugin.dateFormatter.format(result['first-release-date'], this.apiDateFormat) ?? 'unknown',
dataSource: this.apiName,
url: 'https://musicbrainz.org/release-group/' + result.id,
id: result.id,
@ -84,6 +86,7 @@ export class MusicBrainzAPI extends APIModel {
title: result.title,
englishTitle: result.title,
year: new Date(result['first-release-date']).getFullYear().toString(),
releaseDate: this.plugin.dateFormatter.format(result['first-release-date'], this.apiDateFormat) ?? 'unknown',
dataSource: this.apiName,
url: 'https://musicbrainz.org/release-group/' + result.id,
id: result.id,

View file

@ -10,6 +10,7 @@ export class MusicReleaseModel extends MediaTypeModel {
artists: string[];
image: string;
rating: number;
releaseDate: string;
userData: {
personalRating: number;
@ -22,6 +23,8 @@ export class MusicReleaseModel extends MediaTypeModel {
this.artists = [];
this.image = '';
this.rating = 0;
this.releaseDate = '';
this.userData = {
personalRating: 0,
};