include song version

This commit is contained in:
Sayem Chowdhury 2021-03-26 20:07:53 +06:00
parent 66c16a4c9a
commit b764b684dd
2 changed files with 15 additions and 2 deletions

View File

@ -50,13 +50,16 @@ const getUrlParts = async (url: string): Promise<urlPartsType> => {
case 'deezer':
const deezerUrlParts = url.split(/\/(\w+)\/(\d+)/);
return {type: deezerUrlParts[1] as any, id: deezerUrlParts[2]};
case 'spotify':
const spotifyUrlParts = spotifyUri.parse(url);
await spotify.setSpotifyAnonymousToken();
return {type: ('spotify-' + spotifyUrlParts.type) as any, id: (spotifyUrlParts as any).id};
case 'tidal':
const tidalUrlParts = url.split(/\/(\w+)\/(\d+|\w+-\w+-\w+-\w+-\w+)/);
return {type: ('tidal-' + tidalUrlParts[1]) as any, id: tidalUrlParts[2]};
default:
throw new Error('Unable to parse URL: ' + url);
}
@ -162,5 +165,15 @@ export const parseInfo = async (url: string) => {
throw new Error('Unknown type: ' + info.type);
}
return {info, linktype, linkinfo, tracks};
return {
info,
linktype,
linkinfo,
tracks: tracks.map((t) => {
if (t.VERSION) {
t.SNG_TITLE += ' ' + t.VERSION;
}
return t;
}),
};
};

View File

@ -62,7 +62,7 @@ interface songType {
S_PREMIUM: number; // 0
TRACK_NUMBER: number; // '4'
URL_REWRITING: string; // 'daft-punk'
VERSION: string; // ''
VERSION?: string; // '(Extended Club Mix Edit)'
MD5_ORIGIN: string; // '51afcde9f56a132096c0496cc95eb24b'
FILESIZE_AAC_64: '0';
FILESIZE_MP3_64: string; // '1798059'