add movie script

This commit is contained in:
krolxon 2023-11-10 00:22:51 +05:30
parent 793b8d720a
commit f37b83c5fa
2 changed files with 17 additions and 5 deletions

View File

@ -49,8 +49,8 @@ colors() {
done
echo
}
movie() {
filename="$(find ~/movies/ -type f -regex ".*\.\(mkv\|mp4\|mpeg\|avi\|mov\|webm\)" -printf "%f\n" | fzf)"
filepath="$(find ~/movies/ -type f -regex ".*\.\(mkv\|mp4\|mpeg\|avi\|mov\|webm\)")"
mpv "$(grep "$filename" <<< "$filepath")"
}
# movie() {
# filename="$(find ~/movies/ -type f -regex ".*\.\(mkv\|mp4\|mpeg\|avi\|mov\|webm\)" -printf "%f\n" | fzf)"
# filepath="$(find ~/movies/ -type f -regex ".*\.\(mkv\|mp4\|mpeg\|avi\|mov\|webm\)")"
# mpv "$(grep "$filename" <<< "$filepath")"
# }

12
.local/bin/movie Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
if [ -t 0 ]; then
filename="$(find ~/movies/ -type f -regex ".*\.\(mkv\|mp4\|mpeg\|avi\|mov\|webm\)" -printf "%f\n" | fzf)"
else
filename="$(find ~/movies/ -type f -regex ".*\.\(mkv\|mp4\|mpeg\|avi\|mov\|webm\)" -printf "%f\n" | dmenu -l 25)"
fi
filepath="$(find ~/movies/ -type f -regex ".*\.\(mkv\|mp4\|mpeg\|avi\|mov\|webm\)")"
mpv "$(grep "$filename" <<< "$filepath")"