diff options
author | Profpatsch <mail@profpatsch.de> | 2024-09-13T13·29+0200 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2024-09-13T13·44+0000 |
commit | e5edb3b192760fa732670a2db47596a0d4fdd4d5 (patch) | |
tree | f0ad0528b6406199d5bdb30ee5ab63cd2759b4df | |
parent | e826ffb19ca50b0de25cf3ec4003309758828156 (diff) |
feat(users/Profpatsch/lyrics): fall back to plain lyrics r/8688
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>
-rw-r--r-- | users/Profpatsch/lyric.nix | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/users/Profpatsch/lyric.nix b/users/Profpatsch/lyric.nix index 962a62721a6c..b3914d195e1f 100644 --- a/users/Profpatsch/lyric.nix +++ b/users/Profpatsch/lyric.nix @@ -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 + '' ] |