summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--download.nix17
1 files changed, 10 insertions, 7 deletions
diff --git a/download.nix b/download.nix
index 171b1b8..30202b1 100644
--- a/download.nix
+++ b/download.nix
@@ -1,6 +1,6 @@
let
pkgs = import <nixpkgs> {};
- npkgs = import (builtins.fetchTarball "https://github.com/nixos/nixpkgs-channels/archive/nixos-19.09.tar.gz") {};
+ npkgs = import (builtins.fetchTarball "https://github.com/nixos/nixpkgs-channels/archive/nixos-unstable.tar.gz") {};
# add_link
# download new music from source
@@ -121,14 +121,16 @@ let
if ls "$target_folder" | ${pkgs.gnugrep}/bin/grep -Fe "$id.ogg"; then
echo "file already exists: $1"
else
- ${npkgs.youtube-dl}/bin/youtube-dl \
- -i -o "%(title)s-%(id)s.%(ext)s" \
- --restrict-filenames --add-metadata \
- --audio-format vorbis \
- -x "$1"
+ duration=$(${npkgs.youtube-dl}/bin/youtube-dl -J "$1" | ${pkgs.jq}/bin/jq .duration)
+ if [ "$duration" -le 1000 ]; then
+ ${npkgs.youtube-dl}/bin/youtube-dl \
+ -i -o "%(title)s-%(id)s.%(ext)s" \
+ --restrict-filenames --add-metadata \
+ --audio-format vorbis \
+ -x "$1"
+ fi
fi
-
echo "$1" >> "$target_folder/.meta/finished"
fi
@@ -140,5 +142,6 @@ in pkgs.stdenv.mkDerivation {
commands.add_link
commands.pull
commands.add_new
+ npkgs.youtube-dl
];
}