summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--download.nix8
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
];
}