Skip to content

Instantly share code, notes, and snippets.

@cjcolvar
Last active December 26, 2015 22:59
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cjcolvar/7227153 to your computer and use it in GitHub Desktop.
Cronjob script for finding mp4 files in a directory then exporting and stripping chapters for compatibility with Adobe Media Server
#!/bin/bash
lockdir=~/
searchdir=$1
if [ -e ${lockdir}/.stripChaptersCronJob.lock ]
then
exit
fi
touch ${lockdir}/.stripChaptersCronJob.lock
touch ${searchdir}/.stripChaptersCronJob.timestamp.2
if [ -e ${searchdir}/.stripChaptersCronJob.timestamp ]
then
filelist=`find ${searchdir} -type f -newer ${searchdir}/.stripChaptersCronJob.timestamp -name '*.mp4'`
else
filelist=`find ${searchdir} -type f -name '*.mp4'`
fi
mv ${searchdir}/.stripChaptersCronJob.timestamp.2 ${searchdir}/.stripChaptersCronJob.timestamp
for file in $filelist
do
if [ `mp4chaps -l $file 2> /dev/null | wc -l` -gt 1 ]
then
mp4chaps -q -x -C $file
mp4chaps -q -r $file
fi
done
rm ${lockdir}/.stripChaptersCronJob.lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment