Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

21 lines
540 B

#!/bin/sh
format="-f34" # leave empty for default
player="mpv --quiet --geometry=50%:50% --idx --keep-open"
tmpdir="/tmp"
url="$1"
echo $url
echo $format
filepath="$tmpdir/$(youtube-dl --id --get-filename $format $url)"
youtube-dl -c -o $filepath $format $url &
echo $! > $filepath.$$.pid
while [ ! -r $filepath ] && [ ! -r $filepath.part ]; do
echo "Waiting for youtube-dl..."
sleep 3
done
[ -r $filepath.part ] && $player $filepath.part || $player $filepath
kill $(cat $filepath.$$.pid)
rm $filepath.$$.pid