ctrl-a: goto artist
This commit is contained in:
@@ -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)
|
||||||
|
24
src/main.sh
24
src/main.sh
@@ -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=$(
|
||||||
|
Reference in New Issue
Block a user