mirror of
https://github.com/Boof2015/prism.git
synced 2026-08-12 05:10:51 +02:00
fix coverart spotify hook on windows
This commit is contained in:
@@ -363,6 +363,10 @@ function parseWindowsSpotifyStatusPayload(
|
||||
: 0,
|
||||
)
|
||||
|
||||
const artworkUrl = typeof payload.artworkDataUrl === 'string' && payload.artworkDataUrl
|
||||
? payload.artworkDataUrl
|
||||
: null
|
||||
|
||||
const currentTrack = title && artist
|
||||
? {
|
||||
id: sourceAppUserModelId
|
||||
@@ -372,7 +376,7 @@ function parseWindowsSpotifyStatusPayload(
|
||||
artist,
|
||||
album,
|
||||
isFavorite: false,
|
||||
artworkUrl: null,
|
||||
artworkUrl,
|
||||
} satisfies LocalSpotifyTrackSnapshot
|
||||
: null
|
||||
|
||||
@@ -1030,6 +1034,25 @@ export class SpotifyProvider implements NowPlayingProviderService<'spotify'> {
|
||||
return
|
||||
}
|
||||
|
||||
if (artworkUrl.startsWith('data:')) {
|
||||
const currentSnapshot = this.currentSnapshot
|
||||
if (!currentSnapshot || getArtworkKey(
|
||||
currentSnapshot.currentTrack?.id ?? null,
|
||||
currentSnapshot.currentTrack?.artworkUrl ?? null,
|
||||
) !== artworkKey) {
|
||||
return
|
||||
}
|
||||
this.currentArtworkKey = artworkKey
|
||||
this.currentArtworkDataUrl = artworkUrl
|
||||
this.failedArtworkKey = null
|
||||
this.state = {
|
||||
...this.state,
|
||||
snapshot: toPublicSnapshot(currentSnapshot, artworkUrl),
|
||||
}
|
||||
this.emitState()
|
||||
return
|
||||
}
|
||||
|
||||
const response = await this.fetchImpl(artworkUrl).catch(() => null)
|
||||
if (!response || !response.ok) {
|
||||
this.failedArtworkKey = artworkKey
|
||||
|
||||
@@ -5,6 +5,7 @@ export type NativeWindowsMediaSupport = NativeCaptureSupport
|
||||
|
||||
export interface NativeWindowsSpotifyPlaybackState {
|
||||
album: string
|
||||
artworkDataUrl: string | null
|
||||
artist: string
|
||||
durationMs: number
|
||||
playbackStatus: string
|
||||
|
||||
Reference in New Issue
Block a user