emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/subed c1ee129 181/389: Add functions to adjust start/stop


From: ELPA Syncer
Subject: [nongnu] elpa/subed c1ee129 181/389: Add functions to adjust start/stop timestamps to player's ones
Date: Fri, 3 Dec 2021 11:00:22 -0500 (EST)

branch: elpa/subed
commit c1ee1293a1dd2a77831808f3409133ddab4aa7c0
Author: i-blis <i-blis@yandex.ru>
Commit: Random User <rndusr@posteo.de>

    Add functions to adjust start/stop timestamps to player's ones
---
 subed/subed.el | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/subed/subed.el b/subed/subed.el
index 6eae9ec..f7c8c50 100644
--- a/subed/subed.el
+++ b/subed/subed.el
@@ -237,6 +237,23 @@ See `subed-increase-start-time' about ARG."
   (interactive "P")
   (subed-adjust-subtitle-stop (* -1 (subed-get-milliseconds-adjust arg))))
 
+(defun subed-adjust-to-player-start-timestamp ()
+  "Replace current subtitle's start timestamp with mpv player's current 
timestamp."
+  (interactive)
+  (subed-srt--jump-to-subtitle-time-start)
+  (when (and subed-mpv-playback-position
+            (looking-at subed-srt--regexp-timestamp))
+    (replace-match (subed-srt--msecs-to-timestamp subed-mpv-playback-position))
+    (subed--run-subtitle-time-adjusted-hook)))
+
+(defun subed-adjust-to-player-stop-timestamp ()
+  "Replace current subtitle's stop timestamp with mpv player's current 
timestamp."
+  (interactive)
+  (subed-srt--jump-to-subtitle-time-stop)
+  (when (and subed-mpv-playback-position
+            (looking-at subed-srt--regexp-timestamp))
+    (replace-match (subed-srt--msecs-to-timestamp subed-mpv-playback-position))
+    (subed--run-subtitle-time-adjusted-hook)))
 
 ;;; Moving subtitles
 ;;; (adjusting start and stop time by the same amount)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]