Added gzip compression for instance tags

This commit is contained in:
localhost_frssoft 2022-04-15 22:11:29 +03:00
parent f0ef665ca0
commit 30ac2c503b

View File

@ -30,20 +30,21 @@ funkwhale_api_check_api_limits()
funkwhale_api_tags()
{
mkdir -p tags_db
if [ ! -f "tags_db/tags_$instance" ]; then
if [ ! -f "tags_db/tags_$instance.gz" ]; then
tagsload=$(default_curl_opt "$instance_point/tags?playable=true")
pageindex=$(echo $tagsload | jj next)
echo $tagsload | jj -l results.#.name | sed 's/"//g' > tags_db/tags_$instance
echo $tagsload | jj -l results.#.name | sed 's/"//g' | gzip > tags_db/tags_$instance.gz
clear
while [ -n "$pageindex" ]; do
echo "Loading... +$(echo $tagsload | jj results.#) tags"
echo $tagsload | jj -l results.#.name | sed 's/"//g' >> tags_db/tags_$instance
echo $tagsload | jj -l results.#.name | sed 's/"//g' | gzip >> tags_db/tags_$instance.gz
pageindex=$(echo $tagsload | jj next)
tagsload=$(default_curl_opt "$pageindex")
sleep 1
done
fi
tag=$(cat tags_db/tags_$instance | fzy)
tag=$(cat tags_db/tags_$instance.gz | gzip -d | fzy)
}
funkwhale_api_get_tracks()