bin: music automations

This commit is contained in:
xeruf 2023-08-07 19:53:37 +02:00
parent 4091540c6a
commit 620c68f35f
3 changed files with 7 additions and 4 deletions

View File

@ -3,6 +3,6 @@
# depends: fzy/fzf-tmux mpc # depends: fzy/fzf-tmux mpc
song_position=$(mpc -f "%position%) %artist% - %title%" playlist | song_position=$(mpc -f "%position%) %artist% - %title%" playlist |
#fzy --query="$1" | #fzy --query="$1" |
fzf-tmux --query="$1" --reverse --select-1 --exit-0 | fzf-tmux --query="$1" --reverse --exit-0 |
sed -n 's/^\([0-9]\+\)).*/\1/p') sed -n 's/^\([0-9]\+\)).*/\1/p')
test -n "$song_position" && mpc play $song_position test -n "$song_position" && mpc play $song_position

View File

@ -4,15 +4,16 @@
# env: MUSIC # env: MUSIC
# args: either a playlist file name, or a list of terms which all have to match # args: either a playlist file name, or a list of terms which all have to match
# TODO fails on "Alchemy" # TODO fails on "Alchemy"
# TODO implement tags # TODO implement finding by tags
PLAYLISTS="${PLAYLISTS:-$MUSIC/Playlists}" PLAYLISTS="${PLAYLISTS:-$MUSIC/Playlists}"
mpc -q clear mpc -q clear
if test -z "$1" if test -z "$1"
then mp -q "$PLAYLISTS/focus.m3u" then mp -q "$PLAYLISTS/focus.m3u"
else else
set -o noglob
(find -L $PLAYLISTS -iname "focus-$1.m3u" -print0 | grep --null-data . || (find -L $PLAYLISTS -iname "focus-$1.m3u" -print0 | grep --null-data . ||
find -L $PLAYLISTS -iname "$1.m3u*" -print0 | grep --null-data . || find -L $PLAYLISTS -iname "$1.m3u*" -print0 | grep --null-data . ||
find -L $MUSIC $(echo "$@" | sed 's/\w\+/-iname *\0* /g') -prune -exec find {} -size +1M -type f -not -iregex ".*.\(jpe?g\|png\)" -print0 \; ) | find -L $MUSIC $(echo "$@" | sed "s/\w\+/-iname *\0* /g") -prune -exec find {} -size +1M -type f -not -iregex ".*.\(jpe?g\|png\)" -print0 \; ) |
xargs -0 mp -q xargs -0 mp -q
fi fi
if test $(mpc playlist | wc -l) -gt 1; then if test $(mpc playlist | wc -l) -gt 1; then

View File

@ -1,2 +1,4 @@
#!/bin/sh #!/bin/sh
opusenc "$@" "${1%.*}.opus" # Convert given file to opus, requires opus-tools or ffmpeg
opusenc "$@" "${1%.*}.opus" ||
ffmpeg -i "$@" "${1%.*}.opus"