summaryrefslogtreecommitdiffstats
path: root/.local/bin/rechin
blob: 9c30c396213635a2fccddaedf891b8b089521f16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

application="gallery-dl"
site="boards.4chan.org"
site_domain="$(echo $site | cut -f2 -d.)"

if [ ! -d "$PWD/$application" ] && [ ! -d "$PWD/$application/$site_domain" ]; then
    echo "Directories to read from are missing, exiting."
    exit 0
fi

for board in $(ls $application/$site_domain/)
do
	loop_count=1
	total_count=$(ls $application/$site_domain/$board | wc -l)
	for thread in $(ls $application/$site_domain/$board | cut -f1 -d" " | tac)
	do
		$application "https://$site/$board/thread/$thread"
		printf "\nLoop count: %s/%s\n" "$loop_count" "$total_count"
		loop_count=$(expr $loop_count + 1)
	done
done