From 2148349c16671f36e4604d68557a18e710ad9ba8 Mon Sep 17 00:00:00 2001 From: Nathaniel Landau Date: Sun, 24 May 2015 21:28:29 -0400 Subject: [PATCH] avi files are no longer audio. --- bin/convertMedia | 16 ++++++++-------- lib/sharedFunctions.sh | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/convertMedia b/bin/convertMedia index 3cbb7ab..0f98fdb 100755 --- a/bin/convertMedia +++ b/bin/convertMedia @@ -83,7 +83,7 @@ logFile="$HOME/Library/Logs/${scriptBasename}.log" # most dependencies can be installed automatically using the package # manager 'Homebrew'. # ----------------------------------- -bashDependencies=(ffmpeg jq) +homebrewDependencies=(ffmpeg jq) function mainScript() { ############## Begin Script Here ################### @@ -91,7 +91,7 @@ function mainScript() { # file extension mappings - ie - are we working with a video or music file.... videoTypes=(mp4 mov avi mkv wmv flv ogg m4p m4v 3gp divx h264) -audioTypes=(mp3 avi m4a aiff aac m4p wav wma flac) +audioTypes=(mp3 m4a aiff aac m4p wav wma flac) function breakLoop() { # Break the for loop when a user specifies a file from the CLI. @@ -242,17 +242,17 @@ convertVideo() { format="$(jq -r ".format.format_long_name" "${informationFile}")" formatName="$(jq -r ".format.format_name" "${informationFile}")" - if [ $(jq -r ".streams[0].codec_type" "${informationFile}") == "video" ]; then + if [[ $(jq -r ".streams[0].codec_type" "${informationFile}") == "video" ]]; then videoHeight="$(jq -r ".streams[0].height" "${informationFile}")" videoWidth="$(jq -r ".streams[0].width" "${informationFile}")" videoCodec="$(jq -r '.streams[0].codec_name' "${informationFile}")" videoCodecLong="$(jq -r ".streams[0].codec_long_name" "${informationFile}")" - elif [ $(jq -r ".streams[1].codec_type" "${informationFile}") == "video" ]; then + elif [[ $(jq -r ".streams[1].codec_type" "${informationFile}") == "video" ]]; then videoHeight="$(jq -r ".streams[1].height" "${informationFile}")" videoWidth="$(jq -r ".streams[1].width" "${informationFile}")" videoCodec="$(jq -r '.streams[1].codec_name' "${informationFile}")" videoCodecLong="$(jq -r ".streams[1].codec_long_name" "${informationFile}")" - elif [ $(jq -r ".streams[2].codec_type" "${informationFile}") == "video" ]; then + elif [[ $(jq -r ".streams[2].codec_type" "${informationFile}") == "video" ]]; then videoHeight="$(jq -r ".streams[2].height" "${informationFile}")" videoWidth="$(jq -r ".streams[2].width" "${informationFile}")" videoCodec="$(jq -r '.streams[2].codec_name' "${informationFile}")" @@ -492,17 +492,17 @@ convertMusic() { formatName="$(jq -r ".format.format_name" "${informationFile}")" formatBit_Rate="$(jq -r ".format.bit_rate" "${informationFile}")" - if [ $(jq -r ".streams[0].codec_type" "${informationFile}") == "audio" ]; then + if [[ $(jq -r ".streams[0].codec_type" "${informationFile}") == "audio" ]]; then audioCodec="$(jq -r '.streams[0].codec_name' "${informationFile}")" audioCodecLong="$(jq -r ".streams[0].codec_long_name" "${informationFile}")" audioSampleRate="$(jq -r ".streams[0].sample_rate" "${informationFile}")" audioBitRate="$(jq -r ".streams[0].bit_rate" "${informationFile}")" - elif [ $(jq -r ".streams[1].codec_type" "${informationFile}") == "audio" ]; then + elif [[ $(jq -r ".streams[1].codec_type" "${informationFile}") == "audio" ]]; then audioCodec="$(jq -r '.streams[1].codec_name' "${informationFile}")" audioCodecLong="$(jq -r ".streams[1].codec_long_name" "${informationFile}")" audioSampleRate="$(jq -r ".streams[1].sample_rate" "${informationFile}")" audioBitRate="$(jq -r ".streams[1].bit_rate" "${informationFile}")" - elif [ $(jq -r ".streams[2].codec_type" "${informationFile}") == "audio" ]; then + elif [[ $(jq -r ".streams[2].codec_type" "${informationFile}") == "audio" ]]; then audioCodec="$(jq -r '.streams[2].codec_name' "${informationFile}")" audioCodecLong="$(jq -r ".streams[2].codec_long_name" "${informationFile}")" audioSampleRate="$(jq -r ".streams[2].sample_rate" "${informationFile}")" diff --git a/lib/sharedFunctions.sh b/lib/sharedFunctions.sh index 872015c..1701616 100755 --- a/lib/sharedFunctions.sh +++ b/lib/sharedFunctions.sh @@ -331,12 +331,12 @@ function help () { # The script will fail if dependencies are not installed. For Mac users, # most dependencies can be installed automatically using the package # manager 'Homebrew'. -# Usage in script: $ bashDependencies=(package1 package2) +# Usage in script: $ homebrewDependencies=(package1 package2) # ----------------------------------- function checkDependencies() { # Check bashDependencies - for dependency in "${bashDependencies[@]}"; do + for dependency in "${homebrewDependencies[@]}"; do if type_not_exists "${dependency}"; then # Attempt to install necessary packages via Homebrew if invoked on a Mac if [[ "${OSTYPE}" =~ ^darwin ]]; then