From e7ca06a9e83d190b76d2c883ecdfe4a07118ff63 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Sun, 3 Apr 2022 17:57:32 +0300 Subject: [PATCH] Super simplify! --- .gitignore | 1 - funkwhale-cli.sh | 30 +++++------------------------- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index 68cbea8..8ea109f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ playlist.m3u8 -podcast.m3u8 preload instance.hist diff --git a/funkwhale-cli.sh b/funkwhale-cli.sh index 7302fc2..78df69f 100755 --- a/funkwhale-cli.sh +++ b/funkwhale-cli.sh @@ -23,21 +23,9 @@ funkwhale_api_get_tracks_from_channel() track_list=$(curl -s --compressed "$instance_point/tracks?channel=$1&playable=true&include_channels=true") echo "Loaded $(echo $track_list | jj count) podcasts" - listen_urls=$(echo $track_list | jj -l results.#.listen_url | sed 's/"//g') - echo > podcast.m3u8 - counter=0 - track_name_url="{}" - for i in $listen_urls; do - title=$(echo $track_list | jj results.$counter.title | sed 's/["#\.\*\?&]//g') - track_name_url_writer=$(echo $track_name_url | jj -v $i "$title") - track_name_url="${track_name_url_writer}" - echo "https://$instance$i\n" >> podcast.m3u8 - counter=$(expr $counter + 1) - done - while [ $sub_menu -eq 1 ]; do - menu_podcast_choice=$(echo $track_list | jj -l 'results.#.title' | sed 's/["#\.\*\?&]//g' | fzy) - play_track=$(echo $track_name_url | jj "$menu_podcast_choice") + menu_podcast_choice=$(echo $track_list | jj -l 'results.#.title' | fzy) + play_track=$(echo $track_list | jj results.#[title="$menu_podcast_choice"].listen_url) $default_player_command "https://$instance$play_track" case $(echo "Back\nMain menu" | fzy) in "Back") echo '' ;; @@ -51,20 +39,12 @@ funkwhale_get_podcasts_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" - counter=0 count_artists=$(jj -i preload count) echo "$count_artists avalaible" - artist_channels=$(jj -l -i preload 'results.#.channel.uuid' | sed 's/"//g') - podcast_names=$(jj -l -i preload results.#.name | sed 's/["#\.\*\?&]//g') - temp_artists="{}" - for i in $artist_channels; do - name=$(jj -i preload results.$counter.name | sed 's/["#\.\*\?&]//g') - name_uuid=$(echo $temp_artists | jj -v "$i" "$name") - temp_artists="${name_uuid}" - counter=$(expr $counter + 1) - done + podcast_names=$(jj -l -i preload results.#.name) menu_podcast_choice=$(echo "$podcast_names" | fzy) - channel_uuid=$(echo $temp_artists | jj "$menu_podcast_choice") + channel_uuid=$(jj -i preload results.#[name="$menu_podcast_choice"].channel.uuid) + if [ -z $channel_uuid ]; then echo 'Error when loading podcast' else