feat(mimelist): use `mimetype` for better type detection

This commit is contained in:
Michel DHOOGE 2024-02-09 17:37:06 +01:00
parent b43e0bd084
commit b46d608aa1
1 changed files with 5 additions and 1 deletions

View File

@ -12,4 +12,8 @@ printf "mime (e.g., video/audio/image): "
read -r mime
printf "%s" "+l" > "$NNN_PIPE"
find . | file -if- | grep "$mime" | awk -F: '{printf "%s%c", $1, 0}' > "$NNN_PIPE"
if type mimetype >/dev/null 2>&1; then
find . | mimetype -f - | grep "$mime" | awk -F: '{printf "%s%c", $1, 0}' > "$NNN_PIPE"
else
find . | file -if- | grep "$mime" | awk -F: '{printf "%s%c", $1, 0}' > "$NNN_PIPE"
fi