host info updates
[distro-setup] / beet-data
1 #!/bin/bash
2 # I, Ian Kelling, follow the GNU license recommendations at
3 # https://www.gnu.org/licenses/license-recommendations.en.html. They
4 # recommend that small programs, < 300 lines, be licensed under the
5 # Apache License 2.0. This file contains or is part of one or more small
6 # programs. If a small program grows beyond 300 lines, I plan to switch
7 # its license to GPL.
8
9 # Copyright 2024 Ian Kelling
10
11 # Licensed under the Apache License, Version 2.0 (the "License");
12 # you may not use this file except in compliance with the License.
13 # You may obtain a copy of the License at
14
15 # http://www.apache.org/licenses/LICENSE-2.0
16
17 # Unless required by applicable law or agreed to in writing, software
18 # distributed under the License is distributed on an "AS IS" BASIS,
19 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 # See the License for the specific language governing permissions and
21 # limitations under the License.
22
23
24 nav_tags=(
25 ## cross-genre tags that dont really make a playlist
26 expl
27 # songs i like but they get old fast due to feeling gimicky, or cringy after a while.
28 gimicky
29 # anything sad which i sometimes like or avoid.
30 sad
31
32 ## playlists
33 # intimate, love
34 love
35 # favorite songs pump up songs
36 pump1
37 # favorite rap pump up songs, allows more songs than pump1
38 pumprap
39 # heart rending, spine tickling
40 rend
41 # for running
42 run
43 )
44
45
46 pl_tags=(
47 "${nav_tags[@]}"
48 # alternate version of a song we already have which isn't as good
49 lesser_version
50 )
51
52 nav_convert_query="^genre:spoken-w ^genre:skit ^lesser_version:t rating:3..5"
53
54
55 common_genres=(
56 ambient
57 # gangsta rap / angry rap. something like g-rap would make beet queries for genre:rap include it
58 arp
59 avant
60 blues
61 # slow instrumental. todo: reclassify some ambient into this.
62 chill
63 classical
64 country
65 # lyrical edm. todo: some pop needs reclassification to this
66 dance
67 # like power glove
68 darkwave
69 hardcore
70 # nonvocal / instrumental
71 nv
72 latin
73 metal
74 # mq = mac quale. similar to the mr robot soundtracks.
75 # slow, foreboding. usually electronic.
76 mq
77 pop
78 rap
79 rock
80 # like rain by brian crain. mostly slow airy/broody piano
81 sleep
82 techno
83 world
84 )
85
86 # because we were destined to run out of single key buttons.
87 rare_genres=(
88 jazz
89 musical
90 noise
91 skit
92 spoken-w
93 )
94
95 all_genres=(${common_genres[@]} ${rare_genres[@]})
96
97
98
99 #### playlist things #####
100
101
102 declare -A ignore_genres_a
103 ignore_genres=(
104 skit
105 spoken-w
106 )
107
108 declare -A slow_genres_a
109 slow_genres=(
110 ambient
111 avant
112 classical
113 noise
114 sleep
115 mq
116 jazz
117 )
118
119
120 tags=(
121 expl
122 sad
123 )
124
125 declare -A bpla # beet playlist associative array
126 beetapl() { # beet add playlist
127 local name
128 name="$1"
129 shift
130 bpla[$name]="${@@Q}"
131 }
132
133
134 # this function is just so we can have some local vars
135 # and not mess with the global var namespace.
136 _beet-gen-global-vars() {
137
138 local first g t r
139
140 for g in ${ignore_genres[@]}; do
141 ignore_genres_a[$g]=t
142 done
143 for g in ${slow_genres[@]}; do
144 slow_genres_a[$g]=t
145 done
146
147 # genres that have a beat
148 beat_genres=()
149 genres=()
150
151
152 # relatively upbeat genres to listen, eg while biking
153 upbeat_genres=()
154 for g in ${all_genres[@]}; do
155 if [[ ${ignore_genres_a[$g]} ]]; then continue; fi
156 genres+=($g)
157 if [[ ${slow_genres_a[$g]} ]]; then continue; fi
158 beat_genres+=($g)
159 case $g in
160 chill)
161 continue
162 ;;
163 esac
164 upbeat_genres+=($g)
165 done
166
167 # generate regex for beat playlist
168 beat_regex=
169 first=true
170 for g in ${beat_genres[@]}; do
171 if $first; then
172 first=false
173 beat_regex=$g
174 else
175 beat_regex+="|$g"
176 fi
177 done
178
179 # generate regex for upbeat playlist
180 upbeat_regex=
181 first=true
182 for g in ${upbeat_genres[@]}; do
183 if $first; then
184 first=false
185 upbeat_regex=$g
186 else
187 upbeat_regex+="|$g"
188 fi
189 done
190
191
192 for g in ${genres[@]}; do
193 for r in {3..5}; do
194 case $g in
195 pop|rap)
196 beetapl ${g}-${r} rating:${r}..5 genre::^$g\$ ^expl:t ^gimicky:t ^lesser_version:t
197 beetapl ${g}-x-${r} rating:${r}..5 genre::^$g\$ ^gimicky:t ^lesser_version:t
198 ;;
199 *)
200 beetapl ${g}-${r} rating:${r}..5 genre:$g ^gimicky:t ^lesser_version:t
201 ;;
202 esac
203 done
204 done
205
206 for t in ${tags[@]}; do
207 for r in {3..5}; do
208 beetapl ${t}-${r} rating:${r}..5 $t:t ^lesser_version:t
209 done
210 done
211
212 for r in {3..5}; do
213 beetapl beat-${r} rating:${r}..5 genre::$beat_regex ^expl:t ^gimicky:t ^lesser_version:t
214 beetapl beat-x-${r} rating:${r}..5 genre::$beat_regex ^gimicky:t ^lesser_version:t
215 beetapl upbeat-${r} rating:${r}..5 genre::$upbeat_regex ^expl:t ^gimicky:t ^lesser_version:t ^sad:t
216 beetapl upbeat-x-${r} rating:${r}..5 genre::$upbeat_regex ^gimicky:t ^lesser_version:t ^sad:t
217 beetapl gimicky-${r} rating:${r}..5 gimicky:t ^lesser_version:t
218 done
219
220 for r in {3..5}; do
221 beetapl \
222 sy$r rating:${r}..5 genre::$upbeat_regex ^gimicky:t ^lesser_version:t 'artist:sonic youth'
223 done
224
225 for t in ${nav_tags[@]}; do
226 beetapl $t $t:t
227 done
228 }
229 _beet-gen-global-vars