feat: play and queue from artist search and album list
This commit is contained in:
@@ -141,7 +141,6 @@ case "${1:-}" in
|
||||
# @argument $3: MusicBrainz ID of current object
|
||||
# @argument $4: MusicBrainz ID of selected object
|
||||
# @argument $5: Path to decoration file
|
||||
info "call to $*"
|
||||
shift
|
||||
playback "$@"
|
||||
exit 0
|
||||
|
||||
+3
-3
@@ -258,7 +258,7 @@ cache_rm_artist() {
|
||||
d="$CACHEDIR/$TYPE_ARTIST/$(__radix "$1")/"
|
||||
[ "$d" ] || return 1
|
||||
[ -d "$d" ] || return 1
|
||||
info "removing $d"
|
||||
info "Removing $d from cache"
|
||||
rm -rf "$d"
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ cache_rm_releasegroup() {
|
||||
d="$CACHEDIR/$TYPE_RELEASEGROUP/$(__radix "$1")/"
|
||||
[ "$d" ] || return 1
|
||||
[ -d "$d" ] || return 1
|
||||
info "removing $d"
|
||||
info "Removing $d from cache"
|
||||
rm -rf "$d"
|
||||
}
|
||||
|
||||
@@ -292,6 +292,6 @@ cache_rm_release() {
|
||||
d="$CACHEDIR/$TYPE_RELEASE/$(__radix "$1")/"
|
||||
[ "$d" ] || return 1
|
||||
[ -d "$d" ] || return 1
|
||||
info "removing $d"
|
||||
info "Removing $d from cache"
|
||||
rm -rf "$d"
|
||||
}
|
||||
|
||||
@@ -210,7 +210,6 @@ mb_search_async() {
|
||||
touch "$LOCKFILE"
|
||||
sleep 1
|
||||
if [ "$view" = "$VIEW_SEARCH_ARTIST" ]; then
|
||||
info "search artist. results: $RESULTS"
|
||||
api_mb_search_artist "$FZF_QUERY" |
|
||||
$JQ '.artists[] | [
|
||||
.id,
|
||||
|
||||
+85
-5
@@ -99,7 +99,6 @@ __generate_playlist() {
|
||||
# pressed is stored in the environment variable FZF_KEY and is resolved to
|
||||
# the playback command through the method `__playback_cmd_from_key`.
|
||||
playback() {
|
||||
info "call to playback: $*"
|
||||
view=${1:-}
|
||||
mbid_current="${2:-}"
|
||||
mbid="${3:-}"
|
||||
@@ -108,9 +107,44 @@ playback() {
|
||||
case "$pbcmd" in
|
||||
"$PLAYBACK_CMD_PLAY")
|
||||
[ "$path" ] || exit 0
|
||||
info "play pressed"
|
||||
case "$view" in
|
||||
"$VIEW_ARTIST" | "$VIEW_SEARCH_ARTIST" | "$VIEW_SEARCH_ALBUM" | "$VIEW_LIST_ARTISTS" | "$VIEW_LIST_ALBUMS") info "not implemented" ;;
|
||||
"$VIEW_SEARCH_ARTIST" | "$VIEW_LIST_ARTISTS")
|
||||
list_releasegroups "$mbid" |
|
||||
while IFS= read -r rgline; do
|
||||
rgmbid="$(echo "$rgline" | cut -d "$(printf '\t')" -f 4)"
|
||||
rgpath="$(echo "$rgline" | cut -d "$(printf '\t')" -f 5)"
|
||||
[ "$rgpath" ] || continue
|
||||
[ "${queue:-}" ] || queue=""
|
||||
export queue
|
||||
list_releases "$rgmbid" |
|
||||
while IFS= read -r line; do
|
||||
rmbid="$(echo "$line" | cut -d "$(printf '\t')" -f 4)"
|
||||
rpath="$(echo "$line" | cut -d "$(printf '\t')" -f 5)"
|
||||
[ "$rpath" ] || continue
|
||||
if [ ! "$queue" ]; then
|
||||
__generate_playlist "$rmbid" "$rpath" | mpv_play_list >/dev/null
|
||||
queue=1
|
||||
else
|
||||
__generate_playlist "$rmbid" "$rpath" | mpv_queue_list >/dev/null
|
||||
fi
|
||||
done
|
||||
queue=1
|
||||
done
|
||||
;;
|
||||
"$VIEW_ARTIST" | "$VIEW_SEARCH_ALBUM" | "$VIEW_LIST_ALBUMS")
|
||||
list_releases "$mbid" |
|
||||
while IFS= read -r line; do
|
||||
rmbid="$(echo "$line" | cut -d "$(printf '\t')" -f 4)"
|
||||
rpath="$(echo "$line" | cut -d "$(printf '\t')" -f 5)"
|
||||
[ "$rpath" ] || continue
|
||||
if [ ! "${queue:-}" ]; then
|
||||
__generate_playlist "$rmbid" "$rpath" | mpv_play_list >/dev/null
|
||||
queue=1
|
||||
else
|
||||
__generate_playlist "$rmbid" "$rpath" | mpv_queue_list >/dev/null
|
||||
fi
|
||||
done
|
||||
;;
|
||||
"$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") mpv_play_index $((FZF_POS - 1)) >/dev/null ;;
|
||||
@@ -119,7 +153,30 @@ playback() {
|
||||
"$PLAYBACK_CMD_QUEUE")
|
||||
[ "$path" ] || exit 0
|
||||
case "$view" in
|
||||
"$VIEW_ARTIST" | "$VIEW_SEARCH_ARTIST" | "$VIEW_SEARCH_ALBUM" | "$VIEW_LIST_ARTISTS" | "$VIEW_LIST_ALBUMS") info "not implemented" ;;
|
||||
"$VIEW_SEARCH_ARTIST" | "$VIEW_LIST_ARTISTS")
|
||||
list_releasegroups "$mbid" |
|
||||
while IFS= read -r rgline; do
|
||||
rgmbid="$(echo "$rgline" | cut -d "$(printf '\t')" -f 4)"
|
||||
rgpath="$(echo "$rgline" | cut -d "$(printf '\t')" -f 5)"
|
||||
[ "$rgpath" ] || continue
|
||||
list_releases "$rgmbid" |
|
||||
while IFS= read -r line; do
|
||||
rmbid="$(echo "$line" | cut -d "$(printf '\t')" -f 4)"
|
||||
rpath="$(echo "$line" | cut -d "$(printf '\t')" -f 5)"
|
||||
[ "$rpath" ] || continue
|
||||
__generate_playlist "$rmbid" "$rpath" | mpv_queue_list >/dev/null
|
||||
done
|
||||
done
|
||||
;;
|
||||
"$VIEW_ARTIST" | "$VIEW_SEARCH_ALBUM" | "$VIEW_LIST_ALBUMS")
|
||||
list_releases "$mbid" |
|
||||
while IFS= read -r line; do
|
||||
rmbid="$(echo "$line" | cut -d "$(printf '\t')" -f 4)"
|
||||
rpath="$(echo "$line" | cut -d "$(printf '\t')" -f 5)"
|
||||
[ "$rpath" ] || continue
|
||||
__generate_playlist "$rmbid" "$rpath" | mpv_queue_list >/dev/null
|
||||
done
|
||||
;;
|
||||
"$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 ;;
|
||||
@@ -128,7 +185,30 @@ playback() {
|
||||
"$PLAYBACK_CMD_QUEUE_NEXT")
|
||||
[ "$path" ] || exit 0
|
||||
case "$view" in
|
||||
"$VIEW_ARTIST" | "$VIEW_SEARCH_ARTIST" | "$VIEW_SEARCH_ALBUM" | "$VIEW_LIST_ARTISTS" | "$VIEW_LIST_ALBUMS") info "not implemented" ;;
|
||||
"$VIEW_SEARCH_ARTIST" | "$VIEW_LIST_ARTISTS")
|
||||
list_releasegroups "$mbid" |
|
||||
while IFS= read -r rgline; do
|
||||
rgmbid="$(echo "$rgline" | cut -d "$(printf '\t')" -f 4)"
|
||||
rgpath="$(echo "$rgline" | cut -d "$(printf '\t')" -f 5)"
|
||||
[ "$rgpath" ] || continue
|
||||
list_releases "$rgmbid" |
|
||||
while IFS= read -r line; do
|
||||
rmbid="$(echo "$line" | cut -d "$(printf '\t')" -f 4)"
|
||||
rpath="$(echo "$line" | cut -d "$(printf '\t')" -f 5)"
|
||||
[ "$rpath" ] || continue
|
||||
__generate_playlist "$rmbid" "$rpath" | mpv_queue_next_list >/dev/null
|
||||
done
|
||||
done
|
||||
;;
|
||||
"$VIEW_ARTIST" | "$VIEW_SEARCH_ALBUM" | "$VIEW_LIST_ALBUMS")
|
||||
list_releases "$mbid" |
|
||||
while IFS= read -r line; do
|
||||
rmbid="$(echo "$line" | cut -d "$(printf '\t')" -f 4)"
|
||||
rpath="$(echo "$line" | cut -d "$(printf '\t')" -f 5)"
|
||||
[ "$rpath" ] || continue
|
||||
__generate_playlist "$rmbid" "$rpath" | mpv_queue_next_list >/dev/null
|
||||
done
|
||||
;;
|
||||
"$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 ;;
|
||||
|
||||
Reference in New Issue
Block a user