mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-11-15 22:43:02 +01:00
add playvid script
This commit is contained in:
parent
1e18e7ea45
commit
f0f191f1db
2 changed files with 23 additions and 1 deletions
2
justfile
2
justfile
|
@ -15,7 +15,7 @@ zls-git
|
||||||
|
|
||||||
install-scripts target=(`echo $HOME` + "/.local"):
|
install-scripts target=(`echo $HOME` + "/.local"):
|
||||||
ln -sf \
|
ln -sf \
|
||||||
`pwd`/scripts/{map-touch-display,start-joshuto,withjava,startriver,update-nvim-plugins} \
|
`pwd`/scripts/{map-touch-display,playvid,start-joshuto,withjava,startriver,update-nvim-plugins} \
|
||||||
{{target}}/bin
|
{{target}}/bin
|
||||||
|
|
||||||
cd scripts/randomwallpaper && zig build -Doptimize=ReleaseFast -p {{target}}
|
cd scripts/randomwallpaper && zig build -Doptimize=ReleaseFast -p {{target}}
|
||||||
|
|
22
scripts/playvid
Executable file
22
scripts/playvid
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/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))
|
Loading…
Reference in a new issue