#!/bin/bash # I, Ian Kelling, follow the GNU license recommendations at # https://www.gnu.org/licenses/license-recommendations.en.html. They # recommend that small programs, < 300 lines, be licensed under the # Apache License 2.0. This file contains or is part of one or more small # programs. If a small program grows beyond 300 lines, I plan to switch # its license to GPL. # Copyright 2024 Ian Kelling # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. nav_tags=( ## cross-genre tags that dont really make a playlist expl # songs i like but they get old fast due to feeling gimicky, or cringy after a while. gimicky # anything sad which i sometimes like or avoid. sad ## playlists # intimate, love love # favorite songs pump up songs pump1 # favorite rap pump up songs, allows more songs than pump1 pumprap # heart rending, spine tickling rend # for running run ) pl_tags=( "${nav_tags[@]}" # alternate version of a song we already have which isn't as good lesser_version ) nav_convert_query="^genre:spoken-w ^genre:skit ^lesser_version:t rating:3..5" common_genres=( ambient # gangsta rap / angry rap. something like g-rap would make beet queries for genre:rap include it arp avant blues # slow instrumental. todo: reclassify some ambient into this. chill classical country # lyrical edm. todo: some pop needs reclassification to this dance # like power glove darkwave hardcore # nonvocal / instrumental nv latin metal # mq = mac quale. similar to the mr robot soundtracks. # slow, foreboding. usually electronic. mq pop rap rock # like rain by brian crain. mostly slow airy/broody piano sleep techno world ) # because we were destined to run out of single key buttons. rare_genres=( jazz musical noise skit spoken-w ) all_genres=(${common_genres[@]} ${rare_genres[@]}) #### playlist things ##### declare -A ignore_genres_a ignore_genres=( skit spoken-w ) declare -A slow_genres_a slow_genres=( ambient avant classical noise sleep mq jazz ) tags=( expl sad ) declare -A bpla # beet playlist associative array beetapl() { # beet add playlist local name name="$1" shift bpla[$name]="${*@Q}" } # this function is just so we can have some local vars # and not mess with the global var namespace. _beet-gen-global-vars() { local first g t r for g in ${ignore_genres[@]}; do ignore_genres_a[$g]=t done for g in ${slow_genres[@]}; do slow_genres_a[$g]=t done # genres that have a beat beat_genres=() genres=() # relatively upbeat genres to listen, eg while biking upbeat_genres=() for g in ${all_genres[@]}; do if [[ ${ignore_genres_a[$g]} ]]; then continue; fi genres+=($g) if [[ ${slow_genres_a[$g]} ]]; then continue; fi beat_genres+=($g) case $g in chill) continue ;; esac upbeat_genres+=($g) done # generate regex for beat playlist beat_regex= first=true for g in ${beat_genres[@]}; do if $first; then first=false beat_regex=$g else beat_regex+="|$g" fi done # generate regex for upbeat playlist upbeat_regex= first=true for g in ${upbeat_genres[@]}; do if $first; then first=false upbeat_regex=$g else upbeat_regex+="|$g" fi done for g in ${genres[@]}; do for r in {3..5}; do case $g in pop|rap) beetapl ${g}-${r} rating:${r}..5 genre::^$g\$ ^expl:t ^gimicky:t ^lesser_version:t beetapl ${g}-x-${r} rating:${r}..5 genre::^$g\$ ^gimicky:t ^lesser_version:t ;; *) beetapl ${g}-${r} rating:${r}..5 genre:$g ^gimicky:t ^lesser_version:t ;; esac done done for t in ${tags[@]}; do for r in {3..5}; do beetapl ${t}-${r} rating:${r}..5 $t:t ^lesser_version:t done done for r in {3..5}; do beetapl beat-${r} rating:${r}..5 genre::$beat_regex ^expl:t ^gimicky:t ^lesser_version:t beetapl beat-x-${r} rating:${r}..5 genre::$beat_regex ^gimicky:t ^lesser_version:t beetapl upbeat-${r} rating:${r}..5 genre::$upbeat_regex ^expl:t ^gimicky:t ^lesser_version:t ^sad:t beetapl upbeat-x-${r} rating:${r}..5 genre::$upbeat_regex ^gimicky:t ^lesser_version:t ^sad:t beetapl gimicky-${r} rating:${r}..5 gimicky:t ^lesser_version:t done for r in {3..5}; do beetapl \ sy$r rating:${r}..5 genre::$upbeat_regex ^gimicky:t ^lesser_version:t 'artist:sonic youth' done for t in ${nav_tags[@]}; do beetapl $t $t:t done } _beet-gen-global-vars