music
This commit is contained in:
parent
5414d49b01
commit
1eb2ea4097
2
.gitignore
vendored
2
.gitignore
vendored
@ -37,6 +37,8 @@ home/user/.tmux/*
|
||||
!home/user/.tmux/ssh
|
||||
!home/user/.tmux/example-background-job
|
||||
!home/user/.tmux/system-update
|
||||
!home/user/.tmux/music
|
||||
!home/user/.tmux/landing
|
||||
|
||||
home/user/.config/git/local
|
||||
|
||||
|
||||
@ -4,16 +4,26 @@ set -eu
|
||||
channel="${1:-}"
|
||||
|
||||
if [ "${channel}" = lofi ]; then
|
||||
url='https://live.hunter.fm/lofi_low'
|
||||
elif [ "${channel}" = trance ]; then
|
||||
url='http://ubuntu.hbr1.com:19800/trance.ogg'
|
||||
elif [ "${channel}" = salsa ]; then
|
||||
url='https://latinasalsa.ice.infomaniak.ch/latinasalsa.mp3'
|
||||
elif [ "${channel}" = kfai ]; then
|
||||
url='https://kfai.broadcasttool.stream/kfai-1'
|
||||
url='https://radiorecord.hostingradio.ru/lofi96.aacp'
|
||||
elif [ "${channel}" = fallout ]; then
|
||||
url='http://fallout.fm:8000/falloutfm1.ogg'
|
||||
elif [ "${channel}" = wasteland ]; then
|
||||
url='http://wasteland.su:8080/radio'
|
||||
elif [ "${channel}" = retrofm ]; then
|
||||
url='http://hls-01-retro.emgsound.ru/12/128/playlist.m3u8'
|
||||
elif [ "${channel}" = rusradio ]; then
|
||||
url='https://rusradio.hostingradio.ru/rusradio128.mp3'
|
||||
elif [ "${channel}" = rock ]; then
|
||||
url='https://radiorecord.hostingradio.ru/rock96.aacp'
|
||||
elif [ "${channel}" = phonk ]; then
|
||||
url='https://radiorecord.hostingradio.ru/phonk96.aacp'
|
||||
elif [ "${channel}" = dorognoe ]; then
|
||||
url='https://dorognoe.hostingradio.ru:8000/dorognoe'
|
||||
else
|
||||
echo "don't know \"${channel}\": lofi/trance/salsa/kfai" 1>&2
|
||||
echo "don't know \"${channel}\": lofi/fallout/wasteland/retrofm/rusradio/rock/phonk/dorognoe" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec mpv --really-quiet "${url}"
|
||||
|
||||
# https://gist.github.com/ergoz/e7837a54956116167db93b016dbd51a9
|
||||
|
||||
@ -1,11 +1,116 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
playlist="${1:-}"
|
||||
shift || true
|
||||
ACTION="${1:-}"
|
||||
PROG="$(basename "${0}")"
|
||||
SOCKET_PATH="/tmp/mpv-${USER}.sock"
|
||||
|
||||
if [ -z "${playlist}" ]; then
|
||||
playlist="${HOME}/Music"
|
||||
fi
|
||||
send_cmd() {
|
||||
echo "{ \"command\": ${1} }" | socat - "${SOCKET_PATH}"
|
||||
}
|
||||
|
||||
exec mpv --shuffle --no-video --ytdl-format=worstaudio "${@}" -- "${playlist}"
|
||||
|
||||
play_playlist() {
|
||||
playlist="${1:-}"
|
||||
|
||||
if [ -z "${playlist}" ]; then
|
||||
playlist="${HOME}/Music"
|
||||
fi
|
||||
|
||||
exec mpv --input-ipc-server="${SOCKET_PATH}" --shuffle --no-video --ytdl-format=worstaudio "${@}" -- "${playlist}"
|
||||
}
|
||||
|
||||
tune_radio() {
|
||||
channel="${1:-}"
|
||||
|
||||
if [ "${channel}" = lofi ]; then
|
||||
url='https://radiorecord.hostingradio.ru/lofi96.aacp'
|
||||
elif [ "${channel}" = fallout ]; then
|
||||
url='http://fallout.fm:8000/falloutfm1.ogg'
|
||||
elif [ "${channel}" = wasteland ]; then
|
||||
url='http://wasteland.su:8080/radio'
|
||||
elif [ "${channel}" = retrofm ]; then
|
||||
url='http://hls-01-retro.emgsound.ru/12/128/playlist.m3u8'
|
||||
elif [ "${channel}" = rusradio ]; then
|
||||
url='https://rusradio.hostingradio.ru/rusradio128.mp3'
|
||||
elif [ "${channel}" = rock ]; then
|
||||
url='https://radiorecord.hostingradio.ru/rock96.aacp'
|
||||
elif [ "${channel}" = phonk ]; then
|
||||
url='https://radiorecord.hostingradio.ru/phonk96.aacp'
|
||||
elif [ "${channel}" = dorognoe ]; then
|
||||
url='https://dorognoe.hostingradio.ru:8000/dorognoe'
|
||||
else
|
||||
echo "${PROG} radio: don't know \"${channel}\": lofi/fallout/wasteland/retrofm/rusradio/rock/phonk/dorognoe" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
send_cmd "[\"loadfile\", \"${url}\", \"replace\"]"
|
||||
}
|
||||
|
||||
play_radio() {
|
||||
channel="${1:-}"
|
||||
|
||||
if [ "${channel}" = lofi ]; then
|
||||
url='https://radiorecord.hostingradio.ru/lofi96.aacp'
|
||||
elif [ "${channel}" = fallout ]; then
|
||||
url='http://fallout.fm:8000/falloutfm1.ogg'
|
||||
elif [ "${channel}" = wasteland ]; then
|
||||
url='http://wasteland.su:8080/radio'
|
||||
elif [ "${channel}" = retrofm ]; then
|
||||
url='http://hls-01-retro.emgsound.ru/12/128/playlist.m3u8'
|
||||
elif [ "${channel}" = rusradio ]; then
|
||||
url='https://rusradio.hostingradio.ru/rusradio128.mp3'
|
||||
elif [ "${channel}" = rock ]; then
|
||||
url='https://radiorecord.hostingradio.ru/rock96.aacp'
|
||||
elif [ "${channel}" = phonk ]; then
|
||||
url='https://radiorecord.hostingradio.ru/phonk96.aacp'
|
||||
elif [ "${channel}" = dorognoe ]; then
|
||||
url='https://dorognoe.hostingradio.ru:8000/dorognoe'
|
||||
else
|
||||
echo "${PROG} radio: don't know \"${channel}\": lofi/fallout/wasteland/retrofm/rusradio/rock/phonk/dorognoe" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec mpv --really-quiet "${url}"
|
||||
}
|
||||
|
||||
cmd_run() {
|
||||
case "${1:-}" in
|
||||
music) shift;
|
||||
play_playlist "${@}"
|
||||
;;
|
||||
radio) shift;
|
||||
play_radio "${@}"
|
||||
;;
|
||||
help|"")
|
||||
echo "Usage: ${PROG} run {music PLAYLIST|radio CHANNEL}"
|
||||
echo "Example: ${PROG} run music"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
case "${ACTION}" in
|
||||
next|n) shift;
|
||||
send_cmd '["playlist-next"]'
|
||||
echo "➡️ Next"
|
||||
;;
|
||||
prev|p) shift;
|
||||
send_cmd '["playlist-prev"]'
|
||||
echo "⬅️ Prev"
|
||||
;;
|
||||
pause|space) shift;
|
||||
send_cmd '["cycle", "pause"]'
|
||||
echo "⏯️ Pause"
|
||||
;;
|
||||
run) shift;
|
||||
cmd_run "${@}"
|
||||
;;
|
||||
radio) shift;
|
||||
tune_radio "${@}"
|
||||
;;
|
||||
help|"")
|
||||
echo "Usage: ${PROG} {next|prev|pause|run|radio CHANNEL}"
|
||||
echo "Example: ${PROG} next"
|
||||
;;
|
||||
esac
|
||||
|
||||
15
home/user/.tmux/landing
Executable file
15
home/user/.tmux/landing
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eux
|
||||
|
||||
readonly SESSION=landing
|
||||
readonly MAINW=landing
|
||||
|
||||
readonly WORKING_PROJECT="${HOME}"
|
||||
|
||||
if ! tmux has-session -t="${SESSION}"; then
|
||||
tmux new-session -s "${SESSION}" -d -n "1" -c "${WORKING_PROJECT}" 'sh -c "tmux set-option remain-on-exit on; figlet -ct -f big Landing; trap : INT; while true; do sleep 3600; done"'
|
||||
tmux rename-window -t="${SESSION}:1" "${MAINW}"
|
||||
fi
|
||||
|
||||
tmux switch-client -t "${SESSION}"
|
||||
16
home/user/.tmux/music
Executable file
16
home/user/.tmux/music
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eux
|
||||
|
||||
readonly SESSION=music
|
||||
readonly MAINW=music
|
||||
|
||||
readonly WORKING_PROJECT="${HOME}"
|
||||
|
||||
if ! tmux has-session -t="${SESSION}"; then
|
||||
tmux new-session -s "${SESSION}" -d -n "${MAINW}" -c "${WORKING_PROJECT}"
|
||||
tmux rename-window -t "${SESSION}:1" "${MAINW}"
|
||||
tmux send-keys -t "${SESSION}:${MAINW}.1" "tunes run music" Enter
|
||||
fi
|
||||
|
||||
tmux switch-client -t "${SESSION}"
|
||||
Loading…
x
Reference in New Issue
Block a user