Function: hsys-youtube-time-in-hms
hsys-youtube-time-in-hms is an autoloaded and byte-compiled function
defined in hsys-youtube.el.
Signature
(hsys-youtube-time-in-hms START-TIME-STRING)
Documentation
Return the start time for a Youtube url from START-TIME-STRING.
Start time is returned as hours, minutes and seconds. Hours and minutes are optional within the START-TIME-STRING, e.g. 1:2:44 (1 hour, two minutes, 45 seconds into a video). If the START-TIME-STRING format is invalid, return it unchanged.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hsys-youtube.el
;;;###autoload
(defun hsys-youtube-time-in-hms (start-time-string)
"Return the start time for a Youtube url from START-TIME-STRING.
Start time is returned as hours, minutes and seconds.
Hours and minutes are optional within the START-TIME-STRING, e.g. 1:2:44 (1
hour, two minutes, 45 seconds into a video). If the START-TIME-STRING
format is invalid, return it unchanged."
(if (and (stringp start-time-string)
(string-match-p ":" start-time-string))
(let* ((time-parts (split-string start-time-string "[:hmsHMS]" t))
(num-of-parts (length time-parts))
(part1 (nth 0 time-parts))
(part2 (nth 1 time-parts))
(part3 (nth 2 time-parts)))
(cond ((zerop num-of-parts)
"0s")
((= num-of-parts 1)
(concat part1 "s"))
((= num-of-parts 2)
(concat part1 "m" part2 "s"))
((= num-of-parts 3)
(concat part1 "h" part2 "m" part3 "s"))))
start-time-string))