Skip to content

Instantly share code, notes, and snippets.

@phuongdh
Created August 1, 2016 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phuongdh/7d7d24e49a2d59cbaf2da695ca40c0cc to your computer and use it in GitHub Desktop.
Save phuongdh/7d7d24e49a2d59cbaf2da695ca40c0cc to your computer and use it in GitHub Desktop.
Run this on AMS dir
#!/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