+++ /dev/null
-# if a gem fails on documentation, uncomment this.
-# gem: --no-document
cat <<'EOF'
-y other genres z fg player ' = toggle play 1-5 rate ] repeat1
+y other genres z fg player ' = toggle autoplay 1-5 rate ] repeat1
; previous ) delete j/k skip mpv_keys vol,pause,seek
EOF
hr
It lists/plays the query, reads an input char for tagging one by one.
-note, you may want to change the play command for doing rapid taging
+note: you may want to change the play command for doing rapid taging
by immediately jumping forward into the song. this is set in the beets
config yaml.
-(available buttons: ` _ ] [ and non-printing chars, see
+available buttons:
+ * ` _ ] [
+ * ' (autoplay), I've never used it so it could just be a cli option.
+ * non-printing chars, see
https://stackoverflow.com/questions/10679188/casing-arrow-keys-in-bash
+
note: after foregrounding the player, must quit it to get back. can't ctrl-c.
keys I dont need help to remember:
source /a/bin/ds/beet-data
# state vars altered by user input:
- local char do_rare_genres last_genre_i doplay=true repeat1=false
+ local char do_rare_genres last_genre_i autoplay=true repeat1=false
local -i volume=70 read_wait=2 j=0
local -a button_map
local -A button_i
beetag-help
printf "██ %s\n" "$ls_out"
beetag-nostatus 1
- if $doplay; then
+ if $autoplay; then
if $first_play; then first_play=false; mpvrpc-wait-idle; fi
mpvrpc-loadfile "$path"
erasable_line=false
while true; do
char=
- if $doplay; then
+ if $autoplay; then
ret=0
read -rsN1 -t $read_wait char || ret=$?
read_wait=2
break
;;
"'")
- if $doplay; then
- echo "play toggled off"
- doplay=false
+ if $autoplay; then
+ echo "autoplay toggled off"
+ autoplay=false
else
- doplay=true
+ autoplay=true
mpvrpc-loadfile "$path"
erasable_line=false
fi
umask $umask_orig
}
+# Dedupe a project with several node_modules dirs for the purpose of
+# license scanning. Dedupe is by directory name, not worried about
+# versions for a simple license scan.
+dedup-node-modules() {
+ mkdir -p ../deduped
+ for d in $(find . -type d -name node_modules | perl -e 'print sort {length $b <=> length $a} <>'); do for mod in $d/*; do [[ -d $mod ]] || rm $mod; n="${m##*/}"; if [[ -d ../deduped/$n ]]; then rm -r $mod; else mv $mod ../deduped; fi; done; done
+ cd ../deduped
+ # for each dir that has a min.js file, compare char count of min.js
+ # files vs char count of files with just .js or .ts, etc. If minified
+ # is bigger, then flag it by doing an ls.
+ for d in $(find -type f -name '*.min.js'|sed -r 's,^./,,;s,/.*$,,' | sort -u); do a=$(cat $(find $d -name '*.min.js')|wc -c); b=$(cat $(find $d -type f \! -name '*.min.js' \( -name '*.js' -o -name '*.ts' -o -name '*.mjs' -o -name '*.tsx' -o -name '*.cts' -o -name '*.mts \)') | wc -c); if ! uintp "$a" "$b"; then e "uint $a, $b"; continue; fi; if (( a < b )); then find $d -name '*.min.js' -delete; else m ll $d; fi; done
+ #time /t/sc/scancode --info --classify --only-findings --max-in-memory 300000 -clpue --unknown-licenses --tallies --tallies-with-details --summary --generated --json-pp scan.json .
+ }
# * stuff that makes sense to be at the end
# shellcheck disable=SC1091 # may not exist, & third party
[[ -s "$NVM_DIR/bash_completion" ]] && source "$NVM_DIR/bash_completion" # This loads nvm bash_completion
}
+ # the nvm docs say: to update, rerun the curl|bash install
+ # script. Then later it says "the install script basically just clones
+ # the repo", wow, what a horribly gratuitous use of curl|bash.
+ nvm-update() {
+ cd ~/.nvm
+ git pull
+ }
fi
export I2X_SORT_ORDER=path_desc
unset -f err-cleanup
}
-# beetag: error: no result from beet ls totag:t
-# [1] 711197
-# █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
-# a arp i nv s sleep 8 pump1
-# b avant l latin t techno , pumprap
-# c blues m metal u world . rend
-# d chill n mq v expl / run
-# e country o pop w gimicky - tiredof
-# f dance p rap 6 sad = worm
-# g darkwave r rock 7 love \ lesser_version
-# h hardcore
-
-# y other genres z fg player ' = toggle play 1-5 rate ] repeat1
-# ; previous _ delete j/k skip mpv_keys vol,pause,seek
-# █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
-# ██
-# [file] Cannot open file '': No such file or directory
-# Failed to open .
-# bash: ( j + 1 ) % id_count : division by 0 (error token is "id_count ")
-
##### begin beet2nav functions #####
# update navidrome music data after doing beets tagging
# shellcheck disable=SC2034
graph_regex='^[[:graph:]]+$'
+# slightly less typing
+uintp() {
+ for arg; do
+ [[ $arg =~ $uint_regex ]] || return 1
+ done
+}
+
# horizontal row. used to break up output
# shellcheck disable=SC2120 # not a big deal.
hr() {