From 613860e8cca21687668eda08def8e70f30a03ef4 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 30 Sep 2021 17:19:45 -0500 Subject: Add acdw-ytel.el --- lisp/acdw-ytel.el | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 lisp/acdw-ytel.el (limited to 'lisp') 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 @@ +;;; acdw-ytel.el --- bespoke functions for ytel -*- lexical-binding: t -*- + +;;; Commentary: + +;; Extra code for the ytel package: +;; https://github.com/gRastello/ytel + +;;; Code: + +(require 'ytel) + +(defun acdw/ytel-current-video-link () + "Get the link of the video at point." + (let* ((video (ytel-get-current-video)) + (id (ytel-video-id video))) + (concat "https://www.youtube.com/watch?v=" id))) + +(defun acdw/ytel-watch () ; This could possibly use `browse-url'. + "Stream video at point in mpv." + (interactive) + (start-process "ytel mpv" nil + "mpv" + (acdw/ytel-current-video-link) + "--ytdl-format=bestvideo[height<=?720]+bestaudio/best") + (message "Starting streaming...")) + +(defun acdw/ytel-copy-link () + "Copy link of the video at point." + (interactive) + (let ((link (acdw/ytel-current-video-link))) + (kill-new link) + (message "Copied %s to kill-ring" link))) + +(provide 'acdw-ytel) +;;; acdw-ytel.el ends here -- cgit 1.4.1-21-gabe81