artist select, ctrl-h ctrl-l keys, bugfixes
This commit is contained in:
@@ -7,5 +7,5 @@ $2 != "Group" { name = format_person }
|
|||||||
name = name " " format_disambiguation
|
name = name " " format_disambiguation
|
||||||
sub("<<disambiguation>>", $4, name)
|
sub("<<disambiguation>>", $4, name)
|
||||||
sub("<<name>>", $3, name)
|
sub("<<name>>", $3, name)
|
||||||
print $1, name
|
print name, $1
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
BEGIN { OFS="\t" }
|
BEGIN { OFS="\t" }
|
||||||
|
|
||||||
{
|
{
|
||||||
gsub("&", "\\\\&")
|
|
||||||
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
|
||||||
@@ -28,15 +28,24 @@ BEGIN { OFS="\t" }
|
|||||||
line = line "\t" release_format_title_artist
|
line = line "\t" release_format_title_artist
|
||||||
else if (artist != rg_artist && title == rg_title)
|
else if (artist != rg_artist && title == rg_title)
|
||||||
line = line "\t" release_format_artist
|
line = line "\t" release_format_artist
|
||||||
else if (artist != rg_artist && title == rg_title)
|
else if (artist == rg_artist && title != rg_title)
|
||||||
line = line "\t" release_format_title
|
line = line "\t" release_format_title
|
||||||
|
else
|
||||||
|
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)
|
||||||
sub("<<tracks>>", trackcnt, line)
|
sub("<<tracks>>", trackcnt, line)
|
||||||
sub("<<media>>", media, line)
|
sub("<<media>>", media, line)
|
||||||
|
gsub("&", "\\\\&", label)
|
||||||
sub("<<label>>", label, line)
|
sub("<<label>>", label, line)
|
||||||
|
gsub("&", "\\\\&", titel)
|
||||||
sub("<<title>>", title, line)
|
sub("<<title>>", title, line)
|
||||||
|
gsub("&", "\\\\&", artist)
|
||||||
sub("<<artist>>", artist, line)
|
sub("<<artist>>", artist, line)
|
||||||
sub("<<country>>", country, line)
|
sub("<<country>>", country, line)
|
||||||
sortk = year ? year : 0
|
sortk = year ? year : 0
|
||||||
|
59
src/main.sh
59
src/main.sh
@@ -233,12 +233,19 @@ 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)\"" \
|
||||||
|
--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" \
|
||||||
--bind="ctrl-r:reload:$0 --internal-list-releasegroups-fresh \"$2\""
|
--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")
|
"--show-releasegroup")
|
||||||
title="$(mb_releasegroup "$2" |
|
title="$(mb_releasegroup "$2" |
|
||||||
@@ -257,10 +264,17 @@ 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)\"" \
|
||||||
|
--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"
|
||||||
)
|
)
|
||||||
[ "$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")
|
"--show-release")
|
||||||
title="$(mb_release "$2" |
|
title="$(mb_release "$2" |
|
||||||
@@ -278,10 +292,39 @@ 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" \
|
||||||
--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"
|
||||||
)
|
)
|
||||||
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=$(
|
sel=$(
|
||||||
@@ -296,15 +339,15 @@ while true; do
|
|||||||
--prompt="$SEARCH_PROMPT" \
|
--prompt="$SEARCH_PROMPT" \
|
||||||
--info="inline-right" \
|
--info="inline-right" \
|
||||||
--info-command="echo \"Search music artist\"" \
|
--info-command="echo \"Search music artist\"" \
|
||||||
--accept-nth="{1}" \
|
--accept-nth="{2}" \
|
||||||
--with-nth="{2}" \
|
--with-nth="{1}" \
|
||||||
--expect="ctrl-l" \
|
|
||||||
--preview-window="right,25%,border-left,wrap,<30(hidden)" \
|
--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="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="ctrl-d:half-page-down,ctrl-u:half-page-up" \
|
||||||
--bind="down:preview-half-page-down,up:preview-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)"
|
--bind="change:execute-silent($0 --internal-search \$FZF_QUERY &)+reload($0 --internal-reload)"
|
||||||
)
|
)
|
||||||
lns=$(echo "$sel" | wc -l)
|
lns=$(echo "$sel" | wc -l)
|
||||||
|
@@ -22,7 +22,7 @@ api_mb_release() {
|
|||||||
$CURL \
|
$CURL \
|
||||||
--get \
|
--get \
|
||||||
--data fmt=json \
|
--data fmt=json \
|
||||||
--data inc="recordings+artist-credits" \
|
--data inc="recordings+artist-credits+release-groups" \
|
||||||
-A "$APP_NAME/$APP_VERSION ($APP_WEBSITE)" \
|
-A "$APP_NAME/$APP_VERSION ($APP_WEBSITE)" \
|
||||||
"https://musicbrainz.org/ws/2/release/$1"
|
"https://musicbrainz.org/ws/2/release/$1"
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ api_mb_browse_releasegroup_releases() {
|
|||||||
$CURL \
|
$CURL \
|
||||||
--get \
|
--get \
|
||||||
--data fmt=json \
|
--data fmt=json \
|
||||||
--data inc="artist-credits+labels+media" \
|
--data inc="artist-credits+labels+media+release-groups" \
|
||||||
--data limit="$MB_BROWSE_STEPS" \
|
--data limit="$MB_BROWSE_STEPS" \
|
||||||
--data offset="${2:-0}" \
|
--data offset="${2:-0}" \
|
||||||
--data release-group="$1" \
|
--data release-group="$1" \
|
||||||
|
@@ -65,8 +65,8 @@ FORMAT_STATUS_CANCELLED="${FORMAT_STATUS_CANCELLED:-"❌ cancelled"}"
|
|||||||
|
|
||||||
# Release view
|
# Release view
|
||||||
RV_FORMAT="<<status>>\t${CXXX}<<tracks>> tracks\t<<media>>${OFF}\t${CYEAR}<<year>>\t<<country>>${OFF}\t${CARTIST}<<label>>$OFF"
|
RV_FORMAT="<<status>>\t${CXXX}<<tracks>> tracks\t<<media>>${OFF}\t${CYEAR}<<year>>\t<<country>>${OFF}\t${CARTIST}<<label>>$OFF"
|
||||||
RV_TITLE_ARTIST="${FAINT}${CTITLE}<<title>>$OFF — ${FAINT}${CARTIST}<<artist>>$OFF"
|
RV_TITLE_ARTIST="${FAINT}as ${CTITLE}<<title>>$OFF by ${FAINT}${CARTIST}<<artist>>$OFF"
|
||||||
RV_TITLE="${FAINT}${CTITLE}<<title>>$OFF"
|
RV_TITLE="${FAINT}as ${CTITLE}<<title>>$OFF"
|
||||||
RV_ARTIST="${FAINT}by ${CARTIST}<<artist>>$OFF"
|
RV_ARTIST="${FAINT}by ${CARTIST}<<artist>>$OFF"
|
||||||
|
|
||||||
# Recording view
|
# Recording view
|
||||||
|
Reference in New Issue
Block a user