From 9bc40e00c2126121cb93b20f5bb5080e7f77e8eb Mon Sep 17 00:00:00 2001 From: aria blue Date: Thu, 11 Apr 2024 17:04:24 -0400 Subject: [PATCH] improve tidal logs, fix soundcloud (for real this time) --- src/streamers/soundcloud/parse.ts | 4 ++-- src/streamers/tidal/main.ts | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/streamers/soundcloud/parse.ts b/src/streamers/soundcloud/parse.ts index fec68dd..97ce5e5 100644 --- a/src/streamers/soundcloud/parse.ts +++ b/src/streamers/soundcloud/parse.ts @@ -66,7 +66,7 @@ export async function parseAlbum(raw: RawAlbum): Promise { } if (raw.tracks?.[0]?.artwork_url != undefined) { album.coverArtwork = [ - await parseCoverArtwork(raw.tracks[0].artwork_url.replace('-large', '-original')) + await parseCoverArtwork(raw?.tracks?.[0]?.artwork_url) ] } return album @@ -95,7 +95,7 @@ export async function parseTrack(raw: RawTrack): Promise { } if (raw?.artwork_url != undefined) { - track.coverArtwork = [await parseCoverArtwork(raw?.artwork_url?.replace('-large', '-original'))] + track.coverArtwork = [await parseCoverArtwork(raw?.artwork_url)] } return track diff --git a/src/streamers/tidal/main.ts b/src/streamers/tidal/main.ts index 6bcdc25..707ff39 100644 --- a/src/streamers/tidal/main.ts +++ b/src/streamers/tidal/main.ts @@ -51,8 +51,8 @@ export default class Tidal implements Streamer { if (!this.refreshToken) return if (await this.sessionValid()) return const success = await this.refresh() - if (success) console.log(`Refreshed tokens successfully`) - else console.log(`Failed to refresh tokens, this could be a bad sign`) + if (success) console.log(`[tidal] Refreshed tokens successfully`) + else console.log(`[tidal] Failed to refresh tokens, this could be a bad sign`) } getReady() } @@ -86,15 +86,15 @@ export default class Tidal implements Streamer { const sessionValid = await this.sessionValid() if (json.status == 401 && !sessionValid) { this.failedAuth = !(await this.refresh()) - console.log('Refreshed tokens') + console.log('[tidal] Refreshed tokens') if (this.failedAuth) { throw new Error('Auth failed. Try getting new tokens.') } return this.#get(url, params) } - console.error('Tidal error response:', json) + console.error('[tidal] Tidal error response:', json) } catch (error) { - console.error('Tidal error response:', errMsg) + console.error('[tidal] Tidal error response:', errMsg) } throw new Error(`Fetching ${url} from Tidal failed with status code ${response.status}.`) } @@ -146,9 +146,9 @@ export default class Tidal implements Streamer { this.refreshToken = loginData.refresh_token this.expires = Date.now() + loginData.expires_in * 1000 - console.log('Using the following new config:', this.getCurrentConfig()) + console.log('[tidal] Using the following new config:', this.getCurrentConfig()) } - console.log(`Log in at ${linkUrl}`) + console.log(`[tidal] Log in at ${linkUrl}`) checkToken() return linkUrl }