diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-media.el | 2 | ||||
-rw-r--r-- | lisp/mastodon-tl.el | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index acce473..38087d6 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -298,7 +298,7 @@ Replace them with the referenced image." FULL-REMOTE-URL is used for `shr-browse-image'. TYPE is the attachment's type field on the server." (let ((help-echo - "RET/i: load full image (prefix: copy URL), +/-: zoom, r: rotate, o: save preview")) + "RET/i: load full image (prefix: copy URL), C-RET: play moving image, +/-: zoom, r: rotate, o: save preview")) (concat (propertize "[img]" 'media-url media-url 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 |