~azzamsa/scripts.el

694501ad9e82277f6e49036f932dc2a066df0415 — azzamsa 4 months ago fe7fd65 master
add mpv 🎉
1 files changed, 21 insertions(+), 2 deletions(-)

M aza-scripts.el
M aza-scripts.el => aza-scripts.el +21 -2
@@ 81,10 81,29 @@ Emacs"
    (start-process "" nil "pyuic5" inputfile
                   (concat "--output=" default-directory outputfile "_ui.py"))))

(defun mpv-here ()
(defun start-mpv (path &optional playlist-p)
  "Start mpv with specified arguments"
  (let* ((default-cmd "mpv --force-window")
         (cmd (if playlist-p
                  (s-append " --loop-playlist --playlist=" default-cmd)
                (s-append " --loop " default-cmd))))
    (message "%s" (s-concat cmd path))
    (call-process-shell-command (s-concat cmd (shell-quote-argument path)) nil 0)))

(defun mpv ()
  "Play a file in current line"
  (interactive)
  (start-mpv (dired-get-filename)))

(defun mpv-dir ()
  "Play all multimedia files in current directory"
  (interactive)
  (start-process "" nil "mpv" "--force-window" "--loop" default-directory))
  (start-mpv default-directory))

(defun mpv-playlist ()
  "Play a playlist in current line"
  (interactive)
  (start-mpv (dired-get-filename) t))

(defun trash-empty ()
  "Empty trash using trash-cli. It's safer and painless"