diff --git a/ui/src/album/AlbumDetails.js b/ui/src/album/AlbumDetails.js index 00671062..a1e07bc8 100644 --- a/ui/src/album/AlbumDetails.js +++ b/ui/src/album/AlbumDetails.js @@ -133,16 +133,8 @@ const AlbumDetails = ({ record }) => { return genreDateLine.join(' ยท ') } - const imageUrl = subsonic.url( - 'getCoverArt', - record.coverArtId || 'not_found', - { size: 300 } - ) - - const fullImageUrl = subsonic.url( - 'getCoverArt', - record.coverArtId || 'not_found' - ) + const imageUrl = subsonic.getCoverArtUrl(record, 300) + const fullImageUrl = subsonic.getCoverArtUrl(record) const handleOpenLightbox = React.useCallback(() => setLightboxOpen(true), []) const handleCloseLightbox = React.useCallback( diff --git a/ui/src/album/AlbumGridView.js b/ui/src/album/AlbumGridView.js index e9286a31..d26abf47 100644 --- a/ui/src/album/AlbumGridView.js +++ b/ui/src/album/AlbumGridView.js @@ -98,9 +98,7 @@ const Cover = withContentRect('bounds')( return (
{album.album} diff --git a/ui/src/reducers/playQueue.js b/ui/src/reducers/playQueue.js index 87cbb280..5fe2da3d 100644 --- a/ui/src/reducers/playQueue.js +++ b/ui/src/reducers/playQueue.js @@ -28,10 +28,12 @@ const mapToAudioLists = (item) => { artistId: item.albumArtistId, duration: item.duration, musicSrc: subsonic.url('stream', id, { ts: true }), - cover: subsonic.url( - 'getCoverArt', - config.devFastAccessCoverArt ? item.albumId : id, - { size: 300 } + cover: subsonic.getCoverArtUrl( + { + coverArtId: config.devFastAccessCoverArt ? item.albumId : id, + updatedAt: item.updatedAt, + }, + 300 ), scrobbled: false, uuid: uuidv4(), diff --git a/ui/src/subsonic/index.js b/ui/src/subsonic/index.js index 07b061ce..b9368da6 100644 --- a/ui/src/subsonic/index.js +++ b/ui/src/subsonic/index.js @@ -32,4 +32,19 @@ const unstar = (id) => fetchUtils.fetchJson(url('unstar', id)) const download = (id) => (window.location.href = url('download', id)) -export default { url, scrobble, download, star, unstar } +const getCoverArtUrl = (record, size) => { + const options = { + ...(record.updatedAt && { _: record.updatedAt }), + ...(size && { size }), + } + return url('getCoverArt', record.coverArtId || 'not_found', options) +} + +export default { + url, + getCoverArtUrl: getCoverArtUrl, + scrobble, + download, + star, + unstar, +}