diff --git a/barcodeinterpret b/barcodeinterpret index ede05354..6bb4be59 100755 --- a/barcodeinterpret +++ b/barcodeinterpret @@ -1,8 +1,8 @@ #!/bin/bash # interpret Interleaved 2/5 barcode 58 byte barcode values used by the ProBell tape management system -scriptdir=$(dirname "$0") -. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; +scriptdir=$(dirname "${0}") +. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;}; cleanup(){ _log -a "Process aborted" @@ -16,7 +16,7 @@ if test $# != 1 ; then echo "You must supply one argument, a scanned interleaved 2/5 barcode value"; exit fi -barcode="$1" +barcode="${1}" translatebyte() { diff --git a/blackatends b/blackatends index 59e27ad4..ef34de18 100755 --- a/blackatends +++ b/blackatends @@ -1,8 +1,8 @@ #!/bin/bash # blackatends # Accepts one or many video files as an input and determines how many frames of black are at the beginning and at the end -scriptdir=$(dirname "$0") -. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; +scriptdir=$(dirname "${0}") +. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;}; version=1.0 cleanup(){ @@ -14,7 +14,7 @@ trap cleanup SIGHUP SIGINT SIGTERM usage(){ echo - echo "$(basename "$0") ${version}" + echo "$(basename "${0}") ${version}" echo "This program will report on the number of black frames at the beginning and end of a video file." echo echo "Usage: $(basename $0) file1 [ file2 ... ]" @@ -37,9 +37,9 @@ while getopts ":h" opt; do done shift $(( ${OPTIND} - 1 )) -while [ "$*" != "" ] ; do +while [ "${*}" != "" ] ; do _log -b - [ "$#" != 0 ] && sourcefile="$1" + [ "$#" != 0 ] && sourcefile="${1}" black_at_ends "$sourcefile" _log -e shift diff --git a/checksum2filemaker b/checksum2filemaker index 67fe7569..f9a0e56f 100755 --- a/checksum2filemaker +++ b/checksum2filemaker @@ -10,7 +10,7 @@ SCRIPTDIR=$(dirname "${0}") [ -z "${FILEMAKER_XML_URL}" ] && { echo "The filemaker xml path must be set. Run mmconfig to set FILEMAKER_XML_URL." ; exit 1 ;}; while [ "${*}" != "" ] ; do - input="$1" + input="${1}" if [[ ! -f "${input}/metadata/checksum.md5" ]] ; then report -dt "${input} does not have a checksum.md5 file, skipping for $(basename "$input")" shift @@ -27,6 +27,6 @@ while [ "${*}" != "" ] ; do fi done IFS=$OLDIFS - echo "Done uploading metadata for $(basename "$1")." + echo "Done uploading metadata for $(basename "${1}")." shift done diff --git a/checksumpackage b/checksumpackage index da7b43b1..9fd82d3d 100755 --- a/checksumpackage +++ b/checksumpackage @@ -17,10 +17,10 @@ CHECKSUMPROCESSLOG="checksumchecks.log" usage(){ echo - echo "$(basename ${0}) ${version}" + echo "$(basename "${0}") ${version}" echo "This application will create a checksum from a directory or package input with the following options. Actions and results will be logged to ${CHECKSUMPROCESSLOG}." echo "Dependencies: ${dependencies[@]}" - echo "Usage: $(basename ${0}) directoryorpackage1 [ directoryorpackage2 ...]" + echo "Usage: $(basename "${0}") directoryorpackage1 [ directoryorpackage2 ...]" echo " -c ( check filenames and filesizes in objects directory are the same as in existing checksum files, if none exists it will make the initial ones )" echo " -u ( valid only if -c is used. If the check is unsuccessful then make new checksums and version the previous ones. )" echo " -v ( fully verify checksum files against checksum files, if none exists it will make the initial ones. Note verification will version existing checksums and make new ones and log the difference to ${CHECKSUMPROCESSLOG})" @@ -80,12 +80,12 @@ _check_dfxml(){ if [[ $(diff "${DFXML_FILELIST}" "${NEW_FILELIST}") ]] ; then report -wt "filepaths and sizes are different for ${1}" diff "${DFXML_FILELIST}" "${NEW_FILELIST}" - echo "$(get_iso8601): $(basename ${0}):${version}: failed to verify by filepath and size" >> "${PACKAGE}/${OUTDIR}/${CHECKSUMPROCESSLOG}" + echo "$(get_iso8601): $(basename "${0}"):${version}: failed to verify by filepath and size" >> "${PACKAGE}/${OUTDIR}/${CHECKSUMPROCESSLOG}" rm "${DFXML_FILELIST}" "${NEW_FILELIST}" checkerr=0 else report -dt "filepaths and sizes are still valid for ${1}" - echo "$(get_iso8601): $(basename ${0}):${version}: verified by filepath and size" >> "${PACKAGE}/${OUTDIR}/${CHECKSUMPROCESSLOG}" + echo "$(get_iso8601): $(basename "${0}"):${version}: verified by filepath and size" >> "${PACKAGE}/${OUTDIR}/${CHECKSUMPROCESSLOG}" rm "${DFXML_FILELIST}" "${NEW_FILELIST}" checkerr=1 fi @@ -98,8 +98,8 @@ _version_dfxml(){ LASTDFXML="${PACKAGE}/${OUTDIR}/${DFXMLNAME%.*}_$(stat -t '%Y%m%d-%H%M%S' -l "${PACKAGE}/${OUTDIR}/${DFXMLNAME}" | awk '{print $6}').xml" mv -v "${PACKAGE}/${OUTDIR}/${CHECKSUMNAME}" "${LASTMD5}" mv -v "${PACKAGE}/${OUTDIR}/${DFXMLNAME}" "${LASTDFXML}" - echo "$(get_iso8601): $(basename ${0}):${version}: checksums are versioned - ${DFXMLNAME} -> ${LASTDFXML}" >> "${PACKAGE}/${OUTDIR}/${CHECKSUMPROCESSLOG}" - echo "$(get_iso8601): $(basename ${0}):${version}: checksums are versioned - ${CHECKSUMNAME} -> ${LASTMD5}" >> "${PACKAGE}/${OUTDIR}/${CHECKSUMPROCESSLOG}" + echo "$(get_iso8601): $(basename "${0}"):${version}: checksums are versioned - ${DFXMLNAME} -> ${LASTDFXML}" >> "${PACKAGE}/${OUTDIR}/${CHECKSUMPROCESSLOG}" + echo "$(get_iso8601): $(basename "${0}"):${version}: checksums are versioned - ${CHECKSUMNAME} -> ${LASTMD5}" >> "${PACKAGE}/${OUTDIR}/${CHECKSUMPROCESSLOG}" } while [ "${*}" != "" ] ; do @@ -155,14 +155,14 @@ while [ "${*}" != "" ] ; do DFXMLTMP=$(maketemp) md5deep -drl . > $DFXMLTMP [ ! -d "${PACKAGE}/${OUTDIR}" ] && mkdir -p "${PACKAGE}/${OUTDIR}" - echo "$(get_iso8601): $(basename ${0}):${version}: ${DFXMLNAME} is generated" >> "${PACKAGE}/${OUTDIR}/${CHECKSUMPROCESSLOG}" + echo "$(get_iso8601): $(basename "${0}"):${version}: ${DFXMLNAME} is generated" >> "${PACKAGE}/${OUTDIR}/${CHECKSUMPROCESSLOG}" mv "${DFXMLTMP}" "${PACKAGE}/${OUTDIR}/${DFXMLNAME}" if [ ! -z "$(xml sel -T -t -m "/_:dfxml/_:fileobject" -v "_:filename" -o " " -v "_:filesize" -n "${PACKAGE}/${OUTDIR}/${DFXMLNAME}" 2>/dev/null)" ] ; then xml sel -T -t -m "/_:dfxml/_:fileobject" -v "_:hashdigest" -o " " -v "_:filename" -n "${PACKAGE}/${OUTDIR}/${DFXMLNAME}" > "${PACKAGE}/${OUTDIR}/${CHECKSUMNAME}" else xml sel -T -t -m "/dfxml/fileobject" -v "hashdigest" -o " " -v "filename" -n "${PACKAGE}/${OUTDIR}/${DFXMLNAME}" > "${PACKAGE}/${OUTDIR}/${CHECKSUMNAME}" fi - echo "$(get_iso8601): $(basename ${0}):${version}: ${CHECKSUMNAME} is generated" >> "${PACKAGE}/${OUTDIR}/${CHECKSUMPROCESSLOG}" + echo "$(get_iso8601): $(basename "${0}"):${version}: ${CHECKSUMNAME} is generated" >> "${PACKAGE}/${OUTDIR}/${CHECKSUMPROCESSLOG}" cd "${PWD}" if [ "${verify}" = "Y" ] ; then CHECKSUMCMP1=$(maketemp) @@ -172,10 +172,10 @@ while [ "${*}" != "" ] ; do if [[ $(diff "${CHECKSUMCMP1}" "${CHECKSUMCMP2}") ]] ; then report -wt "checksums are different for ${PACKAGE}" diff "${CHECKSUMCMP1}" "${CHECKSUMCMP2}" - echo "$(get_iso8601): $(basename ${0}):${version}: FAILED to VERIFY by checksums - compare ${CHECKSUMNAME} and $(basename "${LASTMD5}")" >> "${PACKAGE}/${OUTDIR}/${CHECKSUMPROCESSLOG}" + echo "$(get_iso8601): $(basename "${0}"):${version}: FAILED to VERIFY by checksums - compare ${CHECKSUMNAME} and $(basename "${LASTMD5}")" >> "${PACKAGE}/${OUTDIR}/${CHECKSUMPROCESSLOG}" else report -dt "checksums are still valid for ${PACKAGE}" - echo "$(get_iso8601): $(basename ${0}):${version}: verified by checksums" >> "${PACKAGE}/${OUTDIR}/${CHECKSUMPROCESSLOG}" + echo "$(get_iso8601): $(basename "${0}"):${version}: verified by checksums" >> "${PACKAGE}/${OUTDIR}/${CHECKSUMPROCESSLOG}" fi rm "${CHECKSUMCMP1}" "${CHECKSUMCMP2}" fi diff --git a/finishpackage b/finishpackage index ca80d8bb..ea07223f 100755 --- a/finishpackage +++ b/finishpackage @@ -1,6 +1,6 @@ #!/bin/bash while [ "${*}" != "" ] ; do - input="$1" + input="${1}" makelossless "${input}" && makebroadcast "${input}" && makeyoutube "${input}" && makemetadata "${input}" && checksumpackage "${input}" shift done \ No newline at end of file diff --git a/ingestfile b/ingestfile index 03163da9..4557a314 100755 --- a/ingestfile +++ b/ingestfile @@ -19,7 +19,7 @@ scriptdir=$(dirname "${0}") usage(){ echo - echo "$(basename ${0}) ${version}" + echo "$(basename "${0}") ${version}" echo "This script will run an interactive interview and then process an input file accordingly." echo "Dependencies: ${dependencies[@]}" echo "Usage: $(basename $0) [ -options ]" @@ -241,27 +241,27 @@ if [ "${makeaccesscopies}" == "Y" ] ; then unset makepodcastopts report -dt "STATUS Making access copies." # makemp3 - "$scriptdir/makemp3" "${OUTDIR_INGESTFILE}/${mediaid}" + "${scriptdir}/makemp3" "${OUTDIR_INGESTFILE}/${mediaid}" # makeframes [ "$deliveraccesscopies" = "Y" ] && makeframesopts=(-d "$YOUTUBEDELIVER") - "$scriptdir/makeframes" "${makeframesopts[@]}" "$OUTDIR_INGESTFILE/$mediaid" + "${scriptdir}/makeframes" "${makeframesopts[@]}" "$OUTDIR_INGESTFILE/$mediaid" # makeyoutube [ "$deliveraccesscopies" = "Y" ] && makeyoutubeopts=(-d "$YOUTUBEDELIVER") - "$scriptdir/makeyoutube" "${makeyoutubeopts[@]}" "$OUTDIR_INGESTFILE/$mediaid" + "${scriptdir}/makeyoutube" "${makeyoutubeopts[@]}" "$OUTDIR_INGESTFILE/$mediaid" # makepodcast if [ $(echo "$mediaid" | grep -E "${REGEX4PODCAST}") ] ; then report -dt "${mediaid} qualifies for podcast creation." [ "$deliveraccesscopies" == "Y" ] && makepodcastopts=(-d "$PODCASTDELIVER") - "$scriptdir/makepodcast" "${makepodcastopts[@]}" "$OUTDIR_INGESTFILE/$mediaid" + "${scriptdir}/makepodcast" "${makepodcastopts[@]}" "$OUTDIR_INGESTFILE/$mediaid" else report -dt "${mediaid} does NOT qualify for podcast creation, skipping." fi # makedvd - "$scriptdir/makedvd" "${OUTDIR_INGESTFILE}/${mediaid}" + "${scriptdir}/makedvd" "${OUTDIR_INGESTFILE}/${mediaid}" # makemetadata - "$scriptdir/makemetadata" "$OUTDIR_INGESTFILE/$mediaid" + "${scriptdir}/makemetadata" "$OUTDIR_INGESTFILE/$mediaid" if [ "$dochecksums" = "Y" ] ; then - "$scriptdir/checksumpackage" "$OUTDIR_INGESTFILE/$mediaid" + "${scriptdir}/checksumpackage" "$OUTDIR_INGESTFILE/$mediaid" fi fi _writeingestlog "datetime_end" "$(get_iso8601)" diff --git a/makebroadcast b/makebroadcast index 7e0f3547..d53db3d5 100755 --- a/makebroadcast +++ b/makebroadcast @@ -4,17 +4,17 @@ # v 1.2 revert to mov and ffmbc # v 1.3 revert back to ffmpeg version="1.3" -scriptdir=$(dirname $(which "$0")) -. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; +scriptdir=$(dirname $(which "${0}")) +. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;}; dependencies=(ffmpeg ffprobe) _initialize_make usage(){ echo - echo "$(basename ${0}) ${version}" + echo "$(basename "${0}") ${version}" echo "This application will create a file suitable for broadcast or editing from a video file or package input with the following options." echo "Dependencies: ${dependencies[@]}" - echo "Usage: $(basename ${0}) [ -l ] [ -r ] [ -c ] fileorpackage1 [ fileorpackage2 ...]" + echo "Usage: $(basename "${0}") [ -l ] [ -r ] [ -c ] fileorpackage1 [ fileorpackage2 ...]" echo " -F (apply a formula, override default settings)" echo " -l (only use the left channel of the first audio track)" echo " -r (only use the right channel of the first audio track)" @@ -54,7 +54,7 @@ shift $(( ${OPTIND} - 1 )) while [ "${*}" != "" ] ; do # get context about the input - input="$1" + input="${1}" if [ -z "${outputdir_forced}" ] ; then [ -d "${input}" ] && { outputdir="${input}/objects/service" && logdir="${input}/metadata/submissionDocumentation/logs" ;}; [ -f "${input}" ] && { outputdir=$(dirname "${input}")"/service" && logdir="$(dirname "${input}")/service/logs" ;}; diff --git a/makedvd b/makedvd index 7890d164..d063bdfd 100755 --- a/makedvd +++ b/makedvd @@ -1,14 +1,14 @@ #!/bin/bash # makedvd version="1.0" -scriptdir=$(dirname $(which "$0")) -. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; +scriptdir=$(dirname $(which "${0}")) +. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;}; dependencies=(ffmpeg dvdauthor mkisofs) _initialize_make usage(){ echo - echo "$(basename ${0}) ${version}" + echo "$(basename "${0}") ${version}" echo "This application will create a DVD .iso file from a video file or package input with the following options." echo "Dependencies: ${dependencies[@]}" echo "Usage: $(basename $0) [ -v dvd_label_prefix ] fileorpackage1 [ fileorpackage2 ...]" @@ -48,7 +48,7 @@ shift $(( ${OPTIND} - 1 )) while [ "${*}" != "" ] ; do # get context about the input - input="$1" + input="${1}" if [ -z "${outputdir_forced}" ] ; then [ -d "${input}" ] && { outputdir="${input}/objects/access/dvd" && logdir="${input}/metadata/submissionDocumentation/logs" ;}; [ -f "${input}" ] && { outputdir=$(dirname "${input}")"/access/dvd" && logdir="$(dirname "${input}")/access/logs" ;}; diff --git a/makeframes b/makeframes index 2cc5aae1..cf1565e1 100755 --- a/makeframes +++ b/makeframes @@ -1,8 +1,8 @@ #!/bin/bash # makeframes version="1.0" -scriptdir=$(dirname $(which "$0")) -. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; +scriptdir=$(dirname $(which "${0}")) +. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;}; dependencies=(ffmpeg) _initialize_make @@ -11,7 +11,7 @@ IMAGECOUNT=10 usage(){ echo - echo "$(basename ${0}) ${version}" + echo "$(basename "${0}") ${version}" echo "This application will create a series of still images from a video file or package input with the following options." echo "Dependencies: ${dependencies[@]}" echo "Usage: $(basename $0) [ -d /path/to/deliver/to/ ] fileorpackage1 [ fileorpackage2 ...]" @@ -38,14 +38,14 @@ while getopts ":d:e:E:nh" opt ; do done shift $(( ${OPTIND} - 1 )) -while [ "$*" != "" ] ; do - input="$1" +while [ "${*}" != "" ] ; do + input="${1}" [ -d "$input" ] && { outputdir="$input/objects/access/images" && logdir="$input/metadata/submissionDocumentation/logs" ;}; [ -f "$input" ] && { outputdir=$(dirname "$input")"/access/images" && logdir="$(dirname "$input")/access/logs" ;}; [ ! "$outputdir" ] && { outputdir="$input/objects/access/images" && logdir="$input/metadata/submissionDocumentation/logs" ;}; _find_input "$input" - mediaid=$(basename "$1" | cut -d. -f1) + mediaid=$(basename "${1}" | cut -d. -f1) # clear local arrays unset inputoptions diff --git a/makelossless b/makelossless index 8a55f98c..9e73c5cb 100755 --- a/makelossless +++ b/makelossless @@ -1,14 +1,14 @@ #!/bin/bash # makelossless version="1.0" -scriptdir=$(dirname $(which "$0")) -. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; +scriptdir=$(dirname $(which "${0}")) +. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;}; dependencies=(ffmpeg mediainfo) _initialize_make usage(){ echo - echo "$(basename ${0}) ${version}" + echo "$(basename "${0}") ${version}" echo "This application will losslessly transcode a video file or package input with the following options." echo "Dependencies: ${dependencies[@]}" echo "Usage: $(basename $0) fileorpackage1 [ fileorpackage2 ...]" @@ -35,7 +35,7 @@ shift $(( ${OPTIND} - 1 )) while [ "${*}" != "" ] ; do # get context about the input - input="$1" + input="${1}" [ -d "${input}" ] && logdir="${input}/metadata/submissionDocumentation/logs" [ -f "${input}" ] && logdir="$(dirname "${input}")/lossless/logs" [ ! "${logdir}" ] && logdir="${input}/metadata/submissionDocumentation/logs" diff --git a/makemetadata b/makemetadata index e87b35f0..b4e8948c 100755 --- a/makemetadata +++ b/makemetadata @@ -8,9 +8,9 @@ _initialize_make usage(){ echo - echo "$(basename ${0}) ${version}" + echo "$(basename "${0}") ${version}" echo "Produces a set of metadata reports for an archival information package on all files in the objects subdirectory." - echo "Usage: $(basename ${0}) [ -h ] package1 [ package2 ... ]" + echo "Usage: $(basename "${0}") [ -h ] package1 [ package2 ... ]" echo " -h (show usage)" exit } diff --git a/makemp3 b/makemp3 index a2c866ca..26291b4e 100755 --- a/makemp3 +++ b/makemp3 @@ -44,8 +44,8 @@ while getopts ":ho:" opt; do done shift $(( ${OPTIND} - 1 )) -while [ "$*" != "" ] ; do - input="$1" +while [ "${*}" != "" ] ; do + input="${1}" if [ -z "${outputdir}" ] ; then [ -d "${input}" ] && { outputdir="${input}/objects/access/mp3" && logdir="${input}/metadata/submissionDocumentation/logs" ;}; [ -f "${input}" ] && { outputdir=$(dirname "${input}")"/access/mp3" && logdir="$(dirname "${input}")/access/logs" ;}; diff --git a/makepdf b/makepdf index 1c5f0afe..f4763806 100755 --- a/makepdf +++ b/makepdf @@ -1,8 +1,8 @@ #!/bin/bash # makepdf, makes a pdf from an image series version="1.0" -scriptdir=$(dirname $(which "$0")) -. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; +scriptdir=$(dirname $(which "${0}")) +. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;}; dependencies=(ffmpeg convert pdfjoin tesseract) _initialize_make @@ -37,7 +37,7 @@ check_tif_name(){ usage(){ echo - echo "$(basename ${0}) ${version}" + echo "$(basename "${0}") ${version}" echo "This application will create a small pdf file (suitable for sharing online) from a collection of image file or package input with the following options." echo "Dependencies: ${dependencies[@]}" echo "Usage: $(basename $0) [ -d /path/to/deliver/to/ ] fileorpackage1 [ fileorpackage2 ...]" @@ -73,7 +73,7 @@ shift $(( ${OPTIND} - 1 )) while [ "${*}" != "" ] ; do # get context about the input - input="$1" + input="${1}" if [ -z "${outputdir_forced}" ] ; then [ -d "${input}" ] && { outputdir="${input}/objects/access/pdf_1" && logdir="${input}/metadata/submissionDocumentation/logs" ;}; [ -f "${input}" ] && { outputdir=$(dirname "${input}")"/access/pdf_1" && logdir="$(dirname "${input}")/access/logs" ;}; diff --git a/makepodcast b/makepodcast index 920a4f5f..8de69b0d 100755 --- a/makepodcast +++ b/makepodcast @@ -1,14 +1,14 @@ #!/bin/bash # makepodcast, makes a file appropriate for podcasting version="1.0" -scriptdir=$(dirname $(which "$0")) -. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; +scriptdir=$(dirname $(which "${0}")) +. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;}; dependencies=(ffmpeg) _initialize_make usage(){ echo - echo "$(basename ${0}) ${version}" + echo "$(basename "${0}") ${version}" echo "This application will create a QuickTime file suitable for podcasting from a video file or package input with the following options." echo "Dependencies: ${dependencies[@]}" echo "Usage: $(basename $0) [ -d /path/to/deliver/to/ ] fileorpackage1 [ fileorpackage2 ...]" @@ -41,7 +41,7 @@ shift $(( ${OPTIND} - 1 )) while [ "${*}" != "" ] ; do # get context about the input - input="$1" + input="${1}" if [ -z "${outputdir_forced}" ] ; then [ -d "${input}" ] && { outputdir="$input/objects/access/podcast" && logdir="${input}/metadata/submissionDocumentation/logs" ;}; [ -f "${input}" ] && { outputdir=$(dirname "${input}")"/access/podcast" && logdir="$(dirname "${input}")/access/logs" ;}; diff --git a/makeprores b/makeprores index b2ce3621..43c15134 100755 --- a/makeprores +++ b/makeprores @@ -1,8 +1,8 @@ #!/bin/bash # makeprores, makes a file appropriate for keeping editors happy version="1.0" -scriptdir=$(dirname $(which "$0")) -. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; +scriptdir=$(dirname $(which "${0}")) +. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;}; dependencies=(ffmpeg) _initialize_make @@ -10,7 +10,7 @@ outputdir="$HOME/Desktop/$(basename $0)" # default output directory, override wi usage(){ echo - echo "$(basename ${0}) ${version}" + echo "$(basename "${0}") ${version}" echo "This application will create a prores/quicktime file (suitable for editing) from a video file or package input with the following options. By default the output will be written to ${outputdir}. You can override this with the -o option." echo "Dependencies: ${dependencies[@]}" echo "Usage: $(basename $0) [ -o /directory/to/write/to/ ] fileorpackage1 [ fileorpackage2 ...]" @@ -43,7 +43,7 @@ shift $(( ${OPTIND} - 1 )) while [ "${*}" != "" ] ; do # get context about the input - input="$1" + input="${1}" if [ -z "${outputdir_forced}" ] ; then [ -d "${input}" ] && { outputdir="${input}/objects/access/prores" && logdir="${input}/metadata/submissionDocumentation/logs" ;}; [ -f "${input}" ] && { outputdir=$(dirname "${input}")"/access/prores" && logdir="$(dirname "${input}")/access/logs" ;}; diff --git a/makeyoutube b/makeyoutube index f8375a88..1fc3d558 100755 --- a/makeyoutube +++ b/makeyoutube @@ -1,14 +1,14 @@ #!/bin/bash # makeyoutube, makes a file appropriate for uploading to youtube version="1.0" -scriptdir=$(dirname $(which "$0")) -. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; +scriptdir=$(dirname $(which "${0}")) +. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;}; dependencies=(ffmpeg) _initialize_make usage(){ echo - echo "$(basename ${0}) ${version}" + echo "$(basename "${0}") ${version}" echo "This application will create a high quality h264 file (suitable for uploading to YouTube) from a video file or package input with the following options." echo "Dependencies: ${dependencies[@]}" echo "Usage: $(basename $0) [ -d /path/to/deliver/to/ ] fileorpackage1 [ fileorpackage2 ...]" @@ -48,7 +48,7 @@ shift $(( ${OPTIND} - 1 )) while [ "${*}" != "" ] ; do # get context about the input - input="$1" + input="${1}" if [ -z "${outputdir_forced}" ] ; then [ -d "${input}" ] && { outputdir="${input}/objects/access/youtube_up" && logdir="${input}/metadata/submissionDocumentation/logs" ;}; [ -f "${input}" ] && { outputdir=$(dirname "${input}")"/access/youtube_up" && logdir="$(dirname "${input}")/access/logs" ;}; diff --git a/mmconfig b/mmconfig index 45f49c93..da6acb8a 100755 --- a/mmconfig +++ b/mmconfig @@ -3,14 +3,14 @@ # set up variables for microservices CONFIG="Y" CONFIG_VERSION="1.0" -scriptdir=$(dirname "$0") -. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; +scriptdir=$(dirname "${0}") +. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;}; # local variables REQUIRED_VARIABLES=("OUTDIR_INGESTFILE" "OUTDIR_INGESTXDCAM" "OUTDIR_PAPER" "AIP_STORAGE" "PODCASTDELIVER" "YOUTUBEDELIVER" "TMPDIR" "REGEX4PODCAST" "DVDLABELPREFIX" "OMNEONIP" "OMNEONPATH" "CUSTOM_LOG_DIR" "LTO_INDEX_DIR" "LOCAL_MM_DIR" "EMAIL_FROM" "MAKEYOUTUBE_DELIVERY_EMAIL_TO" "MAKEBROADCAST_DELIVERY_EMAIL_TO" "FILEMAKER_DB" "FILEMAKER_XML_URL") config_edit(){ - [ -z "$1" -o -z "$2" ] && { report -w "The config_edit function requires two arguments. Error." ; exit ;}; + [ -z "${1}" -o -z "$2" ] && { report -w "The config_edit function requires two arguments. Error." ; exit ;}; sedtemp=$(maketemp) sed "s:^$1=[^ ]*:$1=$2:" "$CONFIG_FILE" > "$sedtemp" cp "$sedtemp" "$CONFIG_FILE" @@ -27,7 +27,7 @@ test_config(){ } add_key(){ - key_to_add="$1" + key_to_add="${1}" grep -q "^$key_to_add=" "$CONFIG_FILE" ; grep_code="$?" if [[ ! "${grep_code}" -eq "0" ]] ; then report -td "Adding NEW variable $key_to_add to $CONFIG_FILE" diff --git a/mmfunctions b/mmfunctions index f6e97178..47d89a50 100755 --- a/mmfunctions +++ b/mmfunctions @@ -89,7 +89,7 @@ report(){ _writeingestlog(){ if [ "${ingestlog}" ] ; then - key="$1" + key="${1}" value="$2" # need to add yaml style escaping echo "$key: ${value}" >> "${ingestlog}" @@ -100,7 +100,7 @@ _writeingestlog(){ _readingestlog(){ if [ -f "${ingestlog}" ] ; then - key="$1" + key="${1}" # need to add yaml style escaping grep "^${1}:" "${ingestlog}" | cut -d: -f2- | sed 's/ //g' else @@ -284,7 +284,7 @@ check_emailaddress(){ } _get_duration(){ - ffduration=$(ffprobe "$1" -show_format -pretty 2> /dev/null | grep duration= | cut -d= -f2) + ffduration=$(ffprobe "${1}" -show_format -pretty 2> /dev/null | grep duration= | cut -d= -f2) } email_delivery(){ @@ -320,7 +320,7 @@ Enjoy!" | sendmail -f "${EMAIL_FROM}" -F "${emailto}" "${emailto}" _deliver_output(){ # argument 1 if used should be the email to report delivery to - emailto="$1" + emailto="${1}" if [ "${deliverdir}" ] ; then echo DELIVERING OUTPUT ACTIVITED with "${deliverdir}" report -dt "Delivering ${output} to ${deliverdir}" @@ -390,8 +390,8 @@ _find_input (){ concatsource="" sourcefile="" isobject="" - [ -d "$1" ] && [ -d "$1/objects/service" ] && isobject="N" && sourcefile=$(find "$1/objects/service" -maxdepth 1 -mindepth 1 -type f \( -iname "*.mov" -o -iname "*.mxf" -o -iname "*.mp4" -o -iname "*.dv" -o -iname "*.mpeg" -o -iname "*.iso" \) ! -name ".*" | head -n 1) - [ -f "$1" ] && sourcefile="$1" + [ -d "${1}" ] && [ -d "$1/objects/service" ] && isobject="N" && sourcefile=$(find "$1/objects/service" -maxdepth 1 -mindepth 1 -type f \( -iname "*.mov" -o -iname "*.mxf" -o -iname "*.mp4" -o -iname "*.dv" -o -iname "*.mpeg" -o -iname "*.iso" \) ! -name ".*" | head -n 1) + [ -f "${1}" ] && sourcefile="${1}" [ ! "$sourcefile" ] && [ -d "$1/objects" ] && isobject="Y" && sourcefile=$(find "$1/objects" -maxdepth 1 -mindepth 1 -type f \( -iname "*.mov" -o -iname "*.mxf" -o -iname "*.mp4" -o -iname "*.dv" -o -iname "*.mpeg" -o -iname "*.iso" \) ! -name ".*" | head -n 1) [ ! "$sourcefile" ] && { report -wt "A valid source file isn't found." ; exit 1 ;}; log+="sourcefile: ${sourcefile}\n" @@ -422,51 +422,51 @@ _find_input (){ } get_width(){ - width=$(ffprobe "$1" -show_streams -select_streams v:0 2> /dev/null | grep width= | cut -d = -f 2) + width=$(ffprobe "${1}" -show_streams -select_streams v:0 2> /dev/null | grep width= | cut -d = -f 2) } get_height(){ - height=$(ffprobe "$1" -show_streams -select_streams v:0 2> /dev/null | grep height= | cut -d = -f 2) + height=$(ffprobe "${1}" -show_streams -select_streams v:0 2> /dev/null | grep height= | cut -d = -f 2) } get_dar(){ - dar=$(ffprobe "$1" -show_streams -select_streams v:0 2> /dev/null | grep display_aspect_ratio= | cut -d = -f 2 | sed 's|:|/|g') + dar=$(ffprobe "${1}" -show_streams -select_streams v:0 2> /dev/null | grep display_aspect_ratio= | cut -d = -f 2 | sed 's|:|/|g') if [ "$dar" = "0/1" ] ; then - get_width "$1" - get_height "$1" + get_width "${1}" + get_height "${1}" dar="${width}/${height}" fi } get_sar(){ - sar=$(ffprobe "$1" -show_streams -select_streams v:0 2> /dev/null | grep sample_aspect_ratio= | cut -d = -f 2 | sed 's|:|/|g') + sar=$(ffprobe "${1}" -show_streams -select_streams v:0 2> /dev/null | grep sample_aspect_ratio= | cut -d = -f 2 | sed 's|:|/|g') if [ "$sar" = "0/1" ] ; then sar="1/1" fi } has_first_two_tracks_mono(){ - [ $(ffprobe 2>/dev/null "$1" -show_streams | grep -c "codec_type=audio") -ge 2 ] && \ - [ $(ffprobe 2>/dev/null "$1" -show_streams -select_streams a:0 | grep channels= | cut -d= -f2) = "1" ] && \ - [ $(ffprobe 2>/dev/null "$1" -show_streams -select_streams a:1 | grep channels= | cut -d= -f2) = "1" ] && \ + [ $(ffprobe 2>/dev/null "${1}" -show_streams | grep -c "codec_type=audio") -ge 2 ] && \ + [ $(ffprobe 2>/dev/null "${1}" -show_streams -select_streams a:0 | grep channels= | cut -d= -f2) = "1" ] && \ + [ $(ffprobe 2>/dev/null "${1}" -show_streams -select_streams a:1 | grep channels= | cut -d= -f2) = "1" ] && \ MULTIMONO=true } get_audio_index(){ # get ffmpeg's index value of the first audio stream. Useful for do custom channel mappings. - audio_index_1=$(ffprobe "$1" -show_streams -select_streams a:0 2> /dev/null | grep index= | cut -d = -f 2) - audio_index_2=$(ffprobe "$1" -show_streams -select_streams a:1 2> /dev/null | grep index= | cut -d = -f 2) + audio_index_1=$(ffprobe "${1}" -show_streams -select_streams a:0 2> /dev/null | grep index= | cut -d = -f 2) + audio_index_2=$(ffprobe "${1}" -show_streams -select_streams a:1 2> /dev/null | grep index= | cut -d = -f 2) } get_audio_channels(){ # get ffmpeg's channel count of the first audio stream. - audio_channels=$(ffprobe "$1" -show_streams -select_streams a 2> /dev/null | grep channels= | cut -d = -f 2 | head -n 1) + audio_channels=$(ffprobe "${1}" -show_streams -select_streams a 2> /dev/null | grep channels= | cut -d = -f 2 | head -n 1) } get_audio_mapping(){ - get_audio_index "$1" - get_audio_channels "$1" - has_first_two_tracks_mono "$1" + get_audio_index "${1}" + get_audio_channels "${1}" + has_first_two_tracks_mono "${1}" if [[ "${MULTIMONO}" == true ]] ; then report -wt "The first two audio tracks are both mono. Considering track 1 for left and track 2 for right." audiomapping_ffmpeg=(-map_channel "0.${audio_index_1}.0" -map_channel "0.${audio_index_2}.0") @@ -479,36 +479,36 @@ get_audio_mapping(){ } get_codectagstring(){ - codec_tag_string=$(ffprobe "$1" -show_streams -select_streams v:0 2> /dev/null | grep codec_tag_string= | cut -d = -f 2) + codec_tag_string=$(ffprobe "${1}" -show_streams -select_streams v:0 2> /dev/null | grep codec_tag_string= | cut -d = -f 2) if [ "$codec_tag_string" = "FFV1" ] ; then - ffv1_version=$(ffmpeg -debug 1 -i "$1" -t 0.1 -f null - &1 | grep -o "ver:[0-9]*" | tail -n1 | cut -d: -f2) + ffv1_version=$(ffmpeg -debug 1 -i "${1}" -t 0.1 -f null - &1 | grep -o "ver:[0-9]*" | tail -n1 | cut -d: -f2) else ffv1_version="" fi } get_fieldorder(){ - fieldorder=$(ffprobe-bc "$1" -show_streams 2> /dev/null | grep "\(progressive\|interlaced=\)" | cut -d = -f 2) + fieldorder=$(ffprobe-bc "${1}" -show_streams 2> /dev/null | grep "\(progressive\|interlaced=\)" | cut -d = -f 2) } get_pix_fmt(){ - pixfmt=$(ffprobe "$1" -show_streams -select_streams v:0 2> /dev/null | grep pix_fmt= | cut -d = -f 2) + pixfmt=$(ffprobe "${1}" -show_streams -select_streams v:0 2> /dev/null | grep pix_fmt= | cut -d = -f 2) } get_duration(){ - DURATION=$(ffprobe "$1" -show_format 2> /dev/null | grep duration= | cut -d = -f 2) + DURATION=$(ffprobe "${1}" -show_format 2> /dev/null | grep duration= | cut -d = -f 2) } get_videostreamcount(){ - VIDEOSTREAMCOUNT=$(ffprobe "$1" -select_streams v -show_entries stream=index -of flat 2>/dev/null | awk 'END { print NR }') + VIDEOSTREAMCOUNT=$(ffprobe "${1}" -select_streams v -show_entries stream=index -of flat 2>/dev/null | awk 'END { print NR }') } get_audiostreamcount(){ - AUDIOSTREAMCOUNT=$(ffprobe "$1" -select_streams a -show_entries stream=index -of flat 2>/dev/null | awk 'END { print NR }') + AUDIOSTREAMCOUNT=$(ffprobe "${1}" -select_streams a -show_entries stream=index -of flat 2>/dev/null | awk 'END { print NR }') } _get_timecode(){ - TIMECODE=$(ffprobe "$1" -select_streams v -show_streams -of flat 2>/dev/null | grep timecode=\"[0-9] | cut -d = -f 2 | sed 's/"//g') + TIMECODE=$(ffprobe "${1}" -select_streams v -show_streams -of flat 2>/dev/null | grep timecode=\"[0-9] | cut -d = -f 2 | sed 's/"//g') } _get_timecode_overlay(){ @@ -522,7 +522,7 @@ _get_timecode_overlay(){ } get_maxdvdbitrate(){ - get_duration "$1" + get_duration "${1}" local DVDCAPACITY=33840000000 # in bits, minus 10% local CAPDVDBITRATE=6000000 # in bits/second MAXDVDBITRATE=$(echo "($DVDCAPACITY - ( $DURATION * 224000 )) / $DURATION" | bc) @@ -538,7 +538,7 @@ get_maxdvdbitrate(){ is_video(){ # use ffmpeg's index value and stream specifier to determine if the input is a recognized as a video file by ffmpeg - ffprobe "$1" -show_streams -select_streams v:0 2> /dev/null | grep "index=" + ffprobe "${1}" -show_streams -select_streams v:0 2> /dev/null | grep "index=" } get_volume_adjustment(){ @@ -548,7 +548,7 @@ get_volume_adjustment(){ voldet_mean_volume="" voldet_max_volume="" VOLADJ="" - input_movie="$1" + input_movie="${1}" report -dt "Getting volume data for $(basename "${input_movie}") ..." VOLDETTEMP=$(maketemp) volume_data=$(ffprobe -of compact=p=0:nk=1:s=',' -show_entries frame_tags=lavfi.r128.I,lavfi.r128.LRA -f lavfi "amovie='${input_movie}',ebur128=metadata=1,volumedetect" 2>"${VOLDETTEMP}") @@ -579,7 +579,7 @@ get_volume_adjustment(){ } get_cropdetection(){ - input_movie="$1" + input_movie="${1}" report -dt "Getting cropping data for $(basename "$input_movie") ..." crop_data=$(ffmpeg -i "${input_movie}" -an -vf cropdetect -f null - 2>&1 | grep -o "crop=[0-9:]*") crop_err="$?" @@ -592,7 +592,7 @@ get_cropdetection(){ free_space(){ #this should give the free space in gigabytes - local space="$1" #This value represents the space in gigabytes required for the script to run + local space="${1}" #This value represents the space in gigabytes required for the script to run local outputdir="$2" [ ! -d "$outputdir" ] && { report -wt "The output directory [$outputdir] that free-space function is seeking does not exist." ; exit 1 ;}; [[ ! $space =~ ^-?[0-9]+$ ]] && { report -wt "Number is not an integer." ; exit 1 ;}; @@ -610,7 +610,7 @@ _summarize_make(){ _prep_ffmpeg_log(){ if [ "${logdir}" != "" ] ; then _mkdir2 "${logdir}" - export FFREPORT="file=${logdir}/%p_%t_$(basename "$0")_${version}.txt" + export FFREPORT="file=${logdir}/%p_%t_$(basename "${0}")_${version}.txt" inputoptions+=(-v info) inputoptions+=(-hide_banner) inputoptions+=(-stats) diff --git a/mmupdate b/mmupdate index 5922c009..7076b968 100755 --- a/mmupdate +++ b/mmupdate @@ -2,8 +2,8 @@ # mmupdate # This script is only intended for use with computers that are not connceted to the internet to access github but need to efficiently install updates of mediamicroservices. A local path is setup via mmconfig and running 'mmupdate' will copy relavent files from that declared directory, $LOCAL_MM_DIR, to /usr/local/bin. -scriptdir=`dirname "$0"` -. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; +scriptdir=`dirname "${0}"` +. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;}; [ -z "${LOCAL_MM_DIR}" ] && { echo "A local directory of mediamicoservice must be declared. Run mmconfig to set LOCAL_MM_DIR." ; exit 1 ;}; [ ! -d "${LOCAL_MM_DIR}" ] && { echo "mmupdate is configured to use $LOCAL_MM_DIR, which is not available. Run mmconfig to set LOCAL_MM_DIR." ; exit 1 ;}; diff --git a/paperingest b/paperingest index b8f97c19..86068331 100755 --- a/paperingest +++ b/paperingest @@ -1,8 +1,8 @@ #!/bin/bash requireconfig="Y" -scriptdir=$(dirname "$0") -. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; +scriptdir=$(dirname "${0}") +. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;}; cleanup(){ _log -a "Process aborted" diff --git a/quickcompare b/quickcompare index 03f375e5..75f6c5a1 100755 --- a/quickcompare +++ b/quickcompare @@ -2,8 +2,8 @@ checksize=512000 # quick file compare, not completely authoritative but decent in a short amount of time -scriptdir=$(dirname "$0") -. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; +scriptdir=$(dirname "${0}") +. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;}; cleanup(){ _log -a "Process aborted" @@ -14,8 +14,8 @@ trap cleanup SIGHUP SIGINT SIGTERM _log -b [ ! "$#" = "2" ] && { echo Use two possibly similar files are arguments. ; exit 1 ;}; -#[ ! $(du "$1" | cut -f1) = $(du "$2" | cut -f1) ] && echo The files are different sizes -[ ! $(head -c "$checksize" "$1" | md5) = $(head -c "$checksize" "$2" | md5) ] && echo The first "$checksize" bytes have different md5s. -[ ! $(tail -c "$checksize" "$1" | md5) = $(tail -c "$checksize" "$2" | md5) ] && echo The last "$checksize" bytes have different md5s. +#[ ! $(du "${1}" | cut -f1) = $(du "$2" | cut -f1) ] && echo The files are different sizes +[ ! $(head -c "$checksize" "${1}" | md5) = $(head -c "$checksize" "$2" | md5) ] && echo The first "$checksize" bytes have different md5s. +[ ! $(tail -c "$checksize" "${1}" | md5) = $(tail -c "$checksize" "$2" | md5) ] && echo The last "$checksize" bytes have different md5s. _log -e diff --git a/removeDSStore b/removeDSStore index 5251829f..aa014269 100755 --- a/removeDSStore +++ b/removeDSStore @@ -1,8 +1,8 @@ #!/bin/bash # @author Dave Rice -scriptdir=$(dirname "$0") -. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; +scriptdir=$(dirname "${0}") +. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;}; cleanup(){ _log -a "Process aborted" @@ -12,7 +12,7 @@ cleanup(){ trap cleanup SIGHUP SIGINT SIGTERM _log -b -while [ "$*" != "" ] ; do +while [ "${*}" != "" ] ; do target=$1 if [ -d "$target" ]; then find "$target" -name '.DS_Store' -type f -delete diff --git a/restructureForCompliance b/restructureForCompliance index 011fcffe..638f25eb 100755 --- a/restructureForCompliance +++ b/restructureForCompliance @@ -21,8 +21,8 @@ # @author Joseph Perry # @version svn: $Id: 9e1ecac84215aaafd740d15eb0cbdc4c17b7fa1e $ -scriptdir=$(dirname $(which "$0")) -. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; +scriptdir=$(dirname $(which "${0}")) +. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;}; target="${1}" diff --git a/uploadomneon b/uploadomneon index 1592bbb1..63fad9a7 100755 --- a/uploadomneon +++ b/uploadomneon @@ -5,12 +5,12 @@ requireconfig="Y" version="1.0" -scriptdir=$(dirname "$0") -. "$scriptdir/mmfunctions" || { echo "Missing '$scriptdir/mmfunctions'. Exiting." ; exit 1 ;}; +scriptdir=$(dirname "${0}") +. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;}; usage(){ echo - echo "$(basename ${0}) ${version}" + echo "$(basename "${0}") ${version}" echo "This application will upload file(s) to a server via rsync in sequential order. Options are specified via 'mmconfig'." echo echo "Settings:" @@ -30,7 +30,7 @@ cleanup(){ } get_ftp_status(){ -local filename="$1" +local filename="${1}" status=$(ftp -a "$OMNEONIP" <