Patch index instead name

This commit is contained in:
localhost_frssoft 2022-04-07 03:01:48 +03:00
parent c86ee8dd24
commit 79b8ff7bbd

View file

@ -29,12 +29,13 @@ funkwhale_menu_albums()
echo "Avalaible $(jj -i preload count) albums" echo "Avalaible $(jj -i preload count) albums"
sub_menu=1 sub_menu=1
while [ $sub_menu -eq 1 ]; do while [ $sub_menu -eq 1 ]; do
titles=$(jj -i preload -l 'results.#.title') titles=$(jj -i preload -l 'results.#.title' | nl -s: -v0 -w1)
menu_albums_choice=$(echo "Main menu\n$titles" | fzy) menu_albums_choice=$(echo "Main menu\n$titles" | fzy)
case $menu_albums_choice in case $menu_albums_choice in
"Main menu") sub_menu=0 ;; "Main menu") sub_menu=0 ;;
*) *)
album_id=$(jj -i preload results.#[title="$menu_albums_choice"].id) 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 esac
done done
@ -47,7 +48,7 @@ funkwhale_menu_albums_tracks()
while [ $sub2_menu -eq 1 ]; do while [ $sub2_menu -eq 1 ]; do
titles=$(echo $get_json | jj -l results.#.title) titles=$(echo $get_json | jj -l results.#.title | nl -s: -v0 -w1)
playlist=$(echo $get_json | jj -l results.#.listen_url | sed 's/"//g') playlist=$(echo $get_json | jj -l results.#.listen_url | sed 's/"//g')
menu_album_tracks_choice=$(echo "Back\nMain menu\nListen all\n$titles" | fzy) menu_album_tracks_choice=$(echo "Back\nMain menu\nListen all\n$titles" | fzy)
case $menu_album_tracks_choice in case $menu_album_tracks_choice in
@ -62,7 +63,8 @@ funkwhale_menu_albums_tracks()
$default_player_command playlist.m3u8 ;; $default_player_command playlist.m3u8 ;;
*) *)
play_track=$(echo $get_json | jj results.#[title="$menu_album_tracks_choice"].listen_url) index=$(echo $menu_album_tracks_choice | cut -f 1 -d:)
play_track=$(echo $get_json | jj results.$index.listen_url)
$default_player_command "https://$instance$play_track" ;; $default_player_command "https://$instance$play_track" ;;
esac esac
done done
@ -75,13 +77,14 @@ funkwhale_api_get_tracks_from_channel()
echo "Loaded $(echo $track_list | jj count) podcasts" echo "Loaded $(echo $track_list | jj count) podcasts"
while [ $sub2_menu -eq 1 ]; do while [ $sub2_menu -eq 1 ]; do
titles=$(echo $track_list | jj -l 'results.#.title') titles=$(echo $track_list | jj -l 'results.#.title' | nl -s: -v0 -w1)
menu_podcast_choice=$(echo "Back\nMain menu\n$titles" | fzy) menu_podcast_choice=$(echo "Back\nMain menu\n$titles" | fzy)
case $menu_podcast_choice in case $menu_podcast_choice in
"Back") sub2_menu=0 ;; "Back") sub2_menu=0 ;;
"Main menu") sub2_menu=0 && sub_menu=0 ;; "Main menu") sub2_menu=0 && sub_menu=0 ;;
*) *)
play_track=$(echo $track_list | jj results.#[title="$menu_podcast_choice"].listen_url) index=$(echo $menu_podcast_choice | cut -f 1 -d:)
play_track=$(echo $track_list | jj results.$index.listen_url)
$default_player_command "https://$instance$play_track" ;; $default_player_command "https://$instance$play_track" ;;
esac esac
done done
@ -95,13 +98,14 @@ funkwhale_get_podcasts_artists()
while [ $sub_menu -eq 1 ]; do while [ $sub_menu -eq 1 ]; do
count_artists=$(jj -i preload count) count_artists=$(jj -i preload count)
echo "$count_artists avalaible" echo "$count_artists avalaible"
podcast_names=$(jj -l -i preload results.#.name) podcast_names=$(jj -l -i preload results.#.name | nl -s: -v0 -w1)
menu_podcast_choice=$(echo "Main menu\n$podcast_names" | fzy) menu_podcast_choice=$(echo "Main menu\n$podcast_names" | fzy)
case $menu_podcast_choice in case $menu_podcast_choice in
"Main menu") sub_menu=0 ;; "Main menu") sub_menu=0 ;;
*) *)
channel_uuid=$(jj -i preload results.#[name="$menu_podcast_choice"].channel.uuid) index=$(echo $menu_podcast_choice | cut -f 1 -d:)
channel_uuid=$(jj -i preload results.$index.channel.uuid)
if [ -z $channel_uuid ]; then if [ -z $channel_uuid ]; then
echo 'Error when loading podcast' echo 'Error when loading podcast'