You are not logged in.
# Get song lyrics from your chosen source_dir (mp3 folder) lyrico will save lyric files in defined lyrics_dir
# DEPENDENCY : [lyrico](https://github.com/abhimanyuPathania/lyrico)) , [pv](https://github.com/icetee/pv)
# [osd_cat](http://www.linuxintro.org/wiki/Osd_cat) and [fzfo](https://github.com/junegunn/fzf)
#!/bin/sh
dir=(/home/cirrus/.lyrics)
get_selection() {
for p in $dir; do
ls "$p"
done \
| fzf --ansi --height 80% --color fg:-1,bg:-1,hl:4,fg+:3,bg+:233,hl+:4 --color info:150,prompt:3,spinner:150,pointer:3,marker:174,border:11 --border=sharp --prompt='➤ ' --exit-0
}
if selection=$( get_selection ); then
cat "${dir}/${selection}" | pv -qL 10 | osd_cat -A center -p middle -f '-*-pragmatapro-*-*-*-*-24-*-*-*-*-*-*-*' -cgreen -O 4 -u black
else
exit
fi
https://cirrus.freevar.com/flyrics.mp4 was cobbled together.
Last edited by cirrus (2022-09-29 14:08:56)
Ancestoral Clan https://cirrus.freevar.com/mclean.html
Offline
A few notes:
1. That'd look better with code tags.
2. Your shebang is wrong, I gather you meant /bin/bash as that is not a POSIX script - either that or get rid of the array
3. Related to #2, you later assume $dir is a simple variable rather than an array, so just leave it at that (if it had mutliple entries, your cat command would fail)
4. get_selection doesn't really justify it's own existence as it just necessitates a couple lines for the function braces and an extra subshell upon invocation
5. The for loop and ls should just be a find command (which is the default for fzf without a stdin pipe)
6. "else; exit; fi" is a noop and should not be there
#!/bin/sh
dir="$HOME/.lryics"
fzf_flags= #fill these in
osd_cat_flags= #...
cd dir
cat $(fzf $fzf_flags) | pv -qL 10 | osd_cat $osd_cat_flags
While I've never used pv, I'm pretty sure the last line could actually be better like this:
pv -qL 10 < $(fzf $fzf_flags) | osd_cat $osd_cat_flags
Last edited by Trilby (2022-09-28 23:42:02)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thank you Trilby for keeping me right yet again
regards kind sir.
rectified thanks to trilby
#!/bin/sh
dir="/home/cirrus/.lyrics"
font="-*-PragmataPro-*-*-*-*-24-*-*-*-*-*-*-*"
fzf_flags=" --ansi --height 80% --color fg:-1,bg:-1,hl:4,fg+:3,bg+:233,hl+:4 --color info:150,prompt:3,spinner:150,pointer:3,marker:174,border:11 --border=sharp --prompt="➤" --exit-0" #fill these in
osd_cat_flags=" -A center -p middle -f $font -cgreen -O 4 -u black -cgreen -O 4 -u black"
cd $dir
pv -qL 10 < $(fzf $fzf_flags) | osd_cat $osd_cat_flags
Last edited by cirrus (2022-09-29 01:53:55)
Ancestoral Clan https://cirrus.freevar.com/mclean.html
Offline