mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-12-13 15:52:58 +01:00
22 lines
604 B
Racket
Executable file
22 lines
604 B
Racket
Executable file
#!/usr/bin/env racket
|
|
#lang racket
|
|
|
|
;; Plays a random file in CWD using mpv, unless one is provided as CLI arg.
|
|
;; Asks to delete the file after viewing it.
|
|
|
|
(require racket/gui/base)
|
|
|
|
(current-print void)
|
|
|
|
(define file
|
|
(command-line
|
|
;; default to random file
|
|
#:args ([f (let ([dir (directory-list)]) (path->string (list-ref dir (random (length dir)))))])
|
|
f))
|
|
|
|
(printf "playing: ~a\n" file)
|
|
(system* (find-executable-path "mpv") file)
|
|
|
|
(when (eq? (message-box "Delete Video?" (format "Delete this video?\n\n~a" file) #f '(yes-no)) 'yes)
|
|
(printf "deleting `~a`\n" file)
|
|
(delete-file file))
|