From 58cffc4be150d83c95c55e2bd8d0bd8799766b27 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 20 Apr 2020 13:02:12 +0200 Subject: filter to long tracks, use up2date nixpkgs --- download.nix | 17 ++++++++++------- 1 file 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 {}; - 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 ]; } -- cgit v1.2.3