ctrl-a: goto artist

This commit is contained in:
2025-07-31 21:16:17 +02:00
parent 935c9b3b52
commit d0e9ac3cd2
2 changed files with 14 additions and 15 deletions

View File

@@ -2,7 +2,6 @@ BEGIN { OFS="\t" }
{ {
id = $1 id = $1
print ">>"id"<<" >> "/tmp/foo"
status = $2 status = $2
year = substr($3, 1, 4) + 0 year = substr($3, 1, 4) + 0
year = year == 0 ? "" : year year = year == 0 ? "" : year
@@ -32,10 +31,6 @@ BEGIN { OFS="\t" }
line = line "\t" release_format_title line = line "\t" release_format_title
else else
line = line "\t" line = line "\t"
if (artist != rg_artist)
print "artist not rg_artist: "artist"!="rg_artist >> "/tmp/foo"
if (title != rg_title)
print "title not rg_title: "title"!="rg_title >> "/tmp/foo"
sub("<<status>>", line_status, line) sub("<<status>>", line_status, line)
sub("<<year>>", year, line) sub("<<year>>", year, line)

View File

@@ -233,9 +233,9 @@ while true; do
--prompt="$(printf "$ARTIST_PROMPT" "$name")" \ --prompt="$(printf "$ARTIST_PROMPT" "$name")" \
--accept-nth="{2}" \ --accept-nth="{2}" \
--with-nth="{1}" \ --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)\"" \ --expect="ctrl-h,ctrl-a" \
--bind="load:transform:[ \"\$FZF_TOTAL_COUNT\" -gt 0 ] && echo \"rebind:ctrl-l\" || echo \"unbind:ctrl-l)\"" \
--bind="ctrl-l:accept" \ --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-b:execute-silent:xdg-open 'https://musicbrainz.org/release-group/{r2}' &" \
--bind="alt-1:change-query(!$secsymb ),alt-2:change-query($secsymb )" \ --bind="alt-1:change-query(!$secsymb ),alt-2:change-query($secsymb )" \
--bind="ctrl-d:half-page-down,ctrl-u:half-page-up" \ --bind="ctrl-d:half-page-down,ctrl-u:half-page-up" \
@@ -244,8 +244,10 @@ while true; do
lns=$(echo "$sel" | wc -l) lns=$(echo "$sel" | wc -l)
key=$(echo "$sel" | head -1 | tail -1) key=$(echo "$sel" | head -1 | tail -1)
mid=$(echo "$sel" | head -2 | tail -1) mid=$(echo "$sel" | head -2 | tail -1)
[ "$lns" -eq 1 ] && [ "$mid" ] && set -- "--show-releasegroup" "$mid" echo "lns=$lns;key=$key;mid=$mid" >>/tmp/foo
[ "$lns" -eq 2 ] && [ "$key" = "prev" ] && set -- "" [ "$lns" -eq 2 ] && [ ! "$key" ] && [ "$mid" ] && set -- "--show-releasegroup" "$mid"
[ "$lns" -eq 2 ] && [ "$key" = "ctrl-h" ] && set -- ""
[ "$lns" -eq 2 ] && [ "$key" = "ctrl-a" ] && set -- "--select-artist" "$(mb_releasegroup "$mid" | $JQ -r '."artist-credit"')"
;; ;;
"--show-releasegroup") "--show-releasegroup")
title="$(mb_releasegroup "$2" | title="$(mb_releasegroup "$2" |
@@ -264,17 +266,18 @@ while true; do
--prompt="$(printf "$FULL_PROMPT" "$artist" "$title")" \ --prompt="$(printf "$FULL_PROMPT" "$artist" "$title")" \
--accept-nth="{2}" \ --accept-nth="{2}" \
--with-nth="{1}" \ --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)\"" \ --expect="ctrl-h,ctrl-a" \
--bind="load:transform:[ \"\$FZF_TOTAL_COUNT\" -gt 0 ] && echo \"rebind:ctrl-l\" || echo \"unbind:ctrl-l\"" \
--bind="ctrl-l:accept" \ --bind="ctrl-l:accept" \
--bind="ctrl-h:print(prev)+accept" \
--bind="alt-b:execute-silent:xdg-open 'https://musicbrainz.org/release/{r2}' &" \ --bind="alt-b:execute-silent:xdg-open 'https://musicbrainz.org/release/{r2}' &" \
--bind="ctrl-d:half-page-down,ctrl-u:half-page-up" --bind="ctrl-d:half-page-down,ctrl-u:half-page-up"
) )
lns=$(echo "$sel" | wc -l) lns=$(echo "$sel" | wc -l)
key=$(echo "$sel" | head -1 | tail -1) key=$(echo "$sel" | head -1 | tail -1)
mid=$(echo "$sel" | head -2 | tail -1) mid=$(echo "$sel" | head -2 | tail -1)
[ "$lns" -eq 1 ] && [ "$mid" ] && set -- "--show-release" "$mid" [ "$lns" -eq 2 ] && [ ! "$key" ] && [ "$mid" ] && set -- "--show-release" "$mid"
[ "$lns" -eq 2 ] && [ "$key" = "prev" ] && set -- "--select-artist" "$(mb_releasegroup "$2" | $JQ -r '."artist-credit"')" [ "$lns" -eq 2 ] && [ "$key" = "ctrl-h" ] && set -- "--select-artist" "$(mb_releasegroup "$2" | $JQ -r '."artist-credit"')"
[ "$lns" -eq 2 ] && [ "$key" = "ctrl-a" ] && set -- "--select-artist" "$(mb_release "$mid" | $JQ -r '."artist-credit"')"
;; ;;
"--show-release") "--show-release")
title="$(mb_release "$2" | title="$(mb_release "$2" |
@@ -292,14 +295,15 @@ while true; do
--prompt="$(printf "$FULL_PROMPT" "$artist" "$title")" \ --prompt="$(printf "$FULL_PROMPT" "$artist" "$title")" \
--accept-nth="{2}" \ --accept-nth="{2}" \
--with-nth="{1}" \ --with-nth="{1}" \
--bind="ctrl-h:print(prev)+accept" \ --expect="ctrl-h,ctrl-a" \
--bind="alt-b:execute-silent:xdg-open 'https://musicbrainz.org/track/{r2}' &" \ --bind="alt-b:execute-silent:xdg-open 'https://musicbrainz.org/track/{r2}' &" \
--bind="ctrl-d:half-page-down,ctrl-u:half-page-up" --bind="ctrl-d:half-page-down,ctrl-u:half-page-up"
) )
lns=$(echo "$sel" | wc -l) lns=$(echo "$sel" | wc -l)
key=$(echo "$sel" | head -1 | tail -1) key=$(echo "$sel" | head -1 | tail -1)
mid=$(echo "$sel" | head -2 | 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')" [ "$lns" -eq 2 ] && [ "$key" = "ctrl-h" ] && set -- "--show-releasegroup" "$(mb_release "$2" | $JQ -r '."release-group".id')"
[ "$lns" -eq 2 ] && [ "$key" = "ctrl-a" ] && set -- "--select-artist" "$(mb_release "$2" | $JQ -r ".media[].tracks[] | select(.id==\"$mid\") | .\"artist-credit\"")"
;; ;;
"--select-artist") "--select-artist")
sel=$( sel=$(