mirror of
https://codeberg.org/lucida/lucida.git
synced 2026-11-12 22:57:22 -05:00
throw proper error for incompatibility on tidal, format qobuz
This commit is contained in:
@@ -139,13 +139,14 @@ export default class Qobuz implements StreamerWithLogin {
|
||||
}
|
||||
interface RawTrackFileResponse {
|
||||
url: string
|
||||
mime_type: string,
|
||||
mime_type: string
|
||||
sample: boolean
|
||||
}
|
||||
const trackFileResponse = <RawTrackFileResponse>(
|
||||
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,
|
||||
|
||||
@@ -263,10 +263,11 @@ export default class Tidal implements Streamer {
|
||||
tracks: tracksResponse.items.map(parseTrack)
|
||||
}
|
||||
}
|
||||
async #getFileUrl(trackId: number | string, quality = 'HI_RES'): Promise<GetStreamResponse> {
|
||||
async #getFileUrl(trackId: number | string, quality = 'LOSSLESS'): Promise<GetStreamResponse> {
|
||||
interface PlaybackInfo {
|
||||
manifest: string
|
||||
manifestMimeType: string
|
||||
audioQuality: 'LOW' | 'HIGH' | 'LOSSLESS' | 'HI_RES'
|
||||
}
|
||||
const playbackInfoResponse = <PlaybackInfo>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
|
||||
|
||||
Reference in New Issue
Block a user