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 <