diff options
author | lassulus <lassulus@lassul.us> | 2022-05-06 17:53:20 +0200 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2022-05-06 17:53:20 +0200 |
commit | 0d43d2e26d1fc263415ee7578b9d90e7bcd9da8d (patch) | |
tree | f2f7a3749bd1629f166a56a3c57dbb4e4965167f | |
parent | ff9b58681a9449ba0ba717c8d6396c1ab038143d (diff) |
-rw-r--r-- | download.nix | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/download.nix b/download.nix index fd122b2..faffebb 100644 --- a/download.nix +++ b/download.nix @@ -1,6 +1,7 @@ let pkgs = import <nixpkgs> {}; npkgs = import (builtins.fetchTarball "https://github.com/nixos/nixpkgs/archive/master.tar.gz") {}; + youtube-dl = "${npkgs.yt-dlp}/bin/yt-dlp"; # add_link # download new music from source @@ -25,7 +26,7 @@ let utils.extract_playlist = pkgs.writers.writeDash "utils.extract_playlist" '' set -euf - ${npkgs.youtube-dl}/bin/youtube-dl \ + ${youtube-dl} \ -i -o "http://www.youtube.com/watch?v=%(id)s#%(title)s" \ --restrict-filenames --get-filename $1 ''; @@ -126,10 +127,10 @@ let if ls "$target_folder" | ${pkgs.gnugrep}/bin/grep -Fe "$id.ogg"; then echo "file already exists: $1" else - duration=$(${npkgs.youtube-dl}/bin/youtube-dl -J "$1" | ${pkgs.jq}/bin/jq .duration) + duration=$(${youtube-dl} -J "$1" | ${pkgs.jq}/bin/jq .duration) if [ "$duration" -le 1000 ] && [ "$duration" -gt 60 ]; then cd "$TMPDIR" - ${npkgs.youtube-dl}/bin/youtube-dl \ + ${youtube-dl} \ -i -o "%(title)s-%(id)s.%(ext)s" \ --restrict-filenames --add-metadata \ --audio-format vorbis \ @@ -153,6 +154,5 @@ in pkgs.stdenv.mkDerivation { (pkgs.writers.writeDashBin "dl-track" '' ${utils.download_ogg} "$@" '') - npkgs.youtube-dl ]; } |