Add "slug" field to Track and Album
This commit is contained in:
parent
48837d80fa
commit
8b14c2fa84
|
@ -96,6 +96,9 @@ export default class AlbumInfoParser {
|
|||
const releaseUrl = normalizeUrl(release['@id'], album.url);
|
||||
if (releaseUrl) {
|
||||
releaseItem.url = releaseUrl;
|
||||
|
||||
const urlParts = releaseUrl.split('/');
|
||||
releaseItem.slug = urlParts[urlParts.length - 1];
|
||||
}
|
||||
if (release.image) {
|
||||
if (Array.isArray(release.image) && release.image[0]) {
|
||||
|
|
|
@ -60,14 +60,21 @@ export default class TrackInfoParser {
|
|||
throw new ParseError('Failed to parse track info: invalid extra data');
|
||||
}
|
||||
|
||||
const url = basic['@id'];
|
||||
|
||||
const track: Track = {
|
||||
type: 'track',
|
||||
name: basic.name,
|
||||
description: basic.description.replaceAll('\r\n', '\n') || '',
|
||||
url: basic['@id'],
|
||||
url,
|
||||
position: extra.current?.track_number
|
||||
};
|
||||
|
||||
if (url) {
|
||||
const urlParts = url.split('/');
|
||||
url.slug = urlParts[urlParts.length - 1];
|
||||
}
|
||||
|
||||
const imageUrl = reformatImageUrl(basic.image, opts.albumImageFormat);
|
||||
if (imageUrl) {
|
||||
track.imageUrl = imageUrl;
|
||||
|
|
|
@ -17,6 +17,7 @@ export interface AlbumRelease {
|
|||
name: string;
|
||||
format: string;
|
||||
url?: string;
|
||||
slug?: string;
|
||||
imageUrl?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import MediaKind from './MediaKind.js';
|
|||
interface Track extends MediaKind {
|
||||
type: 'track';
|
||||
description?: string;
|
||||
url?: string;
|
||||
slug?: string;
|
||||
duration?: number;
|
||||
seekPosition?: number;
|
||||
streamUrl?: string;
|
||||
|
|
Loading…
Reference in New Issue
Block a user