From 12c08e665f04b61e19d12289c5e4181568f218af Mon Sep 17 00:00:00 2001 From: aria Date: Thu, 2 May 2024 07:24:18 -0400 Subject: [PATCH] throw proper error for incompatibility on tidal, format qobuz --- src/streamers/qobuz/main.ts | 5 +++-- src/streamers/tidal/main.ts | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/streamers/qobuz/main.ts b/src/streamers/qobuz/main.ts index 0b2b011..d69e81a 100644 --- a/src/streamers/qobuz/main.ts +++ b/src/streamers/qobuz/main.ts @@ -139,13 +139,14 @@ export default class Qobuz implements StreamerWithLogin { } interface RawTrackFileResponse { url: string - mime_type: string, + mime_type: string sample: boolean } const trackFileResponse = ( await this.#getSigned('track/getFileUrl', params) ) - if (trackFileResponse.sample == true) throw new Error('Could not get non-sample file. Check your token.') + if (trackFileResponse.sample == true) + throw new Error('Could not get non-sample file. Check your token.') const streamResponse = await fetch(trackFileResponse.url) return { mimeType: trackFileResponse.mime_type, diff --git a/src/streamers/tidal/main.ts b/src/streamers/tidal/main.ts index 586f177..e1a5d90 100644 --- a/src/streamers/tidal/main.ts +++ b/src/streamers/tidal/main.ts @@ -263,10 +263,11 @@ export default class Tidal implements Streamer { tracks: tracksResponse.items.map(parseTrack) } } - async #getFileUrl(trackId: number | string, quality = 'HI_RES'): Promise { + async #getFileUrl(trackId: number | string, quality = 'LOSSLESS'): Promise { interface PlaybackInfo { manifest: string manifestMimeType: string + audioQuality: 'LOW' | 'HIGH' | 'LOSSLESS' | 'HI_RES' } const playbackInfoResponse = await this.#get( `tracks/${trackId}/playbackinfopostpaywall/v4`, @@ -277,6 +278,12 @@ export default class Tidal implements Streamer { prefetch: 'false' } ) + + if ( + playbackInfoResponse.audioQuality == 'HIGH' || + playbackInfoResponse.audioQuality == 'LOW' + ) throw new Error('This ripper is incompatible with AAC codecs formats at the moment.') + const manifestStr = Buffer.from(playbackInfoResponse.manifest, 'base64').toString('utf-8') interface Manifest { mimeType: string