Permalink
Browse files

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

  • Loading branch information...
1 parent 4c53f56 commit b23fd36f682813070dc544e5e0398767a77f7980 @falconindy committed Sep 18, 2011
Showing with 2 additions and 2 deletions.
  1. +1 −1 flac2mp3
  2. +1 −1 xo
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
View
2 xo
@@ -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//*.}

0 comments on commit b23fd36

Please sign in to comment.