From a7edda6df25bc46137fe9b5f83a321dd5431451b Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Wed, 30 Mar 2022 18:36:18 +0300 Subject: [PATCH] Playlist m3u8 and titles tracks added --- funkwhale-cli.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/funkwhale-cli.sh b/funkwhale-cli.sh index 5f497a5..a04c050 100755 --- a/funkwhale-cli.sh +++ b/funkwhale-cli.sh @@ -11,7 +11,7 @@ funkwhale_api_check_api_limits() funkwhale_api_get_tracks() { - get_json=$(curl -s "https://$instance/api/v1/tracks?ordering=$ordering&playable=true&page=$1") + get_json=$(curl -s "https://$instance/api/v1/tracks?ordering=$ordering&playable=true&page=$1" 2>&1 | tee preload) export count_all_tracks=$(echo $get_json | jj -l count) echo $get_json | jj -l 'results.#.uploads.0.listen_url' | sed 's/"//g' } @@ -23,8 +23,14 @@ funkwhale_api_get_albums() load_tracks_to_playlist() { -for i in $(funkwhale_api_get_tracks $1); do - echo "https://$instance$i" >> playlist + echo "Loading page $1 ..." + echo '#EXTM3U\n' > playlist.m3u8 + counter_titles=0 + for i in $(funkwhale_api_get_tracks $1); do + title=$(cat preload | jj results."$counter_titles".title) + echo "#EXTINF:#,$title" >> playlist.m3u8 + counter_titles=$(expr $counter_titles + 1) + echo "https://$instance$i\n" >> playlist.m3u8 done } @@ -44,7 +50,7 @@ if [ "$choice" = "$downloadtrackspls" ]; then read page load_tracks_to_playlist $page elif [ "$choice" = "$startplayer" ]; then - $default_player --no-vid --no-ytdl --playlist=playlist + $default_player --no-vid --no-ytdl playlist.m3u8 elif [ "$choice" = "$checkapilimits" ]; then funkwhale_api_check_api_limits | more elif [ "$choice" = "$Exit" ]; then