aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-tl.el
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2022-01-05 18:41:15 +0100
committermousebot <mousebot@riseup.net>2022-01-11 19:49:22 +0100
commit80a7b6fbc8274a7b82bc7cb3268498f53e58aaf4 (patch)
treee1696719dbdc74e3130c60fff14b02c420be297d /lisp/mastodon-tl.el
parentb21ebf6c3fbbeb100e8ed84c5af0e80fee55dfe1 (diff)
add function to play gif/video at point. uses mpv.el
oops fix the mpv require statement
Diffstat (limited to 'lisp/mastodon-tl.el')
-rw-r--r--lisp/mastodon-tl.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 87b8dfc..50f5c9e 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -35,6 +35,8 @@
(require 'time-date)
(require 'cl-lib) ; for cl-mapcar
+(require 'mpv nil :no-error)
+
(autoload 'mastodon-auth--get-account-name "mastodon-auth")
(autoload 'mastodon-http--api "mastodon-http")
(autoload 'mastodon-http--get-json "mastodon-http")
@@ -152,6 +154,7 @@ types of mastodon links and not just shr.el-generated ones.")
(define-key map (kbd "u") 'mastodon-tl--update)
;; keep new my-profile binding; shr 'O' doesn't work here anyway
(define-key map (kbd "O") 'mastodon-profile--my-profile)
+ (define-key map (kbd "<C-return>") 'mastodon-tl--mpv-play-video-at-point)
(keymap-canonicalize map))
"The keymap to be set for shr.el generated image links.
@@ -839,6 +842,20 @@ a notification."
(message "You voted for option %s: %s!"
(car option) (cdr option)))))))
+(defun mastodon-tl--mpv-play-video-at-point ()
+ "Play the video or gif at point with an mpv process."
+ (interactive)
+ (let ((url (get-text-property (point) 'image-url))
+ (type (mastodon-tl--property 'mastodon-media-type)))
+ (if url
+ (if (or (equal type "gifv")
+ (equal type "video"))
+ (progn
+ (message "'q' to kill mpv.")
+ (mpv-start "--loop" url))
+ (message "no moving image here?"))
+ (message "no moving image here?"))))
+
(defun mastodon-tl--toot (toot)
"Formats TOOT and insertes it into the buffer."
(mastodon-tl--insert-status