Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use --mime-type flag to cut back on parsing

  • Loading branch information...
commit b23fd36f682813070dc544e5e0398767a77f7980 1 parent 4c53f56
Dave Reisner authored
Showing with 2 additions and 2 deletions.
  1. +1 −1  flac2mp3
  2. +1 −1  xo
2  flac2mp3
View
@@ -117,7 +117,7 @@ for arg in "${args[@]}"; do
fi
for flac in "${flacs[@]}"; do
- if [[ ! "$(file -bi "$flac")" =~ audio/x-flac ]]; then
+ if [[ ! $(file -bi --mime-type "$flac") = audio/x-flac ]]; then
warn "warning: '$flac' is not a valid flac file"
fi
2  xo
View
@@ -36,7 +36,7 @@ handler[xls]=$doc
# Determine the MIME type via 'file' and assign it to an array
# mimetype[0] = major (e.g. image)
# mimetype[1] = minor (e.g. png)
-IFS='/' read -r -d ';' -a mimetype < <(file -bi "$1")
+IFS='/' read -r -a mimetype < <(file -bi --mime-type "$1")
# Determine the extension as a fallback method
ext=${1//*.}
Please sign in to comment.
Something went wrong with that request. Please try again.