-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwatchdo
More file actions
executable file
·60 lines (45 loc) · 1.31 KB
/
watchdo
File metadata and controls
executable file
·60 lines (45 loc) · 1.31 KB
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
58
59
#!/bin/bash
# Watch dir, may contain spaces:
watchdir="/home/tom/Downloads"
# move file to a subdirectory? if Commented out, it'll removed remove
# the torrent file.
# Note: Don't put a '/' before the path!
#movesubdir="added/"
dwdir="/home/tom/torrent"
trdonesscript=""
# Authentication "username:password":
#tr_auth="admin:admin"
# Transmission host "ip:port":
# tr_host="127.0.0.1:9091"
# Verbose?
verbose=1
#############################################
time=$(date "+%Y-%m-%d (%H:%M:%S)")
if [ -n "$tr_auth" ]; then
tr_auth="--auth $tr_auth"
fi
#############################################
if [ -n "$trdonescript" ]; then
trdonescript="--torrent-done-script $trdonescript"
fi
#############################################
if [ -n "$dwdir" ]; then
dwdir="--download-dir $dwdir"
fi
#############################################
#############################################j
echo "$dwdir"
echo "$watchdir"/*.torrent | sed "s/ /\n/g"
# for debugging
for file in "$watchdir"/*.torrent
do
if [ -f "$file" ]; then
if [ -n "$verbose" ]; then echo "$time: $file added to queue."; fi
/usr/bin/transmission-remote --add "$file"
# give the remote some time to process
sleep 5
else
if [ -n "$verbose" ]; then echo "$time: No torrent in $watchdir."; fi
fi
done
exit 0