diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-08-21 16:42:21 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-08-21 16:42:21 +0100 |
commit | e5c04e7544da3d83deed708ce4fd02f1aa6108f3 (patch) | |
tree | ca5e60fc7f045cb37968294aa27b1522a7b1b86c /Emacs/.config/emacs/elisp/yt-dlp.el | |
parent | 190754abecfc463688fc73c76db7bfd1112d8f9e (diff) | |
download | dotfiles-e5c04e7544da3d83deed708ce4fd02f1aa6108f3.tar.gz dotfiles-e5c04e7544da3d83deed708ce4fd02f1aa6108f3.tar.bz2 dotfiles-e5c04e7544da3d83deed708ce4fd02f1aa6108f3.zip |
(Emacs/elisp/yt-dlp)+package for downloading videos via yt-dlp
Diffstat (limited to 'Emacs/.config/emacs/elisp/yt-dlp.el')
-rw-r--r-- | Emacs/.config/emacs/elisp/yt-dlp.el | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Emacs/.config/emacs/elisp/yt-dlp.el b/Emacs/.config/emacs/elisp/yt-dlp.el new file mode 100644 index 0000000..051ab5b --- /dev/null +++ b/Emacs/.config/emacs/elisp/yt-dlp.el @@ -0,0 +1,46 @@ +;;; yt-dlp.el --- Using yt-dlp through Emacs -*- lexical-binding: t; -*- + +;; Copyright (C) 2024 Aryadev Chavali + +;; Author: Aryadev Chavali <aryadev@aryadevchavali.com> +;; Keywords: + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License Version +;; 2 as published by the Free Software Foundation. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Please for the love of god have a yt-dlp config. We're not dealing with that +;; for you. + +;;; Code: + +(autoload #'ansi-color-for-comint-mode-on "ansi-color") +(autoload #'comint-mode "comint") +(autoload #'comint-output-filter "comint") + +(defun yt-dlp-download-video (&optional url) + (interactive) + (let ((url (if (stringp url) + url + (read-string "Enter URL: ")))) + (message "[yt-dlp]: Downloading video `%s'" url) + (with-current-buffer (get-buffer-create "*yt-dlp*") + (ansi-color-for-comint-mode-on)) + (set-process-filter (start-process-shell-command + "yt-dlp" "*yt-dlp*" + (concat "yt-dlp " "\"" url "\"")) + #'comint-output-filter) + (switch-to-buffer "*yt-dlp*"))) + +(provide 'yt-dlp) +;;; yt-dlp.el ends here |