minor improvements
This commit is contained in:
@@ -12,8 +12,10 @@ sed -E 's|\. "([^$].+)"$|cat src/\1|e' "$SRC" >"$tmpdir/1.sh"
|
||||
echo "🐔 ${GREEN}Internalize awk scripts${OFF}"
|
||||
sed -E 's|@@include (.+)$|cat src/\1|e' "$tmpdir/1.sh" >"$tmpdir/2.sh"
|
||||
echo "🥚 ${GREEN}Internalize awk libraries${OFF}"
|
||||
sed -E 's|@include "(.+)"$|cat src/\1|e' "$tmpdir/2.sh" >"$NAME"
|
||||
echo "🐔 ${GREEN}Make executable and cleanup${OFF}"
|
||||
sed -E 's|@include "(.+)"$|cat src/\1|e' "$tmpdir/2.sh" >"$tmpdir/3.sh"
|
||||
echo "🐔 ${GREEN}Strip comments${OFF}"
|
||||
grep -v "^ *# " "$tmpdir/3.sh" | grep -v "^ *#$" >"$NAME"
|
||||
echo "🥚 ${GREEN}Make executable and cleanup${OFF}"
|
||||
chmod +x "$NAME"
|
||||
rm -rf "$tmpdir"
|
||||
echo "🍳 ${GREEN}Done:${OFF} Sucessfully built ${BOLD}${GREEN}$NAME${OFF}"
|
||||
|
||||
45
src/main.sh
45
src/main.sh
@@ -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" \
|
||||
|
||||
@@ -3,7 +3,7 @@ if [ ! "${INFO_LOADED:-}" ]; then
|
||||
APP_NAME="fuzic"
|
||||
APP_VERSION="0.1"
|
||||
APP_WEBSITE="https://git.indyfac.ch/amin/fuzic"
|
||||
WINDOW_TITLE="🔎🎶 $APP_NAME | a simple music finder and player"
|
||||
WINDOW_TITLE="🔎🎶 $APP_NAME | a simple music browser and player"
|
||||
export APP_NAME APP_VERSION APP_WEBSITE WINDOW_TITLE
|
||||
|
||||
export INFO_LOADED=1
|
||||
|
||||
@@ -103,7 +103,7 @@ if [ ! "${KEYS_LOADED:-}" ]; then
|
||||
KEYS_N_DOWN="${KEYS_N_DOWN:-"j"}"
|
||||
KEYS_N_UP="${KEYS_N_UP:-"k"}"
|
||||
KEYS_N_BOT="${KEYS_N_BOT:-"G"}"
|
||||
KEYS_N_TOP="${KEYS_N_TOP:-"g"}"
|
||||
KEYS_N_TOP="${KEYS_N_TOP:-"1,g"}"
|
||||
export KEYS_DOWN KEYS_UP KEYS_HALFPAGE_DOWN KEYS_HALFPAGE_UP KEYS_N_DOWN \
|
||||
KEYS_N_UP KEYS_N_BOT KEYS_N_TOP
|
||||
|
||||
|
||||
@@ -259,8 +259,6 @@ __precompute_lists() {
|
||||
precompute_views() {
|
||||
awk_artists "$SORT_ARTIST_DEFAULT" <"$LOCALDATA_ARTISTS_LIST" >"$LOCALDATA_ARTISTS_VIEW"
|
||||
awk_releasegroups "$SORT_RG_DEFAULT" <"$LOCALDATA_RELEASEGROUPS_LIST" >"$LOCALDATA_RELEASEGROUPS_VIEW"
|
||||
#column -t -s "$(printf '\t')" |
|
||||
#sed 's| \+\([0-9a-f-]\+\) \+\([0-9a-f-]\+\)$|\t\1\t\2|' >"$LOCALDATA_RELEASEGROUPS_VIEW"
|
||||
}
|
||||
|
||||
# Load local music
|
||||
@@ -315,8 +313,6 @@ reloaddb() {
|
||||
local_files_present() {
|
||||
cache_get_file_batch "$TYPE_ARTIST" <"$LOCALDATA_ARTISTS" | xargs ls >/dev/null 2>&1 || return 1
|
||||
cache_get_file_batch "$TYPE_RELEASEGROUP" <"$LOCALDATA_RELEASEGROUPS" | xargs ls >/dev/null 2>&1 || return 1
|
||||
#cut -d "$(printf '\t')" -f 1 "$LOCALDATA_RELEASES" | cache_get_file_batch "$TYPE_RELEASE" | xargs ls >/dev/null 2>&1 || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
# Load missing files
|
||||
@@ -326,5 +322,4 @@ local_files_present() {
|
||||
load_missing_files() {
|
||||
__batch_load_missing "$TYPE_ARTIST" <"$LOCALDATA_ARTISTS"
|
||||
__batch_load_missing "$TYPE_RELEASEGROUP" <"$LOCALDATA_RELEASEGROUPS"
|
||||
#cut -d "$(printf '\t')" -f 1 "$LOCALDATA_RELEASES" | __batch_load_missing "$TYPE_RELEASE"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user