playback controls
This commit is contained in:
51
src/main.sh
51
src/main.sh
@@ -33,6 +33,9 @@ MODE_INSERT="show"
|
||||
# Load filters
|
||||
. "sh/filter.sh"
|
||||
|
||||
# Load playback helper
|
||||
. "sh/playback.sh"
|
||||
|
||||
# Load AWK scripts
|
||||
. "sh/awk.sh"
|
||||
|
||||
@@ -90,7 +93,46 @@ case "${1:-}" in
|
||||
exit 0
|
||||
;;
|
||||
"--playback")
|
||||
debug "NOT IMPLEMENTED"
|
||||
view=${2:-}
|
||||
mbid_current="${3:-}"
|
||||
mbid="${4:-}"
|
||||
path="${5:-}"
|
||||
debug "call to $*"
|
||||
pbcmd=$(playback_cmd_from_key "$FZF_KEY")
|
||||
case "$pbcmd" in
|
||||
"$PLAYBACK_CMD_PLAY")
|
||||
[ "$path" ] || exit 0
|
||||
case "$view" in
|
||||
"$VIEW_ARTIST" | "$VIEW_SEARCH_ARTIST" | "$VIEW_SEARCH_ALBUM" | "$VIEW_LIST_ARTISTS" | "$VIEW_LIST_ALBUMS") debug "not implemented" ;;
|
||||
"$VIEW_RELEASEGROUP") generate_playlist "$mbid" "$path" | mpv_play_list >/dev/null ;;
|
||||
"$VIEW_RELEASE") generate_playlist "$mbid_current" "$path" "$mbid" | mpv_play_list >/dev/null ;;
|
||||
"$VIEW_PLAYLIST") generate_playlist "$mbid_current" "$path" "$mbid" | mpv_play_list >/dev/null ;;
|
||||
esac
|
||||
;;
|
||||
"$PLAYBACK_CMD_QUEUE")
|
||||
[ "$path" ] || exit 0
|
||||
case "$view" in
|
||||
"$VIEW_ARTIST" | "$VIEW_SEARCH_ARTIST" | "$VIEW_SEARCH_ALBUM" | "$VIEW_LIST_ARTISTS" | "$VIEW_LIST_ALBUMS") debug "not implemented" ;;
|
||||
"$VIEW_RELEASEGROUP") generate_playlist "$mbid" "$path" | mpv_queue_list >/dev/null ;;
|
||||
"$VIEW_RELEASE") generate_playlist "$mbid_current" "$path" "$mbid" | mpv_queue_list >/dev/null ;;
|
||||
"$VIEW_PLAYLIST") generate_playlist "$mbid_current" "$path" "$mbid" | mpv_queue_list >/dev/null ;;
|
||||
esac
|
||||
;;
|
||||
"$PLAYBACK_CMD_QUEUE_NEXT")
|
||||
[ "$path" ] || exit 0
|
||||
case "$view" in
|
||||
"$VIEW_ARTIST" | "$VIEW_SEARCH_ARTIST" | "$VIEW_SEARCH_ALBUM" | "$VIEW_LIST_ARTISTS" | "$VIEW_LIST_ALBUMS") debug "not implemented" ;;
|
||||
"$VIEW_RELEASEGROUP") generate_playlist "$mbid" "$path" | mpv_queue_next_list >/dev/null ;;
|
||||
"$VIEW_RELEASE") generate_playlist "$mbid_current" "$path" "$mbid" | mpv_queue_next_list >/dev/null ;;
|
||||
"$VIEW_PLAYLIST") generate_playlist "$mbid_current" "$path" "$mbid" | mpv_queue_next_list >/dev/null ;;
|
||||
esac
|
||||
;;
|
||||
"$PLAYBACK_CMD_TOGGLE_PLAYBACK") mpv_toggle_pause ;;
|
||||
"$PLAYBACK_CMD_PLAY_NEXT") mpv_next ;;
|
||||
"$PLAYBACK_CMD_PLAY_PREV") mpv_prev ;;
|
||||
"$PLAYBACK_CMD_SEEK_FORWARD") mpv_seek_forward ;;
|
||||
"$PLAYBACK_CMD_SEEK_BACKWARD") mpv_seek_backward ;;
|
||||
esac
|
||||
exit 0
|
||||
;;
|
||||
"--filter")
|
||||
@@ -423,10 +465,11 @@ $KEYS_FILTER_LOCAL:transform:$0 --fzf-key {2} {3} {4}" \
|
||||
--border-label=" Playlist " \
|
||||
--no-input \
|
||||
--margin="2%,10%" \
|
||||
--bind="$KEYS_ALL:transform:$0 --fzf-key {2} {3} {4}" \
|
||||
--bind="r,ctrl-r:reload:$0 --playlist" \
|
||||
--bind="q:accept" \
|
||||
--delimiter="\t" \
|
||||
--with-nth="{1}" >/dev/null
|
||||
VIEW=""
|
||||
;;
|
||||
"$VIEW_QUIT")
|
||||
debug "Quitting..."
|
||||
@@ -500,8 +543,8 @@ open \"\$(dirname {4})\"" \
|
||||
--bind="$KEYS_SHOW_PLAYLIST:print($VIEW_PLAYLIST)+accept" \
|
||||
--bind="$KEYS_QUIT:print($VIEW_QUIT)+accept" \
|
||||
--bind="$KEYS_N_QUIT:transform:$IN_NORMAL_MODE && ($IN_LIST_ARTISTS_VIEW && echo \"print($VIEW_QUIT)+accept\" || $0 --draw $MODE_NORMAL $VIEW_LIST_ARTISTS) || $PUT_FZF_KEY_LOGIC" \
|
||||
--bind="$KEYS_PLAYBACK:transform:$0 --playback" \
|
||||
--bind="$KEYS_N_PLAYBACK:transform:$IN_NORMAL_MODE && $0 --playback || $PUT_FZF_KEY_LOGIC" \
|
||||
--bind="$KEYS_PLAYBACK:transform:$0 --playback $FZF_CURRENT_VIEW {2} {3} {4}" \
|
||||
--bind="$KEYS_N_PLAYBACK:transform:$IN_NORMAL_MODE && $0 --playback $FZF_CURRENT_VIEW {2} {3} {4} || $PUT_FZF_KEY_LOGIC" \
|
||||
--bind="change:execute-silent($0 --fzf-change $FZF_CURRENT_VIEW &)+reload:$0 --fzf-change-reload" \
|
||||
--preview-window="right,25%,border-left,wrap,<30(hidden)" \
|
||||
--preview="$0 --preview-artist {3}" \
|
||||
|
Reference in New Issue
Block a user