From 2c942fd9944b175eeaf2dc8ed4d92f44929ad3a9 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Mon, 4 Apr 2022 00:58:18 +0300 Subject: [PATCH] sub menu reconfigured --- funkwhale-cli.sh | 49 ++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/funkwhale-cli.sh b/funkwhale-cli.sh index 78df69f..f83650f 100755 --- a/funkwhale-cli.sh +++ b/funkwhale-cli.sh @@ -18,38 +18,47 @@ funkwhale_api_get_tracks() } funkwhale_api_get_tracks_from_channel() -{ - sub_menu=1 +{ + sub2_menu=1 track_list=$(curl -s --compressed "$instance_point/tracks?channel=$1&playable=true&include_channels=true") echo "Loaded $(echo $track_list | jj count) podcasts" - while [ $sub_menu -eq 1 ]; do - menu_podcast_choice=$(echo $track_list | jj -l 'results.#.title' | fzy) - play_track=$(echo $track_list | jj results.#[title="$menu_podcast_choice"].listen_url) - $default_player_command "https://$instance$play_track" - case $(echo "Back\nMain menu" | fzy) in - "Back") echo '' ;; - - "Main menu") sub_menu=0 ;; + while [ $sub2_menu -eq 1 ]; do + titles=$(echo $track_list | jj -l 'results.#.title') + menu_podcast_choice=$(echo "Main menu\nBack\n$titles" | fzy) + case $menu_podcast_choice in + "Main menu") sub2_menu=0 && sub_menu=0 ;; + "Back") sub2_menu=0 ;; + *) + play_track=$(echo $track_list | jj results.#[title="$menu_podcast_choice"].listen_url) + $default_player_command "https://$instance$play_track" ;; esac done } funkwhale_get_podcasts_artists() { + sub_menu=1 echo 'Loading podcast artists...' curl -s --compressed --output preload "$instance_point/artists?ordering=-creation_date&playable=true&include_channels=true&content_category=podcast&page=$1" - count_artists=$(jj -i preload count) - echo "$count_artists avalaible" - podcast_names=$(jj -l -i preload results.#.name) - menu_podcast_choice=$(echo "$podcast_names" | fzy) - channel_uuid=$(jj -i preload results.#[name="$menu_podcast_choice"].channel.uuid) + while [ $sub_menu -eq 1 ]; do + count_artists=$(jj -i preload count) + echo "$count_artists avalaible" + podcast_names=$(jj -l -i preload results.#.name) + menu_podcast_choice=$(echo "Main menu\n$podcast_names" | fzy) + case $menu_podcast_choice in + "Main menu") sub_menu=0 ;; + + *) + channel_uuid=$(jj -i preload results.#[name="$menu_podcast_choice"].channel.uuid) - if [ -z $channel_uuid ]; then - echo 'Error when loading podcast' - else - funkwhale_api_get_tracks_from_channel $channel_uuid - fi + if [ -z $channel_uuid ]; then + echo 'Error when loading podcast' + else + funkwhale_api_get_tracks_from_channel $channel_uuid + fi ;; + esac + done } load_tracks_to_playlist()