format and lint

lmfao why has nobody been doing this
This commit is contained in:
hazycora
2024-07-20 08:08:47 -04:00
parent 62e032fea8
commit 233adf68f7
10 changed files with 109 additions and 71 deletions

View File

@@ -55,7 +55,7 @@ interface SubscriptionData {
highestSoundQuality: string
premiumAccess: boolean
canGetTrial: boolean
paymentType: string,
paymentType: string
paymentOverdue: boolean
}
@@ -95,7 +95,11 @@ export default class Tidal implements Streamer {
'User-Agent': 'TIDAL_ANDROID/1039 okhttp/3.14.9'
}
}
async #get(url: string, params: { [key: string]: string | number } = {}, base: string = TIDAL_API_BASE): Promise<unknown> {
async #get(
url: string,
params: { [key: string]: string | number } = {},
base: string = TIDAL_API_BASE
): Promise<unknown> {
if (this.failedAuth) throw new Error(`Last request failed to authorize, get new tokens`)
if (Date.now() > this.expires) await this.refresh()
if (!this.countryCode) await this.getCountryCode()
@@ -300,7 +304,10 @@ export default class Tidal implements Streamer {
tracks: tracksResponse.items.map(parseTrack)
}
}
async #getFileUrl(trackId: number | string, quality = 'HI_RES_LOSSLESS'): Promise<GetStreamResponse> {
async #getFileUrl(
trackId: number | string,
quality = 'HI_RES_LOSSLESS'
): Promise<GetStreamResponse> {
interface PlaybackInfo {
manifest: string
manifestMimeType: string
@@ -413,7 +420,9 @@ export default class Tidal implements Streamer {
}
async getAccountInfo(): Promise<StreamerAccount> {
if (!this.userId) await this.getCountryCode()
const subscription = <SubscriptionData>await this.#get(`users/${this.userId}/subscription`, {}, TIDAL_SUBSCRIPTION_BASE)
const subscription = <SubscriptionData>(
await this.#get(`users/${this.userId}/subscription`, {}, TIDAL_SUBSCRIPTION_BASE)
)
return {
valid: true,

View File

@@ -174,7 +174,7 @@ export function parseMpd(mpdString: string): string[] {
if (!initializationUrl) throw new Error('No initialization url')
const mediaUrl = segTemplate.getAttribute('media')
if (!mediaUrl) throw new Error('No media url')
let trackUrls = [initializationUrl]
const trackUrls = [initializationUrl]
const timeline = segTemplate.querySelector('SegmentTimeline')
if (timeline) {
let numSegments = 0