summary refs log tree commit diff
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs/init.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/emacs/init.el b/emacs/init.el
index e36a9fd..65a3c1b 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -878,6 +878,14 @@ The misspelled word is taken from OVERLAY.  WORD is the corrected word."
 (global-set-key [remap query-replace-regexp] 'anzu-query-replace-regexp)
 
 
+(defun snarf-song (url)
+  (interactive "sYoutube url:")
+  (async-shell-command
+   (concat "yt-dlp -x --audio-format=mp3 -o "
+           (shell-quote-argument "~/media/music/%(title)s [%(id)s].%(ext)s")
+           " "
+           (shell-quote-argument url))))
+
 ;;; Escape always quits
 
 ;; Due to emacs's legacy running on terminals, some keys are similar but different.  By which i mean, we have ESC and escape, TAB and tab, and RET and return.  The capital letters refer to the control sequences terminals represent these keys as: C-[, C-i, and C-m respectively.  The lower case words refer to the actual keys.