minor improvements

This commit is contained in:
2025-10-10 09:55:49 +02:00
parent a4cb7d5c72
commit 08ea6cf56c
5 changed files with 28 additions and 32 deletions

View File

@@ -47,6 +47,9 @@ MODE_INSERT="show"
# Load logging methods
. "sh/log.sh"
# Load configuration
. "sh/config.sh"
# Load query methods
. "sh/query.sh"
@@ -83,9 +86,6 @@ MODE_INSERT="show"
# Load keys
. "sh/keys.sh"
# Load configuration
. "sh/config.sh"
# Load sorting methods
. "sh/sort.sh"
@@ -98,6 +98,9 @@ MODE_INSERT="show"
# Load AWK scripts
. "sh/awk.sh"
# Load filters
. "sh/filter.sh"
# Command-line options that may only be used internally.
# --lines
# --playback
@@ -225,30 +228,30 @@ case "${1:-}" in
# @argument $5: MusicBrainz ID (optional)
#
# The argument `level` specifies the view relative to `view`: If `level` is
# set to +1, then the specified MusicBrainz ID is an ID of an object one level
# deeper than `view`. Alternatively, the argument `level` may be set to `-1`.
# Anything else is interpreted as "on the level of `view`".
# set to +1, then the specified MusicBrainz ID is an ID of an object one
# level deeper than `view`. Similarly, the argument `level` may be set to
# `-1`. Anything else is interpreted as "on the level of `view`".
#
# The choice of possible arguments ($5) depends on the view.
# These views are independent of the MusicBrainz ID ($4) and of the argument
# The choice of possible levels ($4) depends on the view.
# These views are independent of the MusicBrainz ID ($5) and of the argument
# ($5):
# - VIEW_SEARCH_ARTIST: Get ready to query MusicBrainz for artists
# - VIEW_SEARCH_ALBUM: Get ready to query MusicBrainz for albums
# - VIEW_LIST_ARTISTS: List all locally available artists
# - VIEW_LIST_ALBUMS: List al locally available albums
#
# If no argument ($5) is specified, then the remaining views act as follows:
# If no level ($4) is specified, then the remaining views act as follows:
# - VIEW_ARTIST: Display all release groups of that artist
# - VIEW_RELEASEGROUP: Display all releases within that release group
# - VIEW_RELEASE: Display track list of specified release
#
# Here, if the argument is set to `-1`, then the parent entry is displayed:
# Here, if the level is set to `-1`, then the parent entry is displayed:
# - VIEW_ARTIST: Divert view to VIEW_LIST_ARTISTS
# - VIEW_RELEASEGROUP: For single-artist release groups, divert to
# VIEW_ARTIST of that artist, else display the artist selection.
# - VIEW_RELEASE: Divert view to VIEW_LIST_RELEASEGROUP.
#
# Alternatively, if the argument is set to `+1`, then the child entry is
# Alternatively, if the level is set to `+1`, then the child entry is
# displayed:
# - VIEW_ARTIST: Divert view to VIEW_LIST_ARTISTS
# - VIEW_RELEASEGROUP: For single-artist release groups, divert to
@@ -489,7 +492,6 @@ case "${1:-}" in
esac
# Start application:
# - load and export preset filters
# - set title
# - check for missing data from MusicBrainz
# - precompute main views
@@ -497,9 +499,6 @@ esac
# - start mpv daemon
# - enter main loop and start fzf
# Load filters
. "sh/filter.sh"
# Set window title
printf '\033]0;%s\007' "$WINDOW_TITLE"
@@ -526,17 +525,17 @@ mpv_start
# states are stored in (in)visible labels
#
# mode: [$MODE_NORMAL, $MODE_INSERT]
# The mode is reflected on the input visibility. The variable $FZF_INPUT_STATE
# is set to "hidden" if and only if the mode is `normal`. To swtich to `normal`
# mode, we call `hide-input`. To switch to insert mode, we call `show-input`.
# The mode is reflected on the input visibility. The variable
# `FZF_INPUT_STATE`` is set to "hidden" if and only if the mode is `normal`. To
# swtich to `normal` mode, we call `hide-input`. To switch to insert mode, we
# call `show-input`.
#
# view: [$VIEW_*]
# The view is stored in $FZF_LIST_LABEL. To set the view, call
# The view is stored in `FZF_LIST_LABEL`. To set the view, call
# `change-list-label($VIEW)`.
#
# argument: string
# The argument is stored in $FZF_LIST_LABEL. To set the argument, call
# `change-list-label($arg)`.
# mbid:
# The MusicBrainz ID of the current object is stored in `FZF_BORDER_LABEL`.
IN_NORMAL_MODE="[ \$FZF_INPUT_STATE = hidden ]"
IN_VIEW_PATTERN="[ \$FZF_LIST_LABEL = %s ]"
IN_LIST_ARTISTS_VIEW="$(printf "$IN_VIEW_PATTERN" "$VIEW_LIST_ARTISTS")"
@@ -627,7 +626,7 @@ while true; do
--bind="$KEYS_PREVIEW_TOGGLE_SIZE:change-preview-window(right,90%,border-line,nowrap|$FZF_DEFAULT_PREVIEW_WINDOW)" \
--bind="$KEYS_PREVIEW_CLOSE:hide-preview" \
--bind="$KEYS_PLAYBACK,$KEYS_N_PLAYBACK:transform($0 --playback $VIEW_PLAYLIST {3} {4} {5})+$FZF_RELOAD_PLAYLIST+$FZF_POS_PLAYLIST" \
--bind="$KEYS_PLAYLIST_RELOAD:$FZF_RELOAD_PLAYLIST+$FZF_POS_PLAYLIST" \
--bind="$KEYS_PLAYLIST_RELOAD,$KEYS_SHOW_PLAYLIST:$FZF_RELOAD_PLAYLIST+$FZF_POS_PLAYLIST" \
--bind="$KEYS_PLAYLIST_REMOVE:execute-silent($0 --playlist $PLAYLIST_CMD_REMOVE)+$FZF_RELOAD_PLAYLIST" \
--bind="$KEYS_PLAYLIST_UP:execute-silent($0 --playlist $PLAYLIST_CMD_UP)+up+$FZF_RELOAD_PLAYLIST" \
--bind="$KEYS_PLAYLIST_DOWN:execute-silent($0 --playlist $PLAYLIST_CMD_DOWN)+down+$FZF_RELOAD_PLAYLIST" \