feat(users/Profpatsch): add lyric
Change-Id: I3171d19f1cd550ef22a3a7e851f9d27d3bf34949 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12476 Reviewed-by: Profpatsch <mail@profpatsch.de> Tested-by: BuildkiteCI
This commit is contained in:
parent
5c57529675
commit
e826ffb19c
2 changed files with 49 additions and 1 deletions
45
users/Profpatsch/lyric.nix
Normal file
45
users/Profpatsch/lyric.nix
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
# Display lyrics for the given search string;
|
||||||
|
# search string can contain a substring of band name, album name, song title
|
||||||
|
#
|
||||||
|
# Use the database dump from https://lrclib.net/db-dumps and place it in ~/.cache/lyric/lrclib-db-dump.sqlite3
|
||||||
|
|
||||||
|
{ depot, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
bins = depot.nix.getBins pkgs.sqlite-utils [ "sqlite-utils" ]
|
||||||
|
// depot.nix.getBins pkgs.jq [ "jq" ];
|
||||||
|
|
||||||
|
in
|
||||||
|
depot.nix.writeExecline "lyric" { readNArgs = 1; } [
|
||||||
|
"backtick"
|
||||||
|
"-E"
|
||||||
|
"cache"
|
||||||
|
[ depot.users.Profpatsch.xdg-cache-home ]
|
||||||
|
"pipeline"
|
||||||
|
[
|
||||||
|
bins.sqlite-utils
|
||||||
|
"query"
|
||||||
|
"\${cache}/lyric/lrclib-db-dump.sqlite3"
|
||||||
|
''
|
||||||
|
select
|
||||||
|
synced_lyrics,
|
||||||
|
source,
|
||||||
|
t.name,
|
||||||
|
t.artist_name
|
||||||
|
from
|
||||||
|
tracks_fts(:searchstring) tf
|
||||||
|
join tracks t on t.rowid = tf.rowid
|
||||||
|
join lyrics l on t.rowid = l.track_id
|
||||||
|
order by
|
||||||
|
t.id
|
||||||
|
limit
|
||||||
|
1
|
||||||
|
''
|
||||||
|
"--param"
|
||||||
|
"searchstring"
|
||||||
|
"$1"
|
||||||
|
]
|
||||||
|
bins.jq
|
||||||
|
"-r"
|
||||||
|
".[0].synced_lyrics"
|
||||||
|
]
|
|
@ -158,7 +158,10 @@ let
|
||||||
name = "scripts/lw";
|
name = "scripts/lw";
|
||||||
path = depot.users.Profpatsch.lorri-wait-for-eval;
|
path = depot.users.Profpatsch.lorri-wait-for-eval;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
name = "scripts/lyric";
|
||||||
|
path = depot.users.Profpatsch.lyric;
|
||||||
|
}
|
||||||
]
|
]
|
||||||
++
|
++
|
||||||
(lib.pipe depot.users.Profpatsch.aliases [
|
(lib.pipe depot.users.Profpatsch.aliases [
|
||||||
|
|
Loading…
Reference in a new issue