-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.sh
executable file
·58 lines (42 loc) · 1.23 KB
/
server.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#! /bin/bash
#The server script manages the FTP server and coordinates the files
# Before this may be executed the FTP server has to setup
# /$CLIENT_FILES/ffmpegflags.txt
#Directory to scan for videos to encode relative to FTP root directory
SCAN_DIR=("Movies" "TV shows" "Recently Added")
TARGET_FILES=("avi" "mkv" "mp4")
CLIENT_FILES="clients"
FTP_USER="client"
FTP_PASS="clientpass"
FTP_SERVER="10.0.0.117"
# Get video information
# ffmpeg -i video.avi
mkdir enc_ftp
#Mount the FTP in the script directory
umount enc_ftp
curlftpfs $FTP_USER:$FTP_PASS@$FTP_SERVER enc_ftp/
#Index the whole ftp server
#If a file is found which isn't x265 then it's added to the queue
#and the new file will replace it's current position and delete the old file
# unless an error occured with encoding, incase a list of faulty videos will
# be produced
while :
do
echo "Cleaning working directories"
rm -f work.txt
echo "Scanning Directories"
cd enc_ftp
for dir in "${SCAN_DIR[@]}"
do
for ext in "${TARGET_FILES[@]}"
do
# Check will use ffmpeg to check the format and append it to
# word.txt
echo "searching for $ext"
find . -type f -name "*.$ext" -exec ./../check.sh {} \;
done
done
cd ..
./continue_serving.sh
done
umount enc_ftp