summaryrefslogtreecommitdiff
path: root/bin/tracker-feed
blob: 7f1b6604100104f37b37c50336646d9b1c43484e (about) (plain) (blame)
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
#!/usr/bin/env bash
[ "$#" -gt 0 ] || {
	echo "tracker-feed projectA [projectB]*" >&2
	exit 1
}


while :; do
SID="$(curl --data '' --silent http://tracker.archiveteam.org:8080/socket.io/1/ | cut --delimiter : --fields 1)"
{
	for project; do
		printf '1::/%s-log' "$project"
	done
	sleep 3s
	while true; do
		printf '2::'
		sleep 45s
	done
} |
websocat \
	--no-fixups \
	--async-stdio \
	--text \
	--strict \
	- \
	msg2line:ws://tracker.archiveteam.org:8080/socket.io/1/websocket/"$SID"
done |
jq \
	--unbuffered \
	--raw-input \
	--compact-output \
	--monochrome-output \
	'.
| split(":")
| select(.[0]=="5")
| .[3:]
| join(":")
| fromjson
| select(.name=="log_message")
| .args[0]
| fromjson
'