From 5414d49b01078b07191dc1137981809ccde75e29 Mon Sep 17 00:00:00 2001 From: thek4n Date: Thu, 19 Feb 2026 22:10:42 +0300 Subject: [PATCH] refactor --- home/user/.local/bin/radio | 12 +++++++----- home/user/.local/bin/tunes | 9 ++++++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/home/user/.local/bin/radio b/home/user/.local/bin/radio index c47830f..9fc6e3f 100755 --- a/home/user/.local/bin/radio +++ b/home/user/.local/bin/radio @@ -1,16 +1,18 @@ #!/bin/sh set -eu -if [ "${1}" = lofi ]; then +channel="${1:-}" + +if [ "${channel}" = lofi ]; then url='https://live.hunter.fm/lofi_low' -elif [ "${1}" = trance ]; then +elif [ "${channel}" = trance ]; then url='http://ubuntu.hbr1.com:19800/trance.ogg' -elif [ "${1}" = salsa ]; then +elif [ "${channel}" = salsa ]; then url='https://latinasalsa.ice.infomaniak.ch/latinasalsa.mp3' -elif [ "${1}" = kfai ]; then +elif [ "${channel}" = kfai ]; then url='https://kfai.broadcasttool.stream/kfai-1' else - echo "don't know ${1}" 1>&2 + echo "don't know \"${channel}\": lofi/trance/salsa/kfai" 1>&2 exit 1 fi diff --git a/home/user/.local/bin/tunes b/home/user/.local/bin/tunes index ae7cfa0..d4455f1 100755 --- a/home/user/.local/bin/tunes +++ b/home/user/.local/bin/tunes @@ -1,4 +1,11 @@ #!/bin/sh set -eu -exec mpv --no-video --ytdl-format=worstaudio "${@}" +playlist="${1:-}" +shift || true + +if [ -z "${playlist}" ]; then + playlist="${HOME}/Music" +fi + +exec mpv --shuffle --no-video --ytdl-format=worstaudio "${@}" -- "${playlist}"