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 "$@"
}
fi
delq()
{
sed 's/"//g'
}
funkwhale_api_check_api_limits()
{
default_curl_opt "$instance_point/rate-limit/" | jj -p
@ -33,11 +39,11 @@ funkwhale_api_tags()
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' | gzip > tags_db/tags_$instance.gz
echo $tagsload | jj -l results.#.name | delq | 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' | gzip >> tags_db/tags_$instance.gz
echo $tagsload | jj -l results.#.name | delq | gzip >> tags_db/tags_$instance.gz
pageindex=$(echo $tagsload | jj next)
tagsload=$(default_curl_opt "$pageindex")
sleep 1
@ -67,7 +73,7 @@ funkwhale_menu_tracks()
while [ $sub2_menu -eq $level ]; do
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)
case $menu_album_tracks_choice in
"Back")
@ -81,7 +87,7 @@ funkwhale_menu_tracks()
"Listen all")
echo > 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
title=$(jj -i preload results."$counter_titles".title)
artist_name=$(jj -i preload results."$counter_titles".artist.name)
@ -151,7 +157,7 @@ funkwhale_menu_albums_tracks()
while [ $sub2_menu -eq $level ]; do
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)
case $menu_album_tracks_choice in
"Back")
@ -331,7 +337,7 @@ case "$choice" in
export ordering
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
"TagOFF") tag= ;;
"Tags from instance") funkwhale_api_tags ;;
@ -370,7 +376,7 @@ case "$choice" in
empty=1
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 ;;
esac