-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrapper
27 lines (26 loc) · 755 Bytes
/
wrapper
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
#!/bin/bash
HOME=/home/$USER
# if invoked by the webui
if [ $1 = "webui" ]; then
if [ $2 = "reset" ]; then
if [ -d "$3" ]; then
rm -rf "$3/.uploading"
rm -rf "$3/.uploaded"
rm -rf "$3/.uploaderror"
fi
elif [ $2 = "hide" ]; then
if [ -d "$3" ] && [ ! -d "$3/.hidden" ]; then
mkdir "$3/.hidden"
fi
else
if [ -n "$5" ] && [[ $5 =~ ^[0-9]*$ ]] && [ $5 -ge 15 ] && [ $5 -le 28 ]; then
upload -y $5 -r "$2" -c "$3" "$4" >/dev/null 2>&1 &
else
upload -r "$2" -c "$3" "$4" >/dev/null 2>&1 &
fi
fi
# if invoked by rtorrent
elif [ $1 = "rtorrent" ]; then
cd "$HOME/upload"
upload -z $2 "$3" >/dev/null 2>&1 &
fi