summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-09-30 17:19:45 -0500
committerCase Duckworth2021-09-30 17:19:45 -0500
commit613860e8cca21687668eda08def8e70f30a03ef4 (patch)
tree08e7fd81a74f4e682b9216c9112a2aac491fcdc9
parentMerge branch 'main' of tildegit.org:acdw/emacs (diff)
downloademacs-613860e8cca21687668eda08def8e70f30a03ef4.tar.gz
emacs-613860e8cca21687668eda08def8e70f30a03ef4.zip
Add acdw-ytel.el
-rw-r--r--init.el13
-rw-r--r--lisp/acdw-ytel.el35
2 files changed, 37 insertions, 11 deletions
diff --git a/init.el b/init.el index fff1782..b4cc4d2 100644 --- a/init.el +++ b/init.el
@@ -2306,17 +2306,8 @@ If used with a numeric prefix argument N, N backticks will be inserted."
2306 (executable-find "mpv")) 2306 (executable-find "mpv"))
2307 ;; This might need to be changed depending on whether the instance goes down. 2307 ;; This might need to be changed depending on whether the instance goes down.
2308 (:option ytel-invidious-api-url "https://invidious.snopyta.org") 2308 (:option ytel-invidious-api-url "https://invidious.snopyta.org")
2309 (:bind "y" 2309 (:bind "v" #'acdw/ytel-current-video-link
2310 (defun ytel-watch () ; This could possibly use `browse-url'. 2310 "w" #'acdw/ytel-copy-link))
2311 "Stream video at point in mpv."
2312 (interactive)
2313 (let* ((video (ytel-get-current-video))
2314 (id (ytel-video-id video)))
2315 (start-process "ytel mpv" nil
2316 "mpv"
2317 (concat "https://www.youtube.com/watch?v=" id)
2318 "--ytdl-format=bestvideo[height<=?720]+bestaudio/best")
2319 (message "Starting streaming...")))))
2320 2311
2321(setup (:straight zzz-to-char) 2312(setup (:straight zzz-to-char)
2322 2313
diff --git a/lisp/acdw-ytel.el b/lisp/acdw-ytel.el new file mode 100644 index 0000000..01e6187 --- /dev/null +++ b/lisp/acdw-ytel.el
@@ -0,0 +1,35 @@
1;;; acdw-ytel.el --- bespoke functions for ytel -*- lexical-binding: t -*-
2
3;;; Commentary:
4
5;; Extra code for the ytel package:
6;; https://github.com/gRastello/ytel
7
8;;; Code:
9
10(require 'ytel)
11
12(defun acdw/ytel-current-video-link ()
13 "Get the link of the video at point."
14 (let* ((video (ytel-get-current-video))
15 (id (ytel-video-id video)))
16 (concat "https://www.youtube.com/watch?v=" id)))
17
18(defun acdw/ytel-watch () ; This could possibly use `browse-url'.
19 "Stream video at point in mpv."
20 (interactive)
21 (start-process "ytel mpv" nil
22 "mpv"
23 (acdw/ytel-current-video-link)
24 "--ytdl-format=bestvideo[height<=?720]+bestaudio/best")
25 (message "Starting streaming..."))
26
27(defun acdw/ytel-copy-link ()
28 "Copy link of the video at point."
29 (interactive)
30 (let ((link (acdw/ytel-current-video-link)))
31 (kill-new link)
32 (message "Copied %s to kill-ring" link)))
33
34(provide 'acdw-ytel)
35;;; acdw-ytel.el ends here