From 79a144aad64a5b78e8854857fc853dd5b97bdae0 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Fri, 13 Oct 2023 14:15:46 +0800 Subject: [PATCH] users/foo-dogsquared: add quick script for mpv YouTube playlists --- users/home-manager/foo-dogsquared/default.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/users/home-manager/foo-dogsquared/default.nix b/users/home-manager/foo-dogsquared/default.nix index a079d7e6..c198ff27 100644 --- a/users/home-manager/foo-dogsquared/default.nix +++ b/users/home-manager/foo-dogsquared/default.nix @@ -28,6 +28,22 @@ in home.packages = with pkgs; [ hledger # Trying to be a good accountant. + + # For now, it is not possible to easily play YouTube playlists until it + # is fixed in mpv (or yt-dlp). Ideally, this would be a Python script + # but I don't know jack using yt-dlp as a Python module. + (pkgs.writeShellApplication { + name = "play-mpv-playlist-from-youtube-playlist"; + runtimeInputs = with pkgs; [ + config.programs.mpv.package + yt-dlp + ]; + text = '' + yt-dlp --print id "$1" \ + | xargs -I{} echo "https://www.youtube.com/watch?v={}" \ + | mpv --playlist=- + ''; + }) ]; fonts.fontconfig.enable = true;