fix coverart spotify hook on windows

This commit is contained in:
Boof2015
2026-04-19 19:19:37 -04:00
parent 812014f64b
commit ee26e5b5c9
3 changed files with 127 additions and 1 deletions
+24 -1
View File
@@ -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
+1
View File
@@ -5,6 +5,7 @@ export type NativeWindowsMediaSupport = NativeCaptureSupport
export interface NativeWindowsSpotifyPlaybackState {
album: string
artworkDataUrl: string | null
artist: string
durationMs: number
playbackStatus: string