forked from obi12341/docker-pyload
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test-link.sh
executable file
·56 lines (51 loc) · 1002 Bytes
/
test-link.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
#!/bin/sh
set -euf
CONTAINER=$(docker run -d -v $PWD/test/downloads:/opt/pyload/Downloads -P pyload)
RET=0
URL=$1
pyLoadCli(){
docker exec -i $CONTAINER /opt/pyload/pyLoadCli.py "$@"
}
trap 'docker logs $CONTAINER;docker stop $CONTAINER;exit $RET' INT TERM EXIT
sleep 5
log(){
echo "$(date +%H:%M:%S) " "$@"
}
log "Sleeping ... "
log "Adding: $URL"
pyLoadCli add "Test" "$URL"
while true;do
data=$(pyLoadCli queue)
case "$data" in
*"queued"*"XDCC"*)
log "Queued"
;;
*"connect"*"XDCC"*)
log "Connecting"
;;
*"waiting"*"XDCC"*)
log "Waiting"
;;
*"downloading"*"XDCC"*)
log $(pyLoadCli status | grep Downloading)
;;
*"failed"*"XDCC"*)
log "Download Failed!"
RET=1
break
;;
*"finished"*"XDCC"*)
log "Download finished"
RET=0
break
;;
*)
log "something weird happened:"
log "$data"
pyLoadCli status
RET=1
break
;;
esac
sleep 5
done