Cronjob script for finding mp4 files in a directory then exporting and stripping chapters for compatibility with Adobe Media Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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