summaryrefslogtreecommitdiff
path: root/.local/bin/bbid_all_filters
blob: 578c5862a6f1f0a0e070cc130769d26b1afd10ac (plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

# Set up arrays with colors

read -p "Enter query: " query
read -p "Enter directory name: " dirname

dir=$(pwd)/$dirname
mkdir -pv $dirname/nofilter

echo "Bing image downloader will now download files from $query and place them in $dir"

colors=(
'BLACK'
'WHITE'
'BROWN'
'GRAY'
'RED'
'YELLOW'
'BLUE'
'ORANGE'
'GREEN'
'PURPLE'
'TEAL'
'PINK'
)

layouts=(
'sqaure'
'wide'
'tall'
)



mullvad reconnect
sleep 5
ping 8.8.8.8 c 3

echo "Now downloading with no filters."
notify-send "Now starting bing download."


bbid -s "$query" -o $dir/nofilter

pic_count=$(ls -l $dir/nofilter | wc -l)

notify-send "no_filter $query download finished. $pic_count files downloaded"

sleep 3

for color in "${colors[@]}"; do
	
	# Setup filter.
	
	filter=+filterui:color2-FGcls_${color}
	
	notify-send "Starting ${query} ${color} download..."
	
	# Tell bbid to download files
	ping 8.8.8.8 -c 3
	
	for i in 1 2 3 4 5; do
		bbid -s "${query}" -o $dir/${color} --filters $filter --adult-filter-off && break || sleep 5 
	done
		
	pic_count=$(ls -lR ${dir} | wc -l)
	notify-send "$query $color download finished. $pic_count files downloaded so far."
	
	espeak-ng "Download successful."

	# change ip address with VPN to mitigate throttling	
	mullvad reconnect
	sleep 10

done


notify -send "Download complete! $pic_count files downloaded."

exit 0

notify-send "Starting all colors all layouts download."

for layout in "${layout[@]}"; do
	for color in "${colors[@]}"; do
		# Setup filter.
		filter=+filterui:aspect-${layout}+filterui:color2-FGcls_${color}

		notify-send "Starting $query $layout $color download..."
	
		# Tell bbid to download files
		bbid -s ${query} -o $dir/${layout}/${color} --filters $filter
		
		pic_count=$(ls -lR ${dir} | wc -l)
		notify-send "$query $color download finished. $pic_count files downloaded."
		
		mullvad reconnect
		sleep 5
	done
done

notify-send "All done!"

# +filterui:aspect-$layout+filterui:color2-FGcls_$color&first=1