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

83 lines
2.0 KiB
Plaintext
Raw Normal View History

2015-12-11 01:06:01 -08:00
#!/bin/zsh
# awful things
2016-01-29 10:45:52 -08:00
MPV_STREAM_FLAGS="--quiet --no-sub --loop=force --cache-secs=10 --cache-initial=1024 --cache-pause --cache-backbuffer=0 --cache-seek-min=2048"
2016-01-01 18:40:37 -08:00
LIVESTREAMER_FLAGS="--player-http --player-continuous-http --default-stream=source,best"
2015-12-11 01:16:38 -08:00
LIVESTREAMER_FLAGS+=" --player-passthrough=http --player-no-close"
2015-12-11 01:06:01 -08:00
_M_STEREO='aformat=channel_layouts=stereo'
_M_PRE_EMPH='equalizer=f=50.0:g=-10:width_type=o:w=4,equalizer=f=5000:g=+05:width_type=o:w=4'
_M_POST_EMPH='equalizer=f=50.0:g=+10:width_type=o:w=4,equalizer=f=5000:g=-05:width_type=o:w=4'
_M_COMPRESS='compand=0.001|0.001:0.25|0.25:-42/-42|0/-21:6:18:-30:0.001'
_M_LIMIT='compand=0.000|0.000:0.10|0.10:-9/-9|0/-6.:3:4.5:-9'
_M_KILL="$_M_STEREO,$_M_PRE_EMPH,$_M_COMPRESS,$_M_POST_EMPH"
getladspa() {
2016-02-24 14:10:31 -08:00
REPLY="volume"
2015-12-11 01:06:01 -08:00
if [ -e "/usr/lib/ladspa/${1}.so" ]; then
2015-12-11 06:30:03 -08:00
REPLY="ladspa=f=${1}:p=${1}"
2015-12-11 01:06:01 -08:00
fi
}
getladspa crap_eq_const_T420
_M_SPEAKERS="$REPLY"
2015-12-18 18:59:30 -08:00
getladspa crap_level
2015-12-11 01:06:01 -08:00
_M_LEVEL="$REPLY"
2016-01-01 18:40:37 -08:00
_nn="$(uname -n | tr A-Z a-z)"
2016-02-06 12:17:18 -08:00
2016-01-01 18:40:37 -08:00
if [[ "$_nn" == "spectre" ]]; then
2016-02-06 12:17:18 -08:00
_M_PROCESS="$_M_KILL,alimiter=level_out=0.7071"
2015-12-11 01:06:01 -08:00
fi
2016-01-01 18:40:37 -08:00
if [[ "$_nn" == "banshee" ]]; then
2016-02-06 12:17:18 -08:00
_M_PROCESS="$_M_LEVEL,$_M_SPEAKERS,alimiter=level_in=0.5"
2015-12-11 01:06:01 -08:00
fi
2016-02-06 12:17:18 -08:00
_mpv_flags() {
REPLY="$MPV_STREAM_FLAGS --af=lavfi=[$_M_PROCESS]"
}
watchstream1() {
2015-12-11 01:06:01 -08:00
local url="$1"
shift
2016-02-06 12:17:18 -08:00
_mpv_flags
2015-12-11 01:16:38 -08:00
if [ -n "$ZSH_VERSION" ]; then
# zsh syntax
2016-02-06 12:17:18 -08:00
mpv $=REPLY "$url"
2015-12-11 01:16:38 -08:00
else
# bash syntax
2016-02-06 12:17:18 -08:00
mpv $=REPLY "$url"
2015-12-11 01:16:38 -08:00
fi
2015-12-11 01:06:01 -08:00
}
2016-01-29 10:30:21 -08:00
watchstream2() {
local url="$1"
shift
2016-02-06 12:17:18 -08:00
_mpv_flags
2016-01-29 10:30:21 -08:00
if [ -n "$ZSH_VERSION" ]; then
# zsh syntax
livestreamer "$url" "$@" -p mpv $=LIVESTREAMER_FLAGS -a \
2016-02-06 12:17:18 -08:00
"$REPLY {filename}"
2016-01-29 10:30:21 -08:00
else
# bash syntax
livestreamer "$url" "$@" -p mpv $LIVESTREAMER_FLAGS -a \
2016-02-06 12:17:18 -08:00
"$REPLY {filename}"
2016-01-29 10:30:21 -08:00
fi
}
alias watchstream=watchstream1
2016-02-06 12:17:18 -08:00
2015-12-11 01:06:01 -08:00
twitch() {
local user="$1"
shift
watchstream "http://twitch.tv/$user" "$@"
2015-12-11 01:06:01 -08:00
}
hitbox() {
local user="$1"
shift
watchstream "http://hitbox.tv/$user" "$@"
2015-12-11 01:06:01 -08:00
}
2016-02-06 12:17:18 -08:00
_nn=