about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el13
-rw-r--r--lisp/acdw-ytel.el44
2 files changed, 49 insertions, 8 deletions
diff --git a/init.el b/init.el index fb6a8c9..4ad55a9 100644 --- a/init.el +++ b/init.el
@@ -2470,14 +2470,15 @@ If used with a numeric prefix argument N, N backticks will be inserted."
2470 2470
2471(setup (:straight xr)) 2471(setup (:straight xr))
2472 2472
2473(setup (:straight-when ytel 2473(setup (:straight-when ytdious
2474 (executable-find "mpv")) 2474 (executable-find "mpv"))
2475 (:also-load acdw-ytel) 2475 (:also-load acdw-ytel) ; so named because I used ytel first
2476 ;; This might need to be changed depending on whether the instance goes down. 2476 (:option ytdious-invidious-api-url "https://invidious.snopyta.org")
2477 (:option ytel-invidious-api-url "https://invidious.snopyta.org")
2478 (:hook #'hl-line-mode) 2477 (:hook #'hl-line-mode)
2479 (:bind "v" #'acdw/ytel-watch 2478 (:global "C-c y" #'ytdious)
2480 "w" #'acdw/ytel-copy-link)) 2479 (:bind "v" #'acdw/ytdious-watch
2480 "w" #'acdw/ytdious-copy-link
2481 "q" #'acdw/ytdious-quit))
2481 2482
2482(setup (:straight zzz-to-char) 2483(setup (:straight zzz-to-char)
2483 2484
diff --git a/lisp/acdw-ytel.el b/lisp/acdw-ytel.el index 01e6187..276323d 100644 --- a/lisp/acdw-ytel.el +++ b/lisp/acdw-ytel.el
@@ -7,12 +7,12 @@
7 7
8;;; Code: 8;;; Code:
9 9
10(require 'ytel) 10(require 'ytel nil t)
11 11
12(defun acdw/ytel-current-video-link () 12(defun acdw/ytel-current-video-link ()
13 "Get the link of the video at point." 13 "Get the link of the video at point."
14 (let* ((video (ytel-get-current-video)) 14 (let* ((video (ytel-get-current-video))
15 (id (ytel-video-id video))) 15 (id (ytel-video-id video)))
16 (concat "https://www.youtube.com/watch?v=" id))) 16 (concat "https://www.youtube.com/watch?v=" id)))
17 17
18(defun acdw/ytel-watch () ; This could possibly use `browse-url'. 18(defun acdw/ytel-watch () ; This could possibly use `browse-url'.
@@ -31,5 +31,45 @@
31 (kill-new link) 31 (kill-new link)
32 (message "Copied %s to kill-ring" link))) 32 (message "Copied %s to kill-ring" link)))
33 33
34
35;;; YTDIOUS: https://github.com/spiderbit/ytdious
36;; a fork of ytel that uses table-view or w/e. looks nicer
37
38(require 'ytdious nil t)
39
40(defun acdw/ytdious-current-video-link ()
41 "Get the link of the video at point."
42 (let* ((video (ytdious-get-current-video))
43 (id (ytdious-video-id-fun video)))
44 (concat "https://www.youtube.com/watch?v=" id)))
45
46(defun acdw/ytdious-watch () ; This could possibly use `browse-url'.
47 "Stream video at point in mpv."
48 (interactive)
49 (let ((link (acdw/ytdious-current-video-link)))
50 (start-process "ytdious mpv" nil
51 "mpv"
52 link
53 "--ytdl-format=bestvideo[height<=?720]+bestaudio/best")
54 (message "Streaming %s..." link)))
55
56(defun acdw/ytdious-copy-link ()
57 "Copy link of the video at point."
58 (interactive)
59 (let ((link (acdw/ytdious-current-video-link)))
60 (kill-new link)
61 (message "Copied %s to kill-ring" link)))
62
63(defun acdw/ytdious-quit ()
64 "Quit ytdious."
65 ;; This corrects an error with `ytdious-quit' where it doesn't have the right
66 ;; buffer setup.
67 (interactive)
68 (quit-window))
69
70;;; Ignore `ytdious-show-image-asyncron' because it's buggy.
71
72(defalias 'ytdious-show-image-asyncron #'ignore)
73
34(provide 'acdw-ytel) 74(provide 'acdw-ytel)
35;;; acdw-ytel.el ends here 75;;; acdw-ytel.el ends here