diff options
author | lassulus <lassulus@lassul.us> | 2020-04-20 13:02:12 +0200 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2020-04-20 13:02:12 +0200 |
commit | 58cffc4be150d83c95c55e2bd8d0bd8799766b27 (patch) | |
tree | 0f73bf1fd763243aa39af0281c1469009f725a49 | |
parent | 494154221b43faa6e7eaf170354ab976991c38eb (diff) |
filter to long tracks, use up2date nixpkgs
-rw-r--r-- | download.nix | 17 |
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 ]; } |