improved preview

This commit is contained in:
2025-07-21 16:39:58 +02:00
parent bb6520b541
commit 8a3e5144cf
3 changed files with 67 additions and 18 deletions

View File

@@ -8,19 +8,23 @@ set -eu
# Load helper methods
. "sh/helper.sh"
# Load theme
. "sh/theme.sh"
# Load AWK scripts
. "sh/awk.sh"
# Load tools
. "sh/tools.sh"
# Load MusicBrainz and Discogs methods
. "sh/api.sh"
# Load preview methods
. "sh/preview.sh"
if [ "${1:-}" = "--internal-preview" ]; then
# Get discogs url
discogsurl=$(mb_get_artist "$2" |
$JQ -r '.relations | map(select(.type=="discogs")) | .[0].url.resource')
[ ! "$discogsurl" ] || [ "$discogsurl" = "(null)" ] && exit 0
discogsid=$(echo "$discogsurl" | awk -F "/" '{print $NF}')
profile=$(discogs_get_artist "$discogsid" |
$JQ -r '.profile')
[ ! "$profile" ] || [ "$profile" = "(null)" ] && exit 0
echo "$profile" | $CAT
__preview_artist "$2"
exit 0
fi
@@ -59,15 +63,6 @@ if [ "${1:-}" = "--internal-search" ]; then
exit 0
fi
# Load theme
. "sh/theme.sh"
# Load AWK scripts
. "sh/awk.sh"
# Load tools
. "sh/tools.sh"
if [ "${1:-}" = "--help" ]; then
$CAT <<EOF
Usage: \`$0\` [ \`--help\` ]