summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-10-06 18:08:27 +0300
committerThanos Apollo <[email protected]>2023-10-06 18:08:27 +0300
commit42c6bb7e1c65652a9c053e4326df47cc07916c04 (patch)
treea71739b67ec302a914db3e160eb637cf29ff9c64
parent2e0d024b7450c9148825d980b08c67a1165d3038 (diff)
yeetube-buffer: Add yeetube-buffer-insert-content
Seperate the insertion of formatted content from yeetube-create-buffer.
-rw-r--r--yeetube-buffer.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/yeetube-buffer.el b/yeetube-buffer.el
index 0042fcc..8713616 100644
--- a/yeetube-buffer.el
+++ b/yeetube-buffer.el
@@ -180,6 +180,16 @@ Emojis cause formatting issues, this should be off by default."
(yeetube-buffer--format-video-duration "Duration")
(yeetube-buffer--format-channel "Channel"))))
+(defun yeetube-buffer-insert-content (content)
+ "Insert formatted CONTENT."
+ (insert
+ (concat (yeetube-buffer--format-title (yeetube-buffer-fix-title (car content)))
+ (yeetube-buffer--format-view-count (yeetube-buffer-view-count-add-commas
+ (yeetube-buffer-fix-view-count (nth 2 content))))
+ (yeetube-buffer--format-video-duration (nth 3 content))
+ (yeetube-buffer--format-channel (nth 4 content))
+ "\n")))
+
;;;###autoload
(defun yeetube-buffer-create (query content buffer-mode)
"Create *yeetube* buffer with BUFFER-MODE for search QUERY, displaying CONTENT."