aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/mastodon-media.el16
-rw-r--r--lisp/mastodon-tl.el17
2 files changed, 32 insertions, 1 deletions
diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el
index 4e4a15d..9441bdb 100644
--- a/lisp/mastodon-media.el
+++ b/lisp/mastodon-media.el
@@ -272,6 +272,20 @@ Replace them with the referenced image."
(put-text-property start end 'media-state 'loading)
(mastodon-media--load-image-from-url
image-url media-type start (- end start))))))))
+ ;; (mastodon-media--moving-image-overlay start end)))))))
+
+;; (defun mastodon-media--moving-image-overlay (start end)
+;; "Add play symbol overlay to moving image media items."
+;; (let ((ov (make-overlay start end))
+;; (type (get-text-property start 'mastodon-media-type)))
+;; (when (or (equal type "gifv")
+;; (equal type "video"))
+;; (overlay-put
+;; ov
+;; 'after-string
+;; (propertize " "
+;; 'face
+;; '((:height 1.5 :inherit 'font-lock-comment-face)))))))
(defun mastodon-media--get-avatar-rendering (avatar-url)
"Return the string to be written that renders the avatar at AVATAR-URL."
@@ -312,7 +326,7 @@ TYPE is the attachment's type field on the server."
'keymap mastodon-tl--shr-image-map-replacement
'help-echo (if (string= type "image")
help-echo
- (concat help-echo "\ntype: " type)))
+ (concat help-echo "\nC-RET: play " type " with mpv")))
" ")))
(provide 'mastodon-media)
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 8921259..f7ca297 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -36,6 +36,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")
@@ -156,6 +158,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.
@@ -844,6 +847,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