blob: 0139d770915270a0803527a1a9535edbf1b83340 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)'
|