From f7b466e7f475cb63d39f4346559925b22647ae46 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Sat, 9 Mar 2024 11:05:27 +0800 Subject: [PATCH] tests/modules/home-manager: init services.yt-dlp --- tests/modules/home-manager/default.nix | 1 + .../services/yt-dlp/basic-job.nix | 33 ++++++++++ .../home-manager/services/yt-dlp/default.nix | 4 ++ .../services/yt-dlp/multiple-jobs.nix | 65 +++++++++++++++++++ 4 files changed, 103 insertions(+) create mode 100644 tests/modules/home-manager/services/yt-dlp/basic-job.nix create mode 100644 tests/modules/home-manager/services/yt-dlp/default.nix create mode 100644 tests/modules/home-manager/services/yt-dlp/multiple-jobs.nix diff --git a/tests/modules/home-manager/default.nix b/tests/modules/home-manager/default.nix index 3fd67d0c..c63f463a 100644 --- a/tests/modules/home-manager/default.nix +++ b/tests/modules/home-manager/default.nix @@ -58,5 +58,6 @@ import nmt { ++ lib.optionals isLinux [ ./services/matcha ./services/plover + ./services/yt-dlp ]); } diff --git a/tests/modules/home-manager/services/yt-dlp/basic-job.nix b/tests/modules/home-manager/services/yt-dlp/basic-job.nix new file mode 100644 index 00000000..1a87f66b --- /dev/null +++ b/tests/modules/home-manager/services/yt-dlp/basic-job.nix @@ -0,0 +1,33 @@ +{ config, ... }: + +{ + services.yt-dlp = { + enable = true; + + extraArgs = [ + "--no-force-overwrites" + "--write-info-json" + + "--embed-chapters" + + "--download-archive" + "${config.xdg.userDirs.videos}/Archive" + ]; + + jobs.art = { + urls = [ + "https://www.youtube.com/@Jazza" + "https://www.youtube.com/@bobross_thejoyofpainting" + "https://www.youtube.com/@DavidRevoy" + ]; + startAt = "weekly"; + }; + }; + + test.stubs.yt-dlp = { }; + + nmt.script = '' + assertFileExists home-files/.config/systemd/user/yt-dlp-archive-service-art.service + assertFileExists home-files/.config/systemd/user/yt-dlp-archive-service-art.timer + ''; +} diff --git a/tests/modules/home-manager/services/yt-dlp/default.nix b/tests/modules/home-manager/services/yt-dlp/default.nix new file mode 100644 index 00000000..0e82b01b --- /dev/null +++ b/tests/modules/home-manager/services/yt-dlp/default.nix @@ -0,0 +1,4 @@ +{ + yt-dlp-basic-job = ./basic-job.nix; + yt-dlp-multiple-jobs = ./multiple-jobs.nix; +} diff --git a/tests/modules/home-manager/services/yt-dlp/multiple-jobs.nix b/tests/modules/home-manager/services/yt-dlp/multiple-jobs.nix new file mode 100644 index 00000000..02b43dfc --- /dev/null +++ b/tests/modules/home-manager/services/yt-dlp/multiple-jobs.nix @@ -0,0 +1,65 @@ +{ config, ... }: + +{ + services.yt-dlp = { + enable = true; + + extraArgs = [ + "--no-force-overwrites" + "--write-info-json" + + "--embed-chapters" + + "--download-archive" + "${config.xdg.userDirs.videos}/Archive" + ]; + + jobs = { + art = { + urls = [ + "https://www.youtube.com/@Jazza" + "https://www.youtube.com/@bobross_thejoyofpainting" + "https://www.youtube.com/@DavidRevoy" + ]; + startAt = "monthly"; + }; + + music = { + extraArgs = [ + "--extract-audio" + ]; + urls = [ + "https://www.youtube.com/@dragonforce" + "https://www.youtube.com/channel/UCjZjUymRDAhp9c1rb0X6aww" # 500L/g + "https://www.youtube.com/channel/UCOnUfJpp-Fg8X2TnuH_JD7w" # ALAMAT + ]; + startAt = "daily"; + }; + + miscellanea = { + urls = [ + "https://www.youtube.com/@SabatonHistory" + "https://www.youtube.com/channel/UCUaiGrBfRCaC6pL7ZnZjWbg" # JK Brickworks + "https://www.youtube.com/channel/UCdJdEguB1F1CiYe7OEi3SBg" # JonTronShow + "https://www.youtube.com/channel/UCm9K6rby98W8JigLoZOh6FQ" # LockPickingLawyer + ]; + startAt = "weekly"; + }; + }; + }; + + test.stubs.yt-dlp = { }; + + nmt.script = '' + assertFileExists home-files/.config/systemd/user/yt-dlp-archive-service-art.service + assertFileExists home-files/.config/systemd/user/yt-dlp-archive-service-art.timer + + assertFileExists home-files/.config/systemd/user/yt-dlp-archive-service-music.service + assertFileExists home-files/.config/systemd/user/yt-dlp-archive-service-music.timer + + assertFileExists home-files/.config/systemd/user/yt-dlp-archive-service-miscellanea.service + assertFileExists home-files/.config/systemd/user/yt-dlp-archive-service-miscellanea.timer + + assertPathNotExists home-files/.config/yt-dlp/config + ''; +}