quotes deletor moved to function

This commit is contained in:
localhost_frssoft 2022-04-17 02:11:07 +03:00
parent 30ac2c503b
commit 431ce8e1a5

View File

@ -22,6 +22,12 @@ else
curl -s --compressed "$@" curl -s --compressed "$@"
} }
fi fi
delq()
{
sed 's/"//g'
}
funkwhale_api_check_api_limits() funkwhale_api_check_api_limits()
{ {
default_curl_opt "$instance_point/rate-limit/" | jj -p default_curl_opt "$instance_point/rate-limit/" | jj -p
@ -33,11 +39,11 @@ funkwhale_api_tags()
if [ ! -f "tags_db/tags_$instance.gz" ]; then if [ ! -f "tags_db/tags_$instance.gz" ]; then
tagsload=$(default_curl_opt "$instance_point/tags?playable=true") tagsload=$(default_curl_opt "$instance_point/tags?playable=true")
pageindex=$(echo $tagsload | jj next) pageindex=$(echo $tagsload | jj next)
echo $tagsload | jj -l results.#.name | sed 's/"//g' | gzip > tags_db/tags_$instance.gz echo $tagsload | jj -l results.#.name | delq | gzip > tags_db/tags_$instance.gz
clear clear
while [ -n "$pageindex" ]; do while [ -n "$pageindex" ]; do
echo "Loading... +$(echo $tagsload | jj results.#) tags" echo "Loading... +$(echo $tagsload | jj results.#) tags"
echo $tagsload | jj -l results.#.name | sed 's/"//g' | gzip >> tags_db/tags_$instance.gz echo $tagsload | jj -l results.#.name | delq | gzip >> tags_db/tags_$instance.gz
pageindex=$(echo $tagsload | jj next) pageindex=$(echo $tagsload | jj next)
tagsload=$(default_curl_opt "$pageindex") tagsload=$(default_curl_opt "$pageindex")
sleep 1 sleep 1
@ -67,7 +73,7 @@ funkwhale_menu_tracks()
while [ $sub2_menu -eq $level ]; do while [ $sub2_menu -eq $level ]; do
titles=$(jj -i preload -l results.#.title | nl -s: -v0 -w1) titles=$(jj -i preload -l results.#.title | nl -s: -v0 -w1)
playlist=$(jj -i preload -l results.#.listen_url | sed 's/"//g') playlist=$(jj -i preload -l results.#.listen_url | delq)
menu_album_tracks_choice=$(echo "Back\nMain menu\nListen all\n$titles" | fzy) menu_album_tracks_choice=$(echo "Back\nMain menu\nListen all\n$titles" | fzy)
case $menu_album_tracks_choice in case $menu_album_tracks_choice in
"Back") "Back")
@ -81,7 +87,7 @@ funkwhale_menu_tracks()
"Listen all") "Listen all")
echo > playlist.m3u8 echo > playlist.m3u8
chmod 600 playlist.m3u8 chmod 600 playlist.m3u8
tracks_for_playlist=$(jj -i preload -l 'results.#.uploads.0.listen_url' | sed 's/"//g') tracks_for_playlist=$(jj -i preload -l 'results.#.uploads.0.listen_url' | delq)
for i in $tracks_for_playlist; do for i in $tracks_for_playlist; do
title=$(jj -i preload results."$counter_titles".title) title=$(jj -i preload results."$counter_titles".title)
artist_name=$(jj -i preload results."$counter_titles".artist.name) artist_name=$(jj -i preload results."$counter_titles".artist.name)
@ -151,7 +157,7 @@ funkwhale_menu_albums_tracks()
while [ $sub2_menu -eq $level ]; do while [ $sub2_menu -eq $level ]; do
titles=$(echo $tracks_a | jj -l results.#.title | nl -s: -v0 -w1) titles=$(echo $tracks_a | jj -l results.#.title | nl -s: -v0 -w1)
playlist=$(echo $tracks_a | jj -l results.#.listen_url | sed 's/"//g') playlist=$(echo $tracks_a | jj -l results.#.listen_url | delq)
menu_album_tracks_choice=$(echo "Back\nMain menu\nListen all\n$titles" | fzy) menu_album_tracks_choice=$(echo "Back\nMain menu\nListen all\n$titles" | fzy)
case $menu_album_tracks_choice in case $menu_album_tracks_choice in
"Back") "Back")
@ -331,7 +337,7 @@ case "$choice" in
export ordering export ordering
echo 'Tags:' echo 'Tags:'
tag=$(echo "TagOFF\nTags from instance\n$(jj -l -i config.json tags | sed 's/\"//g')" | fzy) tag=$(echo "TagOFF\nTags from instance\n$(jj -l -i config.json tags | delq)" | fzy)
case $tag in case $tag in
"TagOFF") tag= ;; "TagOFF") tag= ;;
"Tags from instance") funkwhale_api_tags ;; "Tags from instance") funkwhale_api_tags ;;
@ -370,7 +376,7 @@ case "$choice" in
empty=1 empty=1
fi ;; fi ;;
"Choice from list") instance=$(jj -l -i config.json public_list_instances | sed 's/"//g' | fzy) ;; "Choice from list") instance=$(jj -l -i config.json public_list_instances | delq | fzy) ;;
"Manual input") echo "Type instance (ex. $instance):" && read instance ;; "Manual input") echo "Type instance (ex. $instance):" && read instance ;;
esac esac