fix(lyrics): fallback to lyrics.ovh when LRCLIB fails
Network errors in LRCLIB were propagated as hard Err via ? operator, preventing the lyrics.ovh fallback from ever being reached. Changed provider functions to return Option instead of Result so errors are treated as soft failures. Added 10s HTTP timeout. Fixed internal LRCLIB fallback (GET failure now falls through to search). Replaced hardcoded UI strings with i18n keys.
This commit is contained in:
1 parent
344579c849
commit
d1fd6e045f
5 files changed
+74
-33
No files matched your search
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { tick } from 'svelte';
|
||||
import { t } from 'svelte-i18n';
|
||||
|
||||
interface LyricsLine {
|
||||
text: string;
|
||||
@@ -140,7 +141,7 @@
|
||||
bind:this={container}
|
||||
>
|
||||
{#if lines.length === 0}
|
||||
<div class="lyrics-empty">No lyrics available</div>
|
||||
<div class="lyrics-empty">{$t('player.noLyrics')}</div>
|
||||
{:else}
|
||||
<!-- Spacer at top to allow first lines to scroll to center (only for synced) -->
|
||||
{#if isSynced}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { Mic2 } from 'lucide-svelte';
|
||||
import { t } from 'svelte-i18n';
|
||||
import LyricsLines from './LyricsLines.svelte';
|
||||
|
||||
interface LyricsLine {
|
||||
@@ -35,7 +36,7 @@
|
||||
<Mic2 size={18} />
|
||||
</div>
|
||||
<div class="header-text">
|
||||
<div class="header-title">Lyrics</div>
|
||||
<div class="header-title">{$t('player.lyrics')}</div>
|
||||
{#if title || artist}
|
||||
<div class="header-meta">{title}{title && artist ? ' - ' : ''}{artist}</div>
|
||||
{/if}
|
||||
@@ -46,7 +47,7 @@
|
||||
{#if isLoading}
|
||||
<div class="state">
|
||||
<div class="loading-spinner"></div>
|
||||
<span>Loading lyrics...</span>
|
||||
<span>{$t('player.fetchingLyrics')}</span>
|
||||
</div>
|
||||
{:else if error}
|
||||
<div class="state error">{error}</div>
|
||||
|
||||
@@ -3377,7 +3377,7 @@
|
||||
activeProgress={lyricsActiveProgress}
|
||||
isSynced={lyricsIsSynced}
|
||||
isLoading={lyricsStatus === 'loading'}
|
||||
error={lyricsStatus === 'error' ? lyricsError : (lyricsStatus === 'not_found' ? 'No lyrics found' : null)}
|
||||
error={lyricsStatus === 'error' ? lyricsError : (lyricsStatus === 'not_found' ? $t('player.noLyrics') : null)}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -3518,7 +3518,7 @@
|
||||
lyricsActiveProgress={lyricsActiveProgress}
|
||||
lyricsSynced={lyricsIsSynced}
|
||||
lyricsLoading={lyricsStatus === 'loading'}
|
||||
lyricsError={lyricsStatus === 'error' ? lyricsError : (lyricsStatus === 'not_found' ? 'No lyrics found' : null)}
|
||||
lyricsError={lyricsStatus === 'error' ? lyricsError : (lyricsStatus === 'not_found' ? $t('player.noLyrics') : null)}
|
||||
enableCredits={true}
|
||||
enableSuggestions={true}
|
||||
queueTracks={[
|
||||
|
||||
Reference in new issue
Block a user