1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

genius: remove

This commit is contained in:
2025-12-13 22:52:43 +01:00
parent f58e111ce1
commit bae1d0b0cc
2 changed files with 0 additions and 29 deletions

View File

@@ -1,28 +0,0 @@
{
writers,
curl,
coreutils,
gnused,
pandoc,
}:
writers.writeDashBin "genius" ''
${coreutils}/bin/test "$#" -eq 2 || (
echo "usage: $0 <artist> <song>"
exit 1
)
normalize() {
${coreutils}/bin/tr -d -c '0-9A-Za-z ' | ${coreutils}/bin/tr ' ' - | ${coreutils}/bin/tr '[:upper:]' '[:lower:]'
}
ARTIST=$(echo "$1" | normalize | ${gnused}/bin/sed 's/./\U&/')
TITLE=$(echo "$2" | normalize)
GENIUS_URL="https://genius.com/$ARTIST-$TITLE-lyrics"
${curl}/bin/curl -s "$GENIUS_URL" \
| ${gnused}/bin/sed -ne '/class="lyrics"/,/<\/p>/p' \
| ${pandoc}/bin/pandoc -f html -s -t plain \
| ${gnused}/bin/sed 's/^_/\x1b[3m/g;s/_$/\x1b[0m/g;s/^\[/\n\x1b\[1m\[/g;s/\]$/\]\x1b[0m/g'
printf "\n%s\n" "$GENIUS_URL" >/dev/stderr
''