mirror of
https://codeberg.org/lucida/lucida.git
synced 2026-11-13 07:07:49 -05:00
fix tidal issue, format/lint other modules, bump version
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
import fetch, { HeadersInit } from 'node-fetch'
|
||||
import { DEFAULT_HEADERS, SC_VERSION } from './constants.js'
|
||||
import { ItemType, Streamer, SearchResults, GetByUrlResponse, GetStreamResponse } from '../../types.js'
|
||||
import {
|
||||
ItemType,
|
||||
Streamer,
|
||||
SearchResults,
|
||||
GetByUrlResponse,
|
||||
GetStreamResponse
|
||||
} from '../../types.js'
|
||||
import {
|
||||
parseAlbum,
|
||||
parseTrack,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Librespot, { LibrespotOptions } from 'librespot'
|
||||
import { parseArtist, parseAlbum, parseTrack } from './parse.js'
|
||||
import { ItemType, GetByUrlResponse, SearchResults, StreamerWithLogin } from '../../types.js'
|
||||
import { GetByUrlResponse, SearchResults, StreamerWithLogin } from '../../types.js'
|
||||
|
||||
class Spotify implements StreamerWithLogin {
|
||||
client: Librespot
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
import fetch from 'node-fetch'
|
||||
import { spawn } from 'child_process'
|
||||
import { ItemType, GetByUrlResponse, GetStreamResponse, SearchResults, Streamer, Track } from '../../types.js'
|
||||
import {
|
||||
ItemType,
|
||||
GetByUrlResponse,
|
||||
GetStreamResponse,
|
||||
SearchResults,
|
||||
Streamer,
|
||||
Track
|
||||
} from '../../types.js'
|
||||
import { TIDAL_AUTH_BASE, TIDAL_API_BASE } from './constants.js'
|
||||
import {
|
||||
Contributor,
|
||||
@@ -271,11 +278,12 @@ export default class Tidal implements Streamer {
|
||||
}
|
||||
)
|
||||
const manifestStr = Buffer.from(playbackInfoResponse.manifest, 'base64').toString('utf-8')
|
||||
interface Manifest {
|
||||
mimeType: string
|
||||
urls: string[]
|
||||
}
|
||||
|
||||
if (playbackInfoResponse.manifestMimeType != 'application/dash+xml') {
|
||||
interface Manifest {
|
||||
mimeType: string
|
||||
urls: string[]
|
||||
}
|
||||
const manifest = <Manifest>JSON.parse(manifestStr)
|
||||
const streamResponse = await fetch(manifest.urls[0])
|
||||
return {
|
||||
@@ -284,6 +292,7 @@ export default class Tidal implements Streamer {
|
||||
stream: <NodeJS.ReadableStream>streamResponse.body
|
||||
}
|
||||
}
|
||||
|
||||
const trackUrls = parseMpd(manifestStr)
|
||||
|
||||
const ffmpegProc = spawn('ffmpeg', [
|
||||
@@ -318,8 +327,7 @@ export default class Tidal implements Streamer {
|
||||
load()
|
||||
|
||||
return {
|
||||
mimeType: playbackInfoResponse.manifestMimeType,
|
||||
sizeBytes: manifestStr.length,
|
||||
mimeType: 'audio/flac',
|
||||
stream: ffmpegProc.stdout
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ export interface SearchResults {
|
||||
}
|
||||
|
||||
export interface GetStreamResponse {
|
||||
sizeBytes: number
|
||||
sizeBytes?: number
|
||||
stream: NodeJS.ReadableStream
|
||||
mimeType: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user