Merge 6476766a210727366470f23f58c38c21bba38120 into 86f05abcce1fd270032975775adb40040c746cfe

This commit is contained in:
Emre AKYÜZ 2023-08-31 16:48:18 +02:00 committed by GitHub
commit e53a5935c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

6
.local/bin/videosearch Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash
temp_file=$(mktemp)
locate -d ~/.config/.mymlocate.db -b -r '.*\.\(mp4\|mkv\|webm\|mov\|m4v\wmv\|flv\|avi\)$' | awk -F/ '{name=$NF; gsub(/\.(mp4|mkv|webm|mov|m4v|wmv|flv|avi)$/, "", name); print name "\t" $0}' > "$temp_file"
chosen_file_name_and_path=$(cut -f1 "$temp_file" | dmenu -i -l 10 -p "Select a video file:")
mpv "$(awk -F'\t' -v chosen="$chosen_file_name_and_path" '$1 == chosen {print $2; exit}' "$temp_file")" && rm "$temp_file"