Add files via upload

This commit is contained in:
12nick12 2017-06-13 12:06:21 -04:00 committed by GitHub
parent 28c62ae981
commit cb2d57c845
2 changed files with 43 additions and 0 deletions

6
README Normal file
View File

@ -0,0 +1,6 @@
This script is linux only based in bash. It's needs find, , sed, sickbeard_mp4_automator and all of it's dependencies.
To use the script you /location/to/script/run.sh "location" extension_without_period amount_of_files
You can specify the amount of files or "a" for all of them.

37
run.sh Normal file
View File

@ -0,0 +1,37 @@
#!/bin/bash
sicklocation="/opt/sickbeard_mp4_automator/manual.py" #Location of sickbeard_mp4_automator
tsdate="/root/scripts/rawhdconvert/ts.$(date +'%Y%m%d')" #Create current date and time
tsdatec=$tsdate # Not sure why I did this
ts="/root/scripts/rawhdconvert/ts" # location of ts. TS is the temp file that holds files to be converted
location="$1" # Folder you want to search in
type="$2" # File extension without the . of what you want to be converted
num="$3" # Amount of files you want to be converted
EMAIL_TO="email@site.net" # Where you want it to email when done being converted
function run {
sed -i 's#^#python '$sicklocation' -i "#' $ts
sed -i 's#$#" -a#' $ts
date +'%Y%m%d_%H%M' >> $tsdate
find "$location" -iname "*."$type"" -type f -exec du -hsc {} + | tail -1 >> $tsdate
cat $ts >> $tsdate
chmod +x $ts
sh $ts
rm $ts
find "$location" -iname "*."$type"" -type f -exec du -hsc {} + | tail -1 >> $tsdate
date +'%Y%m%d_%H%M' >> $tsdatec
echo "Finished Converting" | mutt -a "$tsdate" -s "Finished Converting" -- "$EMAIL_TO"
}
if [ -f $ts ]
then
echo "Already Running"
else
if [ $num == "a" ]
then
find "$location" -iname "*."$type"" -type f >> $ts
run
else
find "$location" -iname "*."$type"" -type f | tail -$num >> $ts
run
fi
fi