about summary refs log tree commit diff
path: root/nix/profiles/home-manager
diff options
context:
space:
mode:
Diffstat (limited to 'nix/profiles/home-manager')
-rw-r--r--nix/profiles/home-manager/media.nix35
-rw-r--r--nix/profiles/home-manager/personal.nix2
-rw-r--r--nix/profiles/home-manager/shell.nix1
3 files changed, 36 insertions, 2 deletions
diff --git a/nix/profiles/home-manager/media.nix b/nix/profiles/home-manager/media.nix
new file mode 100644
index 0000000..e3fc3a9
--- /dev/null
+++ b/nix/profiles/home-manager/media.nix
@@ -0,0 +1,35 @@
+{ ... }: {
+  programs.yt-dlp = {
+    enable = true;
+
+    extraConfig = ''
+      # Do not overwrite files
+      --no-overwrites
+
+      # Add metadata to the video files
+      --add-metadata
+
+      # Write video description to a .description file
+      --write-description
+
+      # Restrict filenames to only ASCII characters, and avoid "&" and spaces in filenames
+      --restrict-filenames
+
+      # Select the best audio quality (when extracting audio with -x/--extract-audio)
+      --audio-quality 0
+
+      # Save videos under "~/Movies/WebsiteName/" with the filename "VideoTitle---FormatNote-VideoId.VideoExtension"
+      --output "~/Movies/%(extractor_key)s/%(title)s---%(format_note)s-%(id)s.%(ext)s"
+
+      # Download subtitles for English, French and German
+      --sub-langs en,fr
+
+      # Embed subtitles in the video (only possible with mp4, webm and mkv files)
+      --embed-subs
+
+      # Download with the best resolution and if possible, in the video format mp4 and audio format m4a.
+      # If the video format isn't mp4 already, it will be converted to mp4
+      --format-sort res,ext:mp4:m4a --recode mp4
+    '';
+  };
+}
diff --git a/nix/profiles/home-manager/personal.nix b/nix/profiles/home-manager/personal.nix
index ce0b056..34feca5 100644
--- a/nix/profiles/home-manager/personal.nix
+++ b/nix/profiles/home-manager/personal.nix
@@ -2,7 +2,7 @@
 
   home.stateVersion = "23.05";
 
-  imports = [ ./mac.nix ];
+  imports = [ ./mac.nix ./media.nix ];
 
   programs.git = { userEmail = "franck@fcuny.net"; };
 }
diff --git a/nix/profiles/home-manager/shell.nix b/nix/profiles/home-manager/shell.nix
index 2e96066..b40e3f2 100644
--- a/nix/profiles/home-manager/shell.nix
+++ b/nix/profiles/home-manager/shell.nix
@@ -16,7 +16,6 @@
     # media
     # mpv - TODO: this is currently broken
     ffmpeg
-    yt-dlp
 
     # dicts
     aspell