#!/bin/env fish

set DIR (dirname (status -f))

if ! type -q curl
  echo "curl is required to run this script"
  exit
end

if ! type -q ffmpeg
  echo "ffmpeg is required to run this script"
  exit
end

if ! test -d "$DIR/venv"
  /bin/env python3 -m venv "$DIR/venv"
  . "$DIR/venv/bin/activate.fish"
  /bin/env python3 -m pip install -r "$DIR/requirements.txt"
  echo
else
  . "$DIR/venv/bin/activate.fish"
end

/bin/env python3 "$DIR/dl.py" $argv