summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--emacsconf-stream.el14
-rw-r--r--emacsconf.el4
2 files changed, 18 insertions, 0 deletions
diff --git a/emacsconf-stream.el b/emacsconf-stream.el
index 19dcb32..69b01d1 100644
--- a/emacsconf-stream.el
+++ b/emacsconf-stream.el
@@ -818,5 +818,19 @@ ffplay URL
(cancel-function-timers #'emacsconf-update-talk-status-with-hooks)
(setq emacsconf-stream-timers nil))
+(defun emacsconf-stream-show-playback-info (talk-or-track)
+ (interactive (list (emacsconf-complete-track)))
+ (let* ((default-directory (emacsconf-stream-track-login talk-or-track))
+ (playback-position (gethash "data" (json-parse-string (shell-command-to-string "echo '{ \"command\": [\"get_property\", \"playback-time\"] }' | socat - ~/mpv-socket"))))
+ (duration (gethash "data" (json-parse-string (shell-command-to-string "echo '{ \"command\": [\"get_property\", \"duration\"] }' | socat - ~/mpv-socket")))))
+ (message "%s of %s (%s remaining, ending at %s)"
+ (emacsconf-format-seconds playback-position)
+ (emacsconf-format-seconds duration)
+ (emacsconf-format-seconds (- duration playback-position))
+ (format-time-string
+ "%H:%M %p"
+ (time-add (current-time) (seconds-to-time (- duration playback-position)))
+ emacsconf-timezone))))
+
(provide 'emacsconf-stream)
;;; emacsconf-stream.el ends here
diff --git a/emacsconf.el b/emacsconf.el
index 214e896..a5a9a0e 100644
--- a/emacsconf.el
+++ b/emacsconf.el
@@ -1366,5 +1366,9 @@ tracks with the ID in the cdr of that list."
(interactive (list (read-file-name "File: " (expand-file-name "./" emacsconf-cache-dir) nil t)))
(find-file (expand-file-name filename emacsconf-cache-dir)))
+(defun emacsconf-format-seconds (seconds)
+ (concat (format-seconds "%.2m:%.2s" (floor seconds))
+ "." (format "%03d" (% (floor (* 1000 seconds)) 1000))))
+
(provide 'emacsconf)
;;; emacsconf.el ends here