improved preview
This commit is contained in:
31
src/main.sh
31
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 <<EOF
|
||||
Usage: \`$0\` [ \`--help\` ]
|
||||
|
Reference in New Issue
Block a user