mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-12-23 11:33:33 +02:00
Feature: added artist menu; fixes
This commit is contained in:
parent
6407e54f36
commit
2c6d67f584
1 changed files with 79 additions and 9 deletions
|
@ -36,23 +36,35 @@ funkwhale_menu_albums()
|
|||
*)
|
||||
index=$(echo $menu_albums_choice | cut -f 1 -d:)
|
||||
album_id=$(jj -i preload results.$index.id)
|
||||
funkwhale_menu_albums_tracks $album_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")
|
||||
if [ $sub2_menu -eq 1 ]; then
|
||||
sub2_menu=2
|
||||
level=2
|
||||
else
|
||||
sub2_menu=1
|
||||
level=1
|
||||
fi
|
||||
|
||||
tracks_a=$(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 | nl -s: -v0 -w1)
|
||||
playlist=$(echo $get_json | jj -l results.#.listen_url | sed 's/"//g')
|
||||
while [ $sub2_menu -eq $level ]; do
|
||||
titles=$(echo $tracks_a | jj -l results.#.title | nl -s: -v0 -w1)
|
||||
playlist=$(echo $tracks_a | jj -l results.#.listen_url | sed 's/"//g')
|
||||
menu_album_tracks_choice=$(echo "Back\nMain menu\nListen all\n$titles" | fzy)
|
||||
case $menu_album_tracks_choice in
|
||||
"Back") sub2_menu=0 ;;
|
||||
"Back")
|
||||
if [ $sub2_menu -eq 2 ]; then
|
||||
sub2_menu=1
|
||||
else
|
||||
sub2_menu=0
|
||||
fi ;;
|
||||
"Main menu") sub2_menu=0 && sub_menu=0 ;;
|
||||
|
||||
"Listen all")
|
||||
|
@ -64,12 +76,64 @@ funkwhale_menu_albums_tracks()
|
|||
|
||||
*)
|
||||
index=$(echo $menu_album_tracks_choice | cut -f 1 -d:)
|
||||
play_track=$(echo $get_json | jj results.$index.listen_url)
|
||||
play_track=$(echo $tracks_a | jj results.$index.listen_url)
|
||||
$default_player_command "https://$instance$play_track" ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
funkwhale_api_get_artists()
|
||||
{
|
||||
curl -s --compressed "$instance_point/artists?ordering=-creation_date&playable=true&page=$1"
|
||||
}
|
||||
|
||||
funkwhale_api_get_artist()
|
||||
{
|
||||
curl -s --compressed "$instance_point/artists/$1"
|
||||
}
|
||||
|
||||
funkwhale_menu_artists()
|
||||
{
|
||||
echo 'Loading artists...'
|
||||
get_json=$(funkwhale_api_get_artists $1)
|
||||
echo "Avalaible $(echo $get_json | jj count) artists"
|
||||
sub_menu=1
|
||||
while [ $sub_menu -eq 1 ]; do
|
||||
names=$(echo $get_json | jj -l 'results.#.name' | nl -s: -v0 -w1)
|
||||
menu_artists_choice=$(echo "Main menu\n$names" | fzy)
|
||||
case $menu_artists_choice in
|
||||
"Main menu") sub_menu=0 ;;
|
||||
*)
|
||||
index=$(echo $menu_artists_choice | cut -f 1 -d:)
|
||||
artist_id=$(echo $get_json | jj results.$index.id)
|
||||
funkwhale_menu_albums_artist $artist_id
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
funkwhale_menu_albums_artist()
|
||||
{
|
||||
echo 'Loading albums...'
|
||||
albums_a=$(funkwhale_api_get_artist $1)
|
||||
standart_albums='albums.#.title'
|
||||
count_type='albums.#'
|
||||
index_type='albums'
|
||||
echo "Avalaible $(echo $albums_a | jj $count_type) albums"
|
||||
sub2_menu=1
|
||||
while [ $sub2_menu -eq 1 ]; do
|
||||
titles=$(echo $albums_a | jj -l $standart_albums | nl -s: -v0 -w1)
|
||||
menu_albums_choice=$(echo "Back\nMain menu\n$titles" | fzy)
|
||||
case $menu_albums_choice in
|
||||
"Main menu") sub2_menu=0 && sub_menu=0 ;;
|
||||
"Back") sub2_menu=0 ;;
|
||||
*)
|
||||
index=$(echo $menu_albums_choice | cut -f 1 -d:)
|
||||
album_id=$(echo $albums_a | jj $index_type.$index.id)
|
||||
funkwhale_menu_albums_tracks $album_id
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
funkwhale_api_get_tracks_from_channel()
|
||||
{
|
||||
sub2_menu=1
|
||||
|
@ -155,13 +219,14 @@ get_all_avalaible_count_tracks
|
|||
downloadtrackspls='Download tracks in playlist'
|
||||
startplayer='Start player'
|
||||
albumsmenu='Albums'
|
||||
artistmenu='Artists'
|
||||
podcasts='Podcasts'
|
||||
changepod='Switch instance'
|
||||
checkapilimits='Check API limits (debug)'
|
||||
Exit='Exit'
|
||||
|
||||
while true; do
|
||||
choice=$(echo "$downloadtrackspls\n$startplayer\n$albumsmenu\n$podcasts\n$changepod\n$checkapilimits\n$Exit" | fzy)
|
||||
choice=$(echo "$downloadtrackspls\n$startplayer\n$albumsmenu\n$artistmenu\n$podcasts\n$changepod\n$checkapilimits\n$Exit" | fzy)
|
||||
|
||||
case "$choice" in
|
||||
"$downloadtrackspls")
|
||||
|
@ -186,6 +251,11 @@ case "$choice" in
|
|||
echo 'Enter page number: '
|
||||
read page
|
||||
funkwhale_menu_albums $page ;;
|
||||
|
||||
"$artistmenu")
|
||||
echo 'Enter page number: '
|
||||
read page
|
||||
funkwhale_menu_artists $page ;;
|
||||
|
||||
"$podcasts")
|
||||
echo 'Enter page number: '
|
||||
|
|
Loading…
Reference in a new issue