diff options
author | Case Duckworth | 2021-09-30 17:19:45 -0500 |
---|---|---|
committer | Case Duckworth | 2021-09-30 17:19:45 -0500 |
commit | 613860e8cca21687668eda08def8e70f30a03ef4 (patch) | |
tree | 08e7fd81a74f4e682b9216c9112a2aac491fcdc9 /lisp | |
parent | Merge branch 'main' of tildegit.org:acdw/emacs (diff) | |
download | emacs-613860e8cca21687668eda08def8e70f30a03ef4.tar.gz emacs-613860e8cca21687668eda08def8e70f30a03ef4.zip |
Add acdw-ytel.el
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/acdw-ytel.el | 35 |
1 files changed, 35 insertions, 0 deletions
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 | ||