From 79b8ff7bbd3c52602daede959d59dbe24162eccd Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Thu, 7 Apr 2022 03:01:48 +0300 Subject: [PATCH] Patch index instead name --- funkwhale-cli.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/funkwhale-cli.sh b/funkwhale-cli.sh index ae86a66..cca41e7 100755 --- a/funkwhale-cli.sh +++ b/funkwhale-cli.sh @@ -29,12 +29,13 @@ funkwhale_menu_albums() echo "Avalaible $(jj -i preload count) albums" sub_menu=1 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) case $menu_albums_choice in "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 esac done @@ -47,7 +48,7 @@ funkwhale_menu_albums_tracks() 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') menu_album_tracks_choice=$(echo "Back\nMain menu\nListen all\n$titles" | fzy) case $menu_album_tracks_choice in @@ -62,7 +63,8 @@ funkwhale_menu_albums_tracks() $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" ;; esac done @@ -75,13 +77,14 @@ funkwhale_api_get_tracks_from_channel() echo "Loaded $(echo $track_list | jj count) podcasts" 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) case $menu_podcast_choice in "Back") sub2_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" ;; esac done @@ -95,13 +98,14 @@ funkwhale_get_podcasts_artists() while [ $sub_menu -eq 1 ]; do count_artists=$(jj -i preload count) 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) case $menu_podcast_choice in "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 echo 'Error when loading podcast'