feat(users/Profpatsch/lyrics): fall back to plain lyrics

if there are not synced lyrics.

Change-Id: I3e8d452fc63847505886ea0bb01d29dd5dcb56d1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12477
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
This commit is contained in:
Profpatsch 2024-09-13 15:29:31 +02:00
parent e826ffb19c
commit e5edb3b192

View file

@ -23,9 +23,8 @@ depot.nix.writeExecline "lyric" { readNArgs = 1; } [
''
select
synced_lyrics,
source,
t.name,
t.artist_name
has_synced_lyrics,
plain_lyrics
from
tracks_fts(:searchstring) tf
join tracks t on t.rowid = tf.rowid
@ -41,5 +40,15 @@ depot.nix.writeExecline "lyric" { readNArgs = 1; } [
]
bins.jq
"-r"
".[0].synced_lyrics"
''
if .[0] == null
then ""
else
.[0]
| if .has_synced_lyrics == 1
then .synced_lyrics
else .plain_lyrics
end
end
''
]