From 80a7b6fbc8274a7b82bc7cb3268498f53e58aaf4 Mon Sep 17 00:00:00 2001 From: mousebot Date: Wed, 5 Jan 2022 18:41:15 +0100 Subject: add function to play gif/video at point. uses mpv.el oops fix the mpv require statement --- lisp/mastodon-media.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/mastodon-media.el') 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 -- cgit v1.2.3 From b3890172faf554f9e7bee0049c615ec79947f4d8 Mon Sep 17 00:00:00 2001 From: mousebot Date: Wed, 5 Jan 2022 21:28:57 +0100 Subject: add play symbol as after-string overlay to gifv and video types also update the help-echo for the command to play them --- lisp/mastodon-media.el | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'lisp/mastodon-media.el') diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index 38087d6..0a669cd 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -271,7 +271,16 @@ Replace them with the referenced image." ;; proceed to load this image asynchronously (put-text-property start end 'media-state 'loading) (mastodon-media--load-image-from-url - image-url media-type start (- end start)))))))) + 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 " [ ⏯ ]")))) (defun mastodon-media--get-avatar-rendering (avatar-url) "Return the string to be written that renders the avatar at AVATAR-URL." @@ -298,7 +307,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), C-RET: play moving image, +/-: zoom, r: rotate, o: save preview")) + "RET/i: load full image (prefix: copy URL), +/-: zoom, r: rotate, o: save preview")) (concat (propertize "[img]" 'media-url media-url @@ -312,7 +321,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) -- cgit v1.2.3 From b4a48b1e2d0a223024bac6940717866334176a9a Mon Sep 17 00:00:00 2001 From: mousebot Date: Fri, 7 Jan 2022 13:54:08 +0100 Subject: try an all-the-icons icon. not too sure about it tho. its unicode --- lisp/mastodon-media.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lisp/mastodon-media.el') diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index 0a669cd..3789d5d 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -280,7 +280,12 @@ Replace them with the referenced image." (type (get-text-property start 'mastodon-media-type))) (when (or (equal type "gifv") (equal type "video")) - (overlay-put ov 'after-string " [ ⏯ ]")))) + (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." -- cgit v1.2.3 From cc5e11851daa8979521520a1912a83e6ced26a00 Mon Sep 17 00:00:00 2001 From: mousebot Date: Sat, 15 Jan 2022 17:40:17 +0100 Subject: disable moving image overlay due to the bug the displays it before (point-min) if you load a timeline more than once :/ --- lisp/mastodon-media.el | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'lisp/mastodon-media.el') diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index 3789d5d..54d5430 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -271,21 +271,21 @@ Replace them with the referenced image." ;; proceed to load this image asynchronously (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))))))) + 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--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." -- cgit v1.2.3