artist select, ctrl-h ctrl-l keys, bugfixes
This commit is contained in:
59
src/main.sh
59
src/main.sh
@@ -233,12 +233,19 @@ while true; do
|
||||
--prompt="$(printf "$ARTIST_PROMPT" "$name")" \
|
||||
--accept-nth="{2}" \
|
||||
--with-nth="{1}" \
|
||||
--bind="load:transform:[ \"\$FZF_TOTAL_COUNT\" -gt 0 ] && echo \"rebind(ctrl-h)+rebind(ctrl-l)\" || echo \"unbind(ctrl-h)+unbind(ctrl-l)\"" \
|
||||
--bind="ctrl-l:accept" \
|
||||
--bind="ctrl-h:print(prev)+accept" \
|
||||
--bind="alt-b:execute-silent:xdg-open 'https://musicbrainz.org/release-group/{r2}' &" \
|
||||
--bind="alt-1:change-query(!$secsymb ),alt-2:change-query($secsymb )" \
|
||||
--bind="ctrl-d:half-page-down,ctrl-u:half-page-up" \
|
||||
--bind="ctrl-r:reload:$0 --internal-list-releasegroups-fresh \"$2\""
|
||||
)
|
||||
[ "$sel" ] && set -- "--show-releasegroup" "$sel"
|
||||
lns=$(echo "$sel" | wc -l)
|
||||
key=$(echo "$sel" | head -1 | tail -1)
|
||||
mid=$(echo "$sel" | head -2 | tail -1)
|
||||
[ "$lns" -eq 1 ] && [ "$mid" ] && set -- "--show-releasegroup" "$mid"
|
||||
[ "$lns" -eq 2 ] && [ "$key" = "prev" ] && set -- ""
|
||||
;;
|
||||
"--show-releasegroup")
|
||||
title="$(mb_releasegroup "$2" |
|
||||
@@ -257,10 +264,17 @@ while true; do
|
||||
--prompt="$(printf "$FULL_PROMPT" "$artist" "$title")" \
|
||||
--accept-nth="{2}" \
|
||||
--with-nth="{1}" \
|
||||
--bind="load:transform:[ \"\$FZF_TOTAL_COUNT\" -gt 0 ] && echo \"rebind(ctrl-h)+rebind(ctrl-l)\" || echo \"unbind(ctrl-h)+unbind(ctrl-l)\"" \
|
||||
--bind="ctrl-l:accept" \
|
||||
--bind="ctrl-h:print(prev)+accept" \
|
||||
--bind="alt-b:execute-silent:xdg-open 'https://musicbrainz.org/release/{r2}' &" \
|
||||
--bind="ctrl-d:half-page-down,ctrl-u:half-page-up"
|
||||
)
|
||||
[ "$sel" ] && set -- "--show-release" "$sel"
|
||||
lns=$(echo "$sel" | wc -l)
|
||||
key=$(echo "$sel" | head -1 | tail -1)
|
||||
mid=$(echo "$sel" | head -2 | tail -1)
|
||||
[ "$lns" -eq 1 ] && [ "$mid" ] && set -- "--show-release" "$mid"
|
||||
[ "$lns" -eq 2 ] && [ "$key" = "prev" ] && set -- "--select-artist" "$(mb_releasegroup "$2" | $JQ -r '."artist-credit"')"
|
||||
;;
|
||||
"--show-release")
|
||||
title="$(mb_release "$2" |
|
||||
@@ -278,10 +292,39 @@ while true; do
|
||||
--prompt="$(printf "$FULL_PROMPT" "$artist" "$title")" \
|
||||
--accept-nth="{2}" \
|
||||
--with-nth="{1}" \
|
||||
--bind="ctrl-h:print(prev)+accept" \
|
||||
--bind="alt-b:execute-silent:xdg-open 'https://musicbrainz.org/track/{r2}' &" \
|
||||
--bind="ctrl-d:half-page-down,ctrl-u:half-page-up"
|
||||
)
|
||||
exit 0
|
||||
lns=$(echo "$sel" | wc -l)
|
||||
key=$(echo "$sel" | head -1 | tail -1)
|
||||
mid=$(echo "$sel" | head -2 | tail -1)
|
||||
[ "$lns" -eq 2 ] && [ "$key" = "prev" ] && set -- "--show-releasegroup" "$(mb_release "$2" | $JQ -r '."release-group".id')"
|
||||
;;
|
||||
"--select-artist")
|
||||
sel=$(
|
||||
echo "$2" |
|
||||
$JQ -r 'map([.artist.id, .artist.type, .name] | join("\t")) | join("\n")' |
|
||||
awk \
|
||||
-F "\t" \
|
||||
-v format_person="$AV_PERSON" \
|
||||
-v format_group="$AV_GROUP" \
|
||||
-v format_disambiguation="$AV_DISAMBIGUATION" \
|
||||
"$AWK_ARTISTS" |
|
||||
$FZF \
|
||||
-1 \
|
||||
--ansi \
|
||||
--cycle \
|
||||
--no-sort \
|
||||
--border="bold" \
|
||||
--border-label="Select artist" \
|
||||
--delimiter="\t" \
|
||||
--prompt="$SEARCH_PROMPT" \
|
||||
--margin="5%,20%" \
|
||||
--accept-nth="{2}" \
|
||||
--with-nth="{1}"
|
||||
)
|
||||
[ "$sel" ] && set -- "--show-artist" "$sel"
|
||||
;;
|
||||
*)
|
||||
sel=$(
|
||||
@@ -296,15 +339,15 @@ while true; do
|
||||
--prompt="$SEARCH_PROMPT" \
|
||||
--info="inline-right" \
|
||||
--info-command="echo \"Search music artist\"" \
|
||||
--accept-nth="{1}" \
|
||||
--with-nth="{2}" \
|
||||
--expect="ctrl-l" \
|
||||
--accept-nth="{2}" \
|
||||
--with-nth="{1}" \
|
||||
--preview-window="right,25%,border-left,wrap,<30(hidden)" \
|
||||
--preview="$0 --internal-preview-artist {1}" \
|
||||
--preview="$0 --internal-preview-artist {2}" \
|
||||
--bind="load:transform:[ \"\$FZF_TOTAL_COUNT\" -gt 0 ] && echo \"rebind:ctrl-l\" || echo \"unbind:ctrl-l\"" \
|
||||
--bind="ctrl-l:accept" \
|
||||
--bind="ctrl-d:half-page-down,ctrl-u:half-page-up" \
|
||||
--bind="down:preview-half-page-down,up:preview-half-page-up" \
|
||||
--bind="alt-b:execute-silent:xdg-open 'https://musicbrainz.org/artist/{r1}' &" \
|
||||
--bind="alt-b:execute-silent:xdg-open 'https://musicbrainz.org/artist/{r2}' &" \
|
||||
--bind="change:execute-silent($0 --internal-search \$FZF_QUERY &)+reload($0 --internal-reload)"
|
||||
)
|
||||
lns=$(echo "$sel" | wc -l)
|
||||
|
Reference in New Issue
Block a user