Add osx/youtube/vlc scripts
This commit is contained in:
parent
8e0d67f625
commit
24bf342a63
4 changed files with 47 additions and 0 deletions
BIN
elisp/yt-stopwatch/probe.scpt
Normal file
BIN
elisp/yt-stopwatch/probe.scpt
Normal file
Binary file not shown.
39
elisp/yt-stopwatch/yt-stopwatch.el
Normal file
39
elisp/yt-stopwatch/yt-stopwatch.el
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
|
||||||
|
(defconst yt-stopwatch-script-path (file-name-directory load-file-name))
|
||||||
|
|
||||||
|
(defun yt-stopwatch-record-time ()
|
||||||
|
(interactive)
|
||||||
|
(beginning-of-line)
|
||||||
|
(insert (format "* %ss - " (yt-stopwatch--reformat-time (cdr (yt-stopwatch--probe))))))
|
||||||
|
|
||||||
|
(defun yt-stopwatch--reformat-time (seconds)
|
||||||
|
(format-time-string "%H:%M:%S" (encode-time (string-to-number (car seconds)) 0 0 0 0 0)))
|
||||||
|
|
||||||
|
(defun yt-stopwatch-video-name ()
|
||||||
|
(interactive)
|
||||||
|
(beginning-of-line)
|
||||||
|
(insert (format "%s\n" (car (yt-stopwatch--probe)))))
|
||||||
|
|
||||||
|
(defun yt-stopwatch--probe ()
|
||||||
|
(let ((out (shell-command-to-string (format "osascript %s/probe.scpt" yt-stopwatch-script-path))))
|
||||||
|
(if (string-equal out "---\n")
|
||||||
|
(user-error "VLC isn't running or no video playing")
|
||||||
|
(split-string out " || " t "[\n \t]+"))))
|
||||||
|
|
||||||
|
(defun yt-stopwatch-test ()
|
||||||
|
(interactive)
|
||||||
|
(let ((data (yt-stopwatch--probe)))
|
||||||
|
(message "Video: %s \n Time: %ss" (car data) (cdr data))))
|
||||||
|
|
||||||
|
(defvar yt-stopwatch-mode-map
|
||||||
|
(let ((map (make-sparse-keymap)))
|
||||||
|
(define-key map (kbd "C-c y") 'yt-stopwatch-record-time)
|
||||||
|
(define-key map (kbd "C-c C-y") 'yt-stopwatch-video-name)
|
||||||
|
map))
|
||||||
|
|
||||||
|
(define-minor-mode yt-stopwatch-mode
|
||||||
|
:keymap yt-stopwatch-mode-map
|
||||||
|
:group yt-stopwatch-mode)
|
||||||
|
|
||||||
|
(provide 'yt-stopwatch)
|
||||||
|
;;; yt-stopwatch.el ends here
|
2
init.el
2
init.el
|
@ -42,6 +42,7 @@
|
||||||
(let ((default-directory my-elisp-dir))
|
(let ((default-directory my-elisp-dir))
|
||||||
(normal-top-level-add-subdirs-to-load-path))
|
(normal-top-level-add-subdirs-to-load-path))
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Just the... bear necessities...
|
;; Just the... bear necessities...
|
||||||
(mapc 'require
|
(mapc 'require
|
||||||
|
@ -85,6 +86,7 @@
|
||||||
;; init-vala
|
;; init-vala
|
||||||
init-web
|
init-web
|
||||||
init-yasnippet ; type for me
|
init-yasnippet ; type for me
|
||||||
|
init-youtube ; tools for youtube vids
|
||||||
|
|
||||||
my-bindings
|
my-bindings
|
||||||
my-settings
|
my-settings
|
||||||
|
|
6
init/init-youtube.el
Normal file
6
init/init-youtube.el
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
(require 'yt-stopwatch)
|
||||||
|
|
||||||
|
(provide 'init-youtube)
|
||||||
|
;;; init-youtube.el ends here
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue