instance point api

This commit is contained in:
localhost_frssoft 2022-04-02 02:26:22 +03:00
parent 6be73701cd
commit 8b60996e79

View File

@ -4,20 +4,21 @@ instance=$(jj -i config.json instance)
ordering='title' ordering='title'
default_player_command='mpv --no-vid --no-ytdl --network-timeout=30' default_player_command='mpv --no-vid --no-ytdl --network-timeout=30'
instance_point="https://$instance/api/v1"
funkwhale_api_check_api_limits() 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() 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' 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 --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 "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 +32,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 --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 counter=0
count_artists=$(jj -i preload count) count_artists=$(jj -i preload count)
echo "$count_artists avalaible" echo "$count_artists avalaible"