[READ-ONLY] Mirror of https://github.com/probablykasper/ferrum. Music library app for Mac, Linux and Windows ferrum.kasper.space
electron linux macos music music-library music-player napi windows
0

Configure Feed

Select the types of activity you want to include in your feed.

Fix artwork refreshing when adding artwork

Kasper (Sep 26, 2024, 3:20 AM +0200) b4e99552 fae9c097

+15 -12
+15 -12
src/components/Cover.svelte
··· 4 4 import { join_paths } from '@/lib/window' 5 5 6 6 export let track: Track 7 + $: src = 8 + 'trackimg:?path=' + 9 + encodeURIComponent(join_paths(paths.tracksDir, track.file)) + 10 + '&cache_db_path=' + 11 + encodeURIComponent(paths.cacheDb) + 12 + '&date_modified=' + 13 + encodeURIComponent(track.dateModified) 7 14 8 - let success: boolean | null = null 15 + let failed_src: string | null = null 16 + let loaded = false 9 17 </script> 10 18 11 - {#if success === false} 19 + {#if src === failed_src && failed_src !== null} 12 20 <svg class="cover" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> 13 21 <path 14 22 d="M23 0l-15.996 3.585v13.04c-2.979-.589-6.004 1.671-6.004 4.154 0 2.137 1.671 3.221 3.485 3.221 2.155 0 4.512-1.528 4.515-4.638v-10.9l12-2.459v8.624c-2.975-.587-6 1.664-6 4.141 0 2.143 1.715 3.232 3.521 3.232 2.14 0 4.476-1.526 4.479-4.636v-17.364z" ··· 17 25 {:else} 18 26 <img 19 27 class="cover" 20 - class:invisible={success === null} 21 - src="trackimg:?path={encodeURIComponent( 22 - join_paths(paths.tracksDir, track.file), 23 - )}&cache_db_path={encodeURIComponent(paths.cacheDb)}&date_modified={encodeURIComponent( 24 - track.dateModified, 25 - )}" 28 + class:invisible={!loaded} 29 + {src} 26 30 alt="" 27 31 on:load={() => { 28 - success = true 32 + loaded = true 33 + failed_src = null 29 34 }} 30 35 on:error={() => { 31 - success = false 36 + failed_src = src 32 37 }} 33 38 /> 34 39 {/if} ··· 41 46 min-height: 18px 42 47 margin: 3px 0px 43 48 pointer-events: none 44 - .invisible 45 - opacity: 0 46 49 img 47 50 object-fit: contain 48 51 svg