#!/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 {}"}" fd -I --color=always --type=file --ignore-file="${XDG_CONFIG_HOME:-$HOME/.config}/ytignore" "$@" | 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)'