From 9676f51765058d78e8509e6405e366e72427431d Mon Sep 17 00:00:00 2001 From: Ludwig Lehnert Date: Sun, 16 Feb 2025 08:27:37 +0100 Subject: [PATCH] better start script --- download | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/download b/download index d743784..de67c85 100755 --- a/download +++ b/download @@ -1,13 +1,6 @@ #!/bin/env fish -if ! test -d venv - /bin/env python3 -m venv venv - . venv/bin/activate.fish - /bin/env python3 -m pip install -r requirements.txt - echo -else - . venv/bin/activate.fish -end +set DIR (cd (dirname (status -f)); and pwd) if ! type -q curl echo "curl is required to run this script" @@ -24,6 +17,14 @@ if ! type -q ffmpeg exit end -if ! /bin/env python3 download.py $argv - echo "download failed" + +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/download.py" $argv