Add support for stream aliases
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
b23edce0d1
commit
0f948bf04b
1 changed files with 9 additions and 0 deletions
|
@ -1,14 +1,23 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
declare -A streamalias
|
||||||
|
|
||||||
source ${HOME}/bin/script_framework.sh
|
source ${HOME}/bin/script_framework.sh
|
||||||
|
|
||||||
|
[ -f ${HOME}/.config/mpc-yt.cfg ] && source ${HOME}/.config/mpc-yt.cfg
|
||||||
|
|
||||||
ydl=$(which youtube-dl)
|
ydl=$(which youtube-dl)
|
||||||
yurl=${1:-}
|
yurl=${1:-}
|
||||||
|
|
||||||
[ -n "${ydl}" ] || fail "Missing youtube-dl command"
|
[ -n "${ydl}" ] || fail "Missing youtube-dl command"
|
||||||
[ -n "${yurl}" ] || fail "Missing YouTube URL"
|
[ -n "${yurl}" ] || fail "Missing YouTube URL"
|
||||||
|
|
||||||
|
[ -n "${streamalias[${yurl}]:-}" ] && {
|
||||||
|
info "Found alias \"${yurl}\", continuing with configured URL \"${streamalias[${yurl}]}\""
|
||||||
|
yurl=${streamalias[${yurl}]}
|
||||||
|
}
|
||||||
|
|
||||||
step "Fetching video information..."
|
step "Fetching video information..."
|
||||||
title=$(${ydl} -e ${yurl})
|
title=$(${ydl} -e ${yurl})
|
||||||
playlist=$(${ydl} -g ${yurl})
|
playlist=$(${ydl} -g ${yurl})
|
||||||
|
|
Loading…
Reference in a new issue