Skip to content

Commit

Permalink
Update mmfunctions
Browse files Browse the repository at this point in the history
updated "# find av files in a directory and output to a temp list;" if function not working properly. variables comprising an empty string or strings with spaces need to be cast as 0 integers.
  • Loading branch information
agarrkoch authored Mar 25, 2024
1 parent 1201820 commit 229fa28
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mmfunctions
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,21 @@ _find_input (){
find "${LOOKHERE}" -type f -size +0 "${OBJECTS_FIND_EXCLUSIONS[@]}" | sort | while read file ; do
streamcount=$(ffprobe -loglevel quiet "$file" -show_entries format=nb_streams -of default=nw=1:nk=1)
duration_ts=$(ffprobe -loglevel quiet "$file" -show_entries stream=duration_ts -of default=nw=1:nk=1)

# Remove trailing spaces
streamcount="${streamcount#"${streamcount%%[![:space:]]*}"}"
streamcount="${streamcount%"${streamcount##*[![:space:]]}"}"
duration_ts="${streamcount#"${streamcount%%[![:space:]]*}"}"
duration_ts="${streamcount%"${streamcount##*[![:space:]]}"}"

# Cast empty value into 0 integer
if [ -z "$streamcount" ]; then
streamcount=0
fi
if [ -z "$duration_ts" ]; then
duration_ts=0
fi

if [[ "$streamcount" > 0 && "${duration_ts}" != 1 ]] ; then
_report -d "Input file: $file"
echo "$file" >> "${INPUTFILES}"
Expand Down

0 comments on commit 229fa28

Please sign in to comment.