From 8a3e5144cfb74cf31f95a5cf67caa1b36a7a53c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=84min=20Baumeler?= Date: Mon, 21 Jul 2025 16:39:58 +0200 Subject: [PATCH] improved preview --- src/main.sh | 31 +++++++++++++------------------ src/sh/api.sh | 19 +++++++++++++++++++ src/sh/preview.sh | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 18 deletions(-) create mode 100644 src/sh/preview.sh diff --git a/src/main.sh b/src/main.sh index 43f49f8..b8f4063 100755 --- a/src/main.sh +++ b/src/main.sh @@ -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 <