From 20441e467b21f94ee00302a70e5f89ec18a29525 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Fri, 21 Jul 2023 00:38:55 +0200 Subject: [PATCH] ytdl: Use HM module to configure --- home/config/yt-dlp/config | 21 --------------------- home/programs/yt-dlp.nix | 33 +++++++++++++++++++++++++-------- 2 files changed, 25 insertions(+), 29 deletions(-) delete mode 100644 home/config/yt-dlp/config diff --git a/home/config/yt-dlp/config b/home/config/yt-dlp/config deleted file mode 100644 index ebb04fe..0000000 --- a/home/config/yt-dlp/config +++ /dev/null @@ -1,21 +0,0 @@ -# Add metadata and other things to the video ---add-metadata ---embed-subs -#--embed-thumbnail ---xattrs - -# Prefer best mp4 video --f 'bestvideo+bestaudio/best' - -# Subtitles ---write-sub ---sub-format best ---sub-lang en,de - -# Download using aria2 ---downloader aria2c ---downloader-args "aria2c:--async-dns=false --max-download-limit=6M --min-split-size=1M --max-connection-per-server=4 --split=4" - -# Other ---no-overwrites ---no-call-home diff --git a/home/programs/yt-dlp.nix b/home/programs/yt-dlp.nix index 2d86246..6d883d7 100644 --- a/home/programs/yt-dlp.nix +++ b/home/programs/yt-dlp.nix @@ -1,17 +1,34 @@ -{ pkgs, ... }: +{ pkgs, config, ... }: { + programs.yt-dlp = { + enable = true; + + settings = { + format = "'bestvideo+bestaudio/best'"; + # Metadata + add-metadata = true; + embed-subs = true; + xattrs = true; + # Subtitles + write-sub = true; + sub-format = "best"; + sub-lang = "en,de"; + # Downloader + downloader = "aria2c"; + downloader-args = "aria2c:'--async-dns=false --max-download-limit=6M --min-split-size=1M --max-connection-per-server=4 --split=4'"; + # Other + no-overwrites = true; + no-call-home = true; + }; + }; + home.packages = with pkgs; [ + aria2 atomicparsley rtmpdump - yt-dlp ]; - xdg.configFile.yt-dlp = { - source = ../config/yt-dlp; - recursive = true; - }; - programs.fish = { shellAliases = { ytdl = "ytdl_with_options"; @@ -20,7 +37,7 @@ }; functions.ytdl_with_options = '' - yt-dlp --config-location "$HOME/.config/yt-dlp/config" --download-archive "$HOME/.config/yt-dlp/archive" $argv + ${config.programs.yt-dlp.package}/bin/yt-dlp --config-location "$HOME/.config/yt-dlp/config" --download-archive "$HOME/.config/yt-dlp/archive" $argv ''; }; }