#!/bin/bash

day=$(date +%m%d)

function read_dir(){
for file in `ls $1`
do
        if [ -d $1"/"$file ]
        then
                read_dir $1"/"$file
        else
		raw=$1"/"$file
		real=${raw%.m*}"_sexkbj.mp4"
		# `ffmpeg -i $raw -vf drawtext="fontsize=20:fontfile=Helvetica.ttf:text='Test':x=40:y=30:fontcolor=white" -crf 27 -preset vertfast $real`
		`ffmpeg -i $raw -i ~/landscape.png -filter_complex 'overlay=18:18' -crf 27 -preset veryfast $real`
		#`python3 ~/complete.py $file`
		`rm $raw`
		#`setsid rclone copy $real gd:Processed/$day/ >/dev/null 2>&1`
        fi
done
}

read_dir $1
`python3 ~/complete.py "AMD3 Mission Complete!!!!!!!!"`
