Playlist m3u8 and titles tracks added

This commit is contained in:
localhost_frssoft 2022-03-30 18:36:18 +03:00
parent 40b673cafc
commit a7edda6df2

View file

@ -11,7 +11,7 @@ funkwhale_api_check_api_limits()
funkwhale_api_get_tracks() 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) export count_all_tracks=$(echo $get_json | jj -l count)
echo $get_json | jj -l 'results.#.uploads.0.listen_url' | sed 's/"//g' 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() load_tracks_to_playlist()
{ {
for i in $(funkwhale_api_get_tracks $1); do echo "Loading page $1 ..."
echo "https://$instance$i" >> playlist 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 done
} }
@ -44,7 +50,7 @@ if [ "$choice" = "$downloadtrackspls" ]; then
read page read page
load_tracks_to_playlist $page load_tracks_to_playlist $page
elif [ "$choice" = "$startplayer" ]; then elif [ "$choice" = "$startplayer" ]; then
$default_player --no-vid --no-ytdl --playlist=playlist $default_player --no-vid --no-ytdl playlist.m3u8
elif [ "$choice" = "$checkapilimits" ]; then elif [ "$choice" = "$checkapilimits" ]; then
funkwhale_api_check_api_limits | more funkwhale_api_check_api_limits | more
elif [ "$choice" = "$Exit" ]; then elif [ "$choice" = "$Exit" ]; then