Super simplify!

This commit is contained in:
localhost_frssoft 2022-04-03 17:57:32 +03:00
parent e34bc56616
commit e7ca06a9e8
2 changed files with 5 additions and 26 deletions

1
.gitignore vendored
View file

@ -1,4 +1,3 @@
playlist.m3u8 playlist.m3u8
podcast.m3u8
preload preload
instance.hist instance.hist

View file

@ -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") track_list=$(curl -s --compressed "$instance_point/tracks?channel=$1&playable=true&include_channels=true")
echo "Loaded $(echo $track_list | jj count) podcasts" 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 while [ $sub_menu -eq 1 ]; do
menu_podcast_choice=$(echo $track_list | jj -l 'results.#.title' | sed 's/["#\.\*\?&]//g' | fzy) menu_podcast_choice=$(echo $track_list | jj -l 'results.#.title' | fzy)
play_track=$(echo $track_name_url | jj "$menu_podcast_choice") play_track=$(echo $track_list | jj results.#[title="$menu_podcast_choice"].listen_url)
$default_player_command "https://$instance$play_track" $default_player_command "https://$instance$play_track"
case $(echo "Back\nMain menu" | fzy) in case $(echo "Back\nMain menu" | fzy) in
"Back") echo '' ;; "Back") echo '' ;;
@ -51,20 +39,12 @@ funkwhale_get_podcasts_artists()
{ {
echo 'Loading podcast 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" 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) count_artists=$(jj -i preload count)
echo "$count_artists avalaible" echo "$count_artists avalaible"
artist_channels=$(jj -l -i preload 'results.#.channel.uuid' | sed 's/"//g') podcast_names=$(jj -l -i preload results.#.name)
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
menu_podcast_choice=$(echo "$podcast_names" | fzy) 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 if [ -z $channel_uuid ]; then
echo 'Error when loading podcast' echo 'Error when loading podcast'
else else