From 8b60996e7966d000d39dc829a89f8029051b7442 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Sat, 2 Apr 2022 02:26:22 +0300 Subject: [PATCH] instance point api --- funkwhale-cli.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/funkwhale-cli.sh b/funkwhale-cli.sh index 32ba797..1af6733 100755 --- a/funkwhale-cli.sh +++ b/funkwhale-cli.sh @@ -4,20 +4,21 @@ instance=$(jj -i config.json instance) ordering='title' default_player_command='mpv --no-vid --no-ytdl --network-timeout=30' +instance_point="https://$instance/api/v1" funkwhale_api_check_api_limits() { - curl -s --compressed "https://$instance/api/v1/rate-limit/" | jj -p + curl -s --compressed "$instance_point/rate-limit/" | jj -p } funkwhale_api_get_tracks() { - get_json=$(curl -s --compressed "https://$instance/api/v1/tracks?ordering=$ordering&playable=true&page=$1&tag=$tag" 2>&1 | tee preload) + get_json=$(curl -s --compressed "$instance_point/tracks?ordering=$ordering&playable=true&page=$1&tag=$tag" 2>&1 | tee preload) jj -i preload -l 'results.#.uploads.0.listen_url' | sed 's/"//g' } funkwhale_api_get_tracks_from_channel() { - track_list=$(curl -s --compressed "https://$instance/api/v1/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 $track_list | jj -l results.#.title listen_urls=$(echo $track_list | jj -l results.#.listen_url | sed 's/"//g') @@ -31,7 +32,7 @@ funkwhale_api_get_tracks_from_channel() funkwhale_get_podcasts_artists() { echo 'Loading podcast artists...' - curl -s --compressed --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 "$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"