summary refs log tree commit diff stats
path: root/lisp/acdw-ytel.el
blob: 01e6187dc872362ba103d83e8047e75fd26f3a79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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