parent
9c5c1848c7
commit
ad39adc15b
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
format="" # leave empty for default
|
||||||
|
player="mpv --quiet --geometry=50%:50% --keep-open --index default"
|
||||||
|
tmpdir="$HOME/tmp"
|
||||||
|
|
||||||
|
url="$1"
|
||||||
|
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
|
Loading…
Reference in new issue