#! /bin/zsh # # this file: # https://dataswamp.org/~incal/conf/.zsh/mpv # # all mpv: # https://dataswamp.org/~incal/conf/mpv alias mpv-debian=~/repos/mpv-0.35.1/build/mpv play-all () { pl <01->.(mkv|mp4) } play-two-random () { local vids=("${(@f)$(ls *.(flv|mp4|mkv|webm))}") local num_vids=${#vids} local v1i local v2i until [[ $v1i != $v2i ]]; do v1i=$(( $RANDOM % $num_vids + 1 )) v2i=$(( $RANDOM % $num_vids + 1 )) done local v1=$vids[$v1i] local v2=$vids[$v2i] play-two-width $v1 $v2 echo $v1 echo $v2 } play-two-width () { local one=$1 local two=$2 local v2w=$(video-width $two) mpv \ $one \ --external-file=$two \ --loop \ --no-resume-playback \ --lavfi-complex="[vid1] scale=${v2w}:-1 [vid1s]; [vid1s] [vid2] vstack [vo]" } alias play-two=play-two-width alias play-two-w=play-two-width play-two-height () { local one=$1 local two=$2 local v2w=$(video-width $two) mpv \ $one \ --external-file=$two \ --loop \ --no-resume-playback \ --lavfi-complex="[vid1] scale=${v2w}:-1 [vid1s]; [vid1s] [vid2] hstack [vo]" } alias play-two-h=play-two-height play-slow-and-silent () { local fs=($@) local opts=( --ao=null --no-resume-playback --shuffle --speed=0.78 ) [[ $fs ]] && mpv $opts $fs || mpv $opts **/*.(flv|mkv|mp4|webm) } alias pls=play-slow-and-silent play-sound () { mpv --vo=null $@ } play-video-or-audio () { mpv $fs # [[ $DISPLAY ]] && mpv $fs || play-sound $fs } play-biggest () { fsa=($@) fs=(${(f)"$(ls -S ${fsa})"}) play-video-or-audio $fs } pl () { local fs=($@) clear # local file local play_script=play [[ $# == 0 && -f $play_script ]] && $play_script play-video-or-audio $fs } psx () { mpv --script-opts=ytdl_hook-exclude=.pls $@ }