summaryrefslogtreecommitdiff
path: root/.local/bin/fmd
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/fmd')
-rwxr-xr-x.local/bin/fmd26
1 files changed, 26 insertions, 0 deletions
diff --git a/.local/bin/fmd b/.local/bin/fmd
new file mode 100755
index 0000000..0139d77
--- /dev/null
+++ b/.local/bin/fmd
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# fzf-media: fuzzy search media files
+# Useful when you want to look through a list of video without having to
+# bother with their individual supplementary files like subtitles.
+
+export PREVIEW="${PREVIEW:-"cat \"\$(dirname {})/.description/\${\$(basename {})%.*}.txt\" 2>/dev/null || preview {}"}"
+
+find "$@" -type f \
+ ! -path '*/.*' \
+ ! -name '*.srt' \
+ ! -name '*.vtt' \
+ ! -name '*.description' \
+ ! -wholename '.description/*' \
+ ! -name '*.info.json' \
+ ! -name '*.live_chat.json' \
+ ! -name '*.yt*' |
+ sort |
+ fzf --multi --reverse \
+ --history="${FZF_HIST:=$HOME/.local/share/fzf/media_history}" \
+ --header="${FZF_HEADER:-Browse Media Files}" --header-first \
+ --preview="$PREVIEW" --preview-window=hidden \
+ --bind 'alt-C:execute( ffbrowser "$(mediainfo --inform="General;%Comment%" {})" )' \
+ --bind 'ctrl-o:execute(append-to-history {q} "$FZF_HIST"; ${OPENER:-xdg-open} {})' \
+ --bind "alt-3:change-preview($PREVIEW)" \
+ --bind 'alt-#:execute($PREVIEW | less)'