aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp/my/my-ytdl.el
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2025-07-29 08:42:24 +1000
committerYuchen Pei <id@ypei.org>2025-07-29 08:42:24 +1000
commite8eddcc6955f631ca0cfcd3b755c663a6b5d18ff (patch)
treec96db7936c10d23811ac4f33808b21c309d4800d /emacs/.emacs.d/lisp/my/my-ytdl.el
parentc29f76b4e026d1b5130015d508c04183c81f5dd8 (diff)
[emacs] Add music dirs
Diffstat (limited to 'emacs/.emacs.d/lisp/my/my-ytdl.el')
-rw-r--r--emacs/.emacs.d/lisp/my/my-ytdl.el21
1 files changed, 18 insertions, 3 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-ytdl.el b/emacs/.emacs.d/lisp/my/my-ytdl.el
index 5908666..b04b2a9 100644
--- a/emacs/.emacs.d/lisp/my/my-ytdl.el
+++ b/emacs/.emacs.d/lisp/my/my-ytdl.el
@@ -65,10 +65,15 @@
(defvar my-ytdl-audio-download-dir "~/Downloads"
"Directory for ytdl to download audios to.")
+(defvar my-ytdl-music-download-dir "~/Downloads"
+ "Directory for ytdl to download music to.")
+
(defun my-ytdl-internal (urls type &optional no-tor)
- (my-with-default-directory (if (eq type 'video)
- my-ytdl-video-download-dir
- my-ytdl-audio-download-dir)
+ (my-with-default-directory (pcase type
+ ('video my-ytdl-video-download-dir)
+ ('audio my-ytdl-audio-download-dir)
+ ('music my-ytdl-music-download-dir)
+ (_ (error "Unsupported type: %s" type)))
(apply 'my-start-process-with-torsocks
(append
(list no-tor (format "ytdl-%s" urls) (format "*ytdl-%s*" urls)
@@ -148,11 +153,21 @@
(interactive "sURL(s): ")
(my-ytdl-internal urls 'audio))
+(defun my-ytdl-music (urls)
+ "Download music with ytdl."
+ (interactive "sURL(s): ")
+ (my-ytdl-internal urls 'music))
+
(defun my-ytdl-audio-no-tor (urls)
"Download audio with ytdl."
(interactive "sURL(s): ")
(my-ytdl-internal urls 'audio t))
+(defun my-ytdl-music-no-tor (urls)
+ "Download music with ytdl."
+ (interactive "sURL(s): ")
+ (my-ytdl-internal urls 'music t))
+
;;; fixme: autoload
(defun my-ytdl-video-no-tor (urls)
"Download videos with ytdl."