aboutsummaryrefslogtreecommitdiffstats
path: root/yeetube.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-10-07 12:29:19 +0300
committerThanos Apollo <[email protected]>2023-10-07 12:29:19 +0300
commit1cc5c353901efdd579d5b184276807db9b362247 (patch)
tree6a4cb82ed829533068fce17eaa28c9b6a1d68a59 /yeetube.el
parentdd046970aeacac91b9d44613d0cc3a6c3b10d839 (diff)
parente49844b0d8c9139d8d8b41b8b6f85ea5388443ed (diff)
merge into testing: Add yeetube-download--ffmpeg
Setting up feature to use yeetube-download with ffmpeg
Diffstat (limited to 'yeetube.el')
-rw-r--r--yeetube.el18
1 files changed, 15 insertions, 3 deletions
diff --git a/yeetube.el b/yeetube.el
index cd5ed4b..0142b36 100644
--- a/yeetube.el
+++ b/yeetube.el
@@ -233,7 +233,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:
@@ -249,6 +249,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."
@@ -256,7 +268,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
@@ -277,7 +289,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))