Fixed deleting, added path
This commit is contained in:
@@ -1,24 +1,27 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail #x for debug
|
set -euo pipefail #x for debug
|
||||||
|
|
||||||
while getopts i:d:D: flag
|
while getopts i:d:D:o: flag
|
||||||
do
|
do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
i) input_folder=${OPTARG};;
|
i) input_folder=${OPTARG};;
|
||||||
d) days=${OPTARG};;
|
d) days=${OPTARG};;
|
||||||
D) delete=${OPTARG};;
|
D) delete=${OPTARG};;
|
||||||
|
o) output_path=${OPTARG};;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if ! [[ -v input_folder ]] || ! [[ -v days ]] || ! [[ -v delete ]]
|
if ! [[ -v input_folder ]] || ! [[ -v days ]] || ! [[ -v delete ]] || ! [[ -v output_path ]]
|
||||||
then
|
then
|
||||||
echo "Arguments missing. Use -i for input folder, -D to define if you want to delete processed images and -d for number of days"
|
echo "Arguments missing. Use -i for input folder, -D to define if you want to delete processed images and -d for number of days"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [[ delete=="true" ]]
|
if [ $delete == "true" ]
|
||||||
then
|
then
|
||||||
echo "WARNING old files will be deleted"
|
echo "WARNING old files will be deleted"
|
||||||
|
else
|
||||||
|
echo NO DELETO
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@@ -43,17 +46,20 @@ do
|
|||||||
month=$(date -d "now - $days days" +%m)
|
month=$(date -d "now - $days days" +%m)
|
||||||
year=$(date -d "now - $days days" +%Y)
|
year=$(date -d "now - $days days" +%Y)
|
||||||
echo "Working on" $day $month $year
|
echo "Working on" $day $month $year
|
||||||
if [[ delete!="true" ]]
|
if ! [ $delete == "true" ]
|
||||||
then
|
then
|
||||||
|
echo Not deleting
|
||||||
cp $input_folder/Frame_${year}-${month}-${day}*.jpg ./timelapse_temp
|
cp $input_folder/Frame_${year}-${month}-${day}*.jpg ./timelapse_temp
|
||||||
else
|
else
|
||||||
echo "NOT YET IMPLEMENTED"
|
echo DELETING FILES
|
||||||
|
mv $input_folder/Frame_${year}-${month}-${day}*.jpg ./timelapse_temp
|
||||||
fi
|
fi
|
||||||
days=$(($days - 1))
|
days=$(($days - 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
echo Output: $out_name
|
echo Output: $out_name
|
||||||
ffmpeg -r 25 -pattern_type glob -i "./timelapse_temp/*.jpg" -s 1920x1080 -vcodec libx264 -crf 23 ${out_name}
|
mkdir -p ${output_path}
|
||||||
|
ffmpeg -r 25 -pattern_type glob -i "./timelapse_temp/*.jpg" -s 1920x1080 -vcodec libx264 -preset veryfast -crf 25 ${output_path}/${out_name}
|
||||||
|
|
||||||
rm -rf ./timelapse_temp
|
rm -rf ./timelapse_temp
|
||||||
Reference in New Issue
Block a user