#!/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. set -e; . /usr/local/lib/bash-bear; set +e source /a/bin/ds/beet-data for r in 1 2 3 4 5; do sqlite3 /i/navidrome/navidrome.db ".output $r" "select path from annotation inner join media_file on item_id = id where rating = $r;" done find /i/m -type f -name '*.flac' >flacs for plist in ${nav_tags[@]}; do sqlite3 /i/navidrome/navidrome.db "select path from media_file inner join playlist_tracks on media_file.id = media_file_id where playlist_id = (select id from playlist where name = '_$plist');" | sed 's,^/i/converted,/i/m,' | sort >$plist done while read -r id name; do mkdir -p 2genre/$id sqlite3 /i/navidrome/navidrome.db "select path from media_file inner join playlist_tracks on media_file.id = media_file_id where playlist_id = '$id';" | sed 's,^/i/converted,/i/m,' | sort >2genre/$id/$name done < <(sqlite3 /i/navidrome/navidrome.db ".separator ' '" "select id, name from playlist where name like '2%'")