Merge ca7debcaabe9419c21b4bdf1f15b259692385be9 into 1f7376c805cb57daef05713412f8e562141eead8

This commit is contained in:
Emre AKYÜZ 2024-05-11 15:22:22 +00:00 committed by GitHub
commit fb81cf992f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

22
.local/bin/videosearch Normal file
View File

@ -0,0 +1,22 @@
#!/bin/sh
command -v locate >/dev/null || {
notify-send "Locate not found. Installing..."
sudo pacman -S mlocate
} || {
notify-send "Failed. Run the script once on terminal OR change sudo permissions."
exit 1
}
[ -s "$HOME/.config/.mymlocate.db" ] || {
notify-send "You have no database. Creating it..."
disk_path=$(echo "" | rofi -dmenu -l 0 -p "Enter the disk path (e.g '/mnt/harddisk'): ")
sudo updatedb -o ~/.config/.mymlocate.db -U "$disk_path" || {
notify-send "Failed. Run the script once on terminal OR change sudo permissions."
exit 1
}
}
video_files=$(locate -d ~/.config/.mymlocate.db -b -r '.*\.\(mp4\|mkv\|webm\|mov\|m4v\|wmv\|flv\|avi\)$')
chosen_file=$(echo "$video_files" | sed 's|.*/||; s/\.[^.]*$//' | rofi -dmenu -p "Select Video")
mpv "$(echo "$video_files" | grep -F "/$chosen_file.")"