mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-11-14 22:12:07 +01:00
28 lines
974 B
Text
28 lines
974 B
Text
|
#!/usr/bin/env -S ros -Q --
|
||
|
#|-*- mode:lisp -*-|#
|
||
|
(progn ;;init forms
|
||
|
(ros:ensure-asdf)
|
||
|
#+quicklisp(ql:quickload '(uiop trivial-raw-io) :silent t))
|
||
|
|
||
|
(defpackage :playvid
|
||
|
(:use :cl))
|
||
|
(in-package :playvid)
|
||
|
|
||
|
(defun main (&rest argv)
|
||
|
(let* ((vidfile (or (car argv)
|
||
|
(let ((dir (uiop:directory-files ".")))
|
||
|
(nth (random (length dir) (make-random-state t)) dir))))
|
||
|
(basename (pathname-name vidfile)))
|
||
|
(format t "playing video: ~a~%" basename)
|
||
|
(uiop:run-program (list "mpv" (file-namestring vidfile))
|
||
|
:input :interactive
|
||
|
:error-output :interactive
|
||
|
:output :interactive)
|
||
|
(format t "delete `~a`? [Y/n] " basename)
|
||
|
(force-output)
|
||
|
(let ((input (char-upcase (trivial-raw-io:read-char))))
|
||
|
(format t "~a~%" input)
|
||
|
(when (char-equal #\Y input)
|
||
|
(format t "deleting file `~a`~%" basename)
|
||
|
(delete-file vidfile)))))
|