Added view albums

This commit is contained in:
localhost_frssoft 2022-04-04 02:46:47 +03:00
parent 3f97aad4b3
commit 2a74f746d1

View file

@ -17,6 +17,48 @@ funkwhale_api_get_tracks()
jj -i preload -l 'results.#.uploads.0.listen_url' | sed 's/"//g'
}
funkwhale_api_get_albums()
{
get_json=$(curl -s --compressed "$instance_point/albums?ordering=$ordering&playable=true&page=$1" 2>&1 | tee preload)
}
funkwhale_menu_albums()
{
echo 'Loading albums...'
funkwhale_api_get_albums $1
echo "Avalaible $(jj -i preload count) albums"
sub_menu=1
while [ $sub_menu -eq 1 ]; do
titles=$(jj -i preload -l 'results.#.title')
menu_albums_choice=$(echo "Main menu\n$titles" | fzy)
case $menu_albums_choice in
"Main menu") sub_menu=0 ;;
*)
album_id=$(jj -i preload results.#[title="$menu_albums_choice"].id)
funkwhale_menu_albums_tracks $album_id
esac
done
}
funkwhale_menu_albums_tracks()
{
sub2_menu=1
get_json=$(curl -s --compressed "$instance_point/tracks?ordering=$ordering&playable=true&album=$1&page_size=50")
while [ $sub2_menu -eq 1 ]; do
titles=$(echo $get_json | jj -l results.#.title)
menu_album_tracks_choice=$(echo "Back\nMain menu\n$titles" | fzy)
case $menu_album_tracks_choice in
"Back") sub2_menu=0 ;;
"Main menu") sub2_menu=0 && sub_menu=0 ;;
*)
play_track=$(echo $get_json | jj results.#[title="$menu_album_tracks_choice"].listen_url)
$default_player_command "https://$instance$play_track" ;;
esac
done
}
funkwhale_api_get_tracks_from_channel()
{
sub2_menu=1
@ -99,13 +141,14 @@ get_all_avalaible_count_tracks
downloadtrackspls='Download tracks in playlist'
startplayer='Start player'
albumsmenu='Albums'
podcasts='Podcasts'
changepod='Switch instance'
checkapilimits='Check API limits (debug)'
Exit='Exit'
while true; do
choice=$(echo "$downloadtrackspls\n$startplayer\n$podcasts\n$changepod\n$checkapilimits\n$Exit" | fzy)
choice=$(echo "$downloadtrackspls\n$startplayer\n$albumsmenu\n$podcasts\n$changepod\n$checkapilimits\n$Exit" | fzy)
case "$choice" in
"$downloadtrackspls")
@ -126,6 +169,10 @@ case "$choice" in
"$startplayer")
$default_player_command playlist.m3u8 ;;
"$albumsmenu")
echo 'Enter page number: '
read page
funkwhale_menu_albums $page ;;
"$podcasts")
echo 'Enter page number: '