sub menu reconfigured

This commit is contained in:
localhost_frssoft 2022-04-04 00:58:18 +03:00
parent e7ca06a9e8
commit 2c942fd994

View file

@ -18,38 +18,47 @@ funkwhale_api_get_tracks()
} }
funkwhale_api_get_tracks_from_channel() 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") track_list=$(curl -s --compressed "$instance_point/tracks?channel=$1&playable=true&include_channels=true")
echo "Loaded $(echo $track_list | jj count) podcasts" echo "Loaded $(echo $track_list | jj count) podcasts"
while [ $sub_menu -eq 1 ]; do while [ $sub2_menu -eq 1 ]; do
menu_podcast_choice=$(echo $track_list | jj -l 'results.#.title' | fzy) titles=$(echo $track_list | jj -l 'results.#.title')
play_track=$(echo $track_list | jj results.#[title="$menu_podcast_choice"].listen_url) menu_podcast_choice=$(echo "Main menu\nBack\n$titles" | fzy)
$default_player_command "https://$instance$play_track" case $menu_podcast_choice in
case $(echo "Back\nMain menu" | fzy) in "Main menu") sub2_menu=0 && sub_menu=0 ;;
"Back") echo '' ;; "Back") sub2_menu=0 ;;
*)
"Main menu") sub_menu=0 ;; play_track=$(echo $track_list | jj results.#[title="$menu_podcast_choice"].listen_url)
$default_player_command "https://$instance$play_track" ;;
esac esac
done done
} }
funkwhale_get_podcasts_artists() funkwhale_get_podcasts_artists()
{ {
sub_menu=1
echo 'Loading podcast artists...' 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" 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) while [ $sub_menu -eq 1 ]; do
echo "$count_artists avalaible" count_artists=$(jj -i preload count)
podcast_names=$(jj -l -i preload results.#.name) echo "$count_artists avalaible"
menu_podcast_choice=$(echo "$podcast_names" | fzy) podcast_names=$(jj -l -i preload results.#.name)
channel_uuid=$(jj -i preload results.#[name="$menu_podcast_choice"].channel.uuid) 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 if [ -z $channel_uuid ]; then
echo 'Error when loading podcast' echo 'Error when loading podcast'
else else
funkwhale_api_get_tracks_from_channel $channel_uuid funkwhale_api_get_tracks_from_channel $channel_uuid
fi fi ;;
esac
done
} }
load_tracks_to_playlist() load_tracks_to_playlist()