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