1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-05-20 10:53:23 -07:00

rewrite mpv wrappers, squashing bugs

This commit is contained in:
Connor Olding 2018-08-06 03:54:50 +02:00
parent 7bb2f0f980
commit 32754d6923

View File

@ -53,46 +53,46 @@ if [[ "$_nn" == "banshee" ]]; then
speakers
fi
_mpv_flags() {
REPLY="$MPV_STREAM_FLAGS --af=lavfi=[$_M_PROCESS]"
mpv_watch() {
pushd ~/play >/dev/null
local url="$1"; shift
#--audio-samplerate=44100 --audio-format=s16 \
mpv --af=lavfi="[$_M_PROCESS]" --ytdl-format '[width<=1280],best' \
"$@" "$url"
popd >/dev/null
}
watchstream() {
mpv_stream() {
pushd ~/play >/dev/null
local url="$1"
shift
_mpv_flags
local url="$1"; shift
if [ -n "$ZSH_VERSION" ]; then
# zsh syntax
mpv $=REPLY "$@" "$url"
mpv $=MPV_STREAM_FLAGS --af=lavfi="[$_M_PROCESS]" "$@" "$url"
else
# bash syntax
mpv $REPLY "$@" "$url"
mpv $MPV_STREAM_FLAGS --af=lavfi="[$_M_PROCESS]" "$@" "$url"
fi
popd >/dev/null
}
twitch() {
local user="$1"
shift
watchstream "http://twitch.tv/$user" "$@"
local user="$1"; shift
mpv_stream "http://twitch.tv/$user" "$@"
}
yt() {
pushd ~/play >/dev/null
local vid="$1"
shift
local vid="$1"; shift
if [[ ! -e "$vid" && "$(expr substr "$vid" 1 4)" != "http" ]]; then
vid="ytdl://$vid"
fi
mpv --af=lavfi="[$_M_PROCESS]" \
--audio-samplerate=44100 --audio-format=s16 \
--ytdl-format '[width<=1280],best' "$vid" "$@"
popd >/dev/null
mpv_watch "$vid" "$@"
}
ytg() {
yt "$@" --ytdl-format=95,best
local vid="$1"; shift
if [[ ! -e "$vid" && "$(expr substr "$vid" 1 4)" != "http" ]]; then
vid="ytdl://$vid"
fi
mpv_stream "$vid" --ytdl-format=95,best "$@"
}
ai() {