diff options
author | Sacha Chua <sacha@sachachua.com> | 2022-11-29 15:53:42 -0500 |
---|---|---|
committer | Sacha Chua <sacha@sachachua.com> | 2022-11-29 15:53:42 -0500 |
commit | c5516a13aad78677729a30435b23b4607dffdc29 (patch) | |
tree | b89a5d570acd8017740fee1ed22225e098585b4c /emacsconf-stream.el | |
parent | 1ccaaaa3ca97b53573f78b3afe80987cd61b5dff (diff) | |
download | emacsconf-el-c5516a13aad78677729a30435b23b4607dffdc29.tar.xz emacsconf-el-c5516a13aad78677729a30435b23b4607dffdc29.zip |
emacsconf-stream-show-playback-info: keep track of mpv position
Diffstat (limited to 'emacsconf-stream.el')
-rw-r--r-- | emacsconf-stream.el | 14 |
1 files changed, 14 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 |