Added language and trackCount fields for music

The language at musicbrainz is in the format of iso-639-2 so I use a package to translate it to a full name of the language.
This commit is contained in:
ltctceplrm 2025-08-10 15:17:00 +02:00
parent b6f8258484
commit f51a1465b4
5 changed files with 16 additions and 2 deletions

View file

@ -1,6 +1,6 @@
import { MediaType } from '../utils/MediaType';
import type { ModelToData } from '../utils/Utils';
import { mediaDbTag, migrateObject } from '../utils/Utils';
import { mediaDbTag, migrateObject, getLanguageName } from '../utils/Utils';
import { MediaTypeModel } from './MediaTypeModel';
export type MusicReleaseData = ModelToData<MusicReleaseModel>;
@ -8,9 +8,11 @@ export type MusicReleaseData = ModelToData<MusicReleaseModel>;
export class MusicReleaseModel extends MediaTypeModel {
genres: string[];
artists: string[];
language: string;
image: string;
rating: number;
releaseDate: string;
trackCount: number;
tracks: {
number: number;
title: string;
@ -42,7 +44,9 @@ export class MusicReleaseModel extends MediaTypeModel {
}
this.type = this.getMediaType();
this.trackCount = obj.trackCount ?? 0;
this.tracks = obj.tracks ?? [];
this.language = obj.language ?? '';
}
getTags(): string[] {