compressed requests

This commit is contained in:
localhost_frssoft 2022-03-31 19:59:33 +03:00
parent 60edd9f52e
commit c4f18d391d

View File

@ -6,18 +6,18 @@ default_player_command='mpv --no-vid --no-ytdl'
funkwhale_api_check_api_limits() funkwhale_api_check_api_limits()
{ {
curl -s "https://$instance/api/v1/rate-limit/" | jj -p curl -s --compressed "https://$instance/api/v1/rate-limit/" | jj -p
} }
funkwhale_api_get_tracks() funkwhale_api_get_tracks()
{ {
get_json=$(curl -s "https://$instance/api/v1/tracks?ordering=$ordering&playable=true&page=$1" 2>&1 | tee preload) get_json=$(curl -s --compressed "https://$instance/api/v1/tracks?ordering=$ordering&playable=true&page=$1" 2>&1 | tee preload)
jj -i preload -l 'results.#.uploads.0.listen_url' | sed 's/"//g' jj -i preload -l 'results.#.uploads.0.listen_url' | sed 's/"//g'
} }
funkwhale_api_get_tracks_from_channel() funkwhale_api_get_tracks_from_channel()
{ {
track_list=$(curl -s "https://$instance/api/v1/tracks?channel=$1&playable=true&include_channels=true") track_list=$(curl -s --compressed "https://$instance/api/v1/tracks?channel=$1&playable=true&include_channels=true")
echo "Loaded $(echo $track_list | jj count) podcasts" echo "Loaded $(echo $track_list | jj count) podcasts"
echo $track_list | jj -l results.#.title echo $track_list | jj -l results.#.title
listen_urls=$(echo $track_list | jj -l results.#.listen_url | sed 's/"//g') listen_urls=$(echo $track_list | jj -l results.#.listen_url | sed 's/"//g')
@ -31,7 +31,7 @@ funkwhale_api_get_tracks_from_channel()
funkwhale_get_podcasts_artists() funkwhale_get_podcasts_artists()
{ {
echo 'Loading podcast artists...' echo 'Loading podcast artists...'
curl -s --output preload "https://$instance/api/v1/artists?ordering=-creation_date&playable=true&include_channels=true&content_category=podcast&page=$1" curl -s --compressed --output preload "https://$instance/api/v1/artists?ordering=-creation_date&playable=true&include_channels=true&content_category=podcast&page=$1"
counter=0 counter=0
count_artists=$(jj -i preload count) count_artists=$(jj -i preload count)
echo "$count_artists avalaible" echo "$count_artists avalaible"