diff options
author | Thanos Apollo <[email protected]> | 2023-10-06 07:49:23 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2023-10-06 07:50:51 +0300 |
commit | e49844b0d8c9139d8d8b41b8b6f85ea5388443ed (patch) | |
tree | 31b1bfe66c739aeb294fb3fde509a7c49554cf68 | |
parent | 2e0d024b7450c9148825d980b08c67a1165d3038 (diff) |
yeetube: Add yeetube-download--ffmpeg
- Add function to download URL using ffmpeg
- Make commands that are used as shell-processes hidden ("--")
-rw-r--r-- | yeetube.el | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -220,7 +220,7 @@ then for item." (when (equal yeetube-download-audio-format "no") (setf yeetube-download-audio-format nil))) -(defun yeetube-download-ytdlp (url &optional name audio-format) +(defun yeetube-download--ytdlp (url &optional name audio-format) "Download URL using yt-dlp. Optional values: @@ -236,6 +236,18 @@ Optional values: " --extract-audio --audio-format " (shell-quote-argument audio-format))) nil 0)) +(defun yeetube-download--ffmpeg (url name) + "Download URL as NAME using ffmpeg." + (let ((ffmpeg (executable-find "ffmpeg"))) + (unless ffmpeg + (error "Executable ffmpeg not found. Please install ffmpeg")) + (call-process-shell-command + (concat ffmpeg + " -protocol_whitelist file,crypto,data,https,tls,tcp -stats -i " + (shell-quote-argument url) + " -codec copy " + name)))) + ;;;###autoload (defun yeetube-download-video () "Download entry at point in *yeetube* buffer with yt-dlp." @@ -243,7 +255,7 @@ Optional values: (let ((url (yeetube-get-url))) (when (string-prefix-p "http" url) (let ((default-directory yeetube-download-directory)) - (yeetube-download-ytdlp url nil yeetube-download-audio-format) + (yeetube-download--ytdlp url nil yeetube-download-audio-format) (message "Downloading %s " url))))) ;;;###autoload @@ -264,7 +276,7 @@ prompt blank to keep the default name." (unless (string= url "q") (setf name (read-string (format "Custom name (download counter: %d) " download-counter))) (setf download-counter (1+ download-counter)) - (yeetube-download-ytdlp url name yeetube-download-audio-format))))) + (yeetube-download--ytdlp url name yeetube-download-audio-format))))) ;; Yeetube Mode (defvar yeetube-mode-map (make-sparse-keymap)) |