mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-24 09:41:27 +00:00
fixes and added tracks counter per page
This commit is contained in:
parent
756d11f99c
commit
aad56b6fe8
|
@ -12,8 +12,7 @@ funkwhale_api_check_api_limits()
|
|||
funkwhale_api_get_tracks()
|
||||
{
|
||||
get_json=$(curl -s "https://$instance/api/v1/tracks?ordering=$ordering&playable=true&page=$1" 2>&1 | tee preload)
|
||||
export count_all_tracks=$(echo $get_json | jj -l count)
|
||||
echo $get_json | jj -l 'results.#.uploads.0.listen_url' | sed 's/"//g'
|
||||
jj -i preload -l 'results.#.uploads.0.listen_url' | sed 's/"//g'
|
||||
}
|
||||
|
||||
funkwhale_api_get_albums()
|
||||
|
@ -27,16 +26,23 @@ load_tracks_to_playlist()
|
|||
echo '#EXTM3U\n' > playlist.m3u8
|
||||
counter_titles=0
|
||||
for i in $(funkwhale_api_get_tracks $1); do
|
||||
title=$(cat preload | jj results."$counter_titles".title)
|
||||
title=$(jj -i preload results."$counter_titles".title)
|
||||
echo "#EXTINF:-1, $counter_titles - $title" >> playlist.m3u8
|
||||
counter_titles=$(expr $counter_titles + 1)
|
||||
echo "https://$instance$i\n" >> playlist.m3u8
|
||||
done
|
||||
count_tracks_results=$(jj -i preload 'results.#')
|
||||
if [ -z $count_tracks_results ]; then
|
||||
echo 'Error: Page empty or 500 Internal Server Error'
|
||||
else
|
||||
echo "Loaded $count_tracks_results tracks"
|
||||
fi
|
||||
}
|
||||
|
||||
get_all_avalaible_count_tracks()
|
||||
{
|
||||
funkwhale_api_get_tracks 1 1>> /dev/null
|
||||
count_all_tracks=$(jj -i preload -l count)
|
||||
echo "Tracks avalaible on $instance: $count_all_tracks\n"
|
||||
}
|
||||
|
||||
|
@ -53,7 +59,7 @@ choice=$(echo "$downloadtrackspls\n$startplayer\n$changepod\n$checkapilimits\n$E
|
|||
|
||||
if [ "$choice" = "$downloadtrackspls" ]; then
|
||||
echo 'Order by (prefix - is DESC ordering):'
|
||||
ordering=$(echo 'title\n-title\ncreation_date\n-creation_date\nrelease_date\n-release_date\nrandom\n-random' | fzy)
|
||||
ordering=$(echo 'title\n-title\ncreation_date\n-creation_date\nrelease_date\n-release_date\nrandom' | fzy)
|
||||
export ordering
|
||||
echo 'Enter page number: '
|
||||
read page
|
||||
|
|
Loading…
Reference in a new issue