mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-22 23:11:28 +00:00
Compare commits
No commits in common. "eefc247b649ea9e9b4fe3d0515e4481f8f7fe539" and "6be73701cd248ddc844dd3ee4625fc88c58da903" have entirely different histories.
eefc247b64
...
6be73701cd
|
@ -4,21 +4,20 @@ instance=$(jj -i config.json instance)
|
|||
ordering='title'
|
||||
default_player_command='mpv --no-vid --no-ytdl --network-timeout=30'
|
||||
|
||||
instance_point="https://$instance/api/v1"
|
||||
funkwhale_api_check_api_limits()
|
||||
{
|
||||
curl -s --compressed "$instance_point/rate-limit/" | jj -p
|
||||
curl -s --compressed "https://$instance/api/v1/rate-limit/" | jj -p
|
||||
}
|
||||
|
||||
funkwhale_api_get_tracks()
|
||||
{
|
||||
get_json=$(curl -s --compressed "$instance_point/tracks?ordering=$ordering&playable=true&page=$1&tag=$tag" 2>&1 | tee preload)
|
||||
get_json=$(curl -s --compressed "https://$instance/api/v1/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'
|
||||
}
|
||||
|
||||
funkwhale_api_get_tracks_from_channel()
|
||||
{
|
||||
track_list=$(curl -s --compressed "$instance_point/tracks?channel=$1&playable=true&include_channels=true")
|
||||
track_list=$(curl -s --compressed "https://$instance/api/v1/tracks?channel=$1&playable=true&include_channels=true")
|
||||
echo "Loaded $(echo $track_list | jj count) podcasts"
|
||||
echo $track_list | jj -l results.#.title
|
||||
listen_urls=$(echo $track_list | jj -l results.#.listen_url | sed 's/"//g')
|
||||
|
@ -32,7 +31,7 @@ funkwhale_api_get_tracks_from_channel()
|
|||
funkwhale_get_podcasts_artists()
|
||||
{
|
||||
echo 'Loading podcast artists...'
|
||||
curl -s --compressed --output preload "$instance_point/artists?ordering=-creation_date&playable=true&include_channels=true&content_category=podcast&page=$1"
|
||||
curl -s --compressed --output preload "https://$instance/api/v1/artists?ordering=-creation_date&playable=true&include_channels=true&content_category=podcast&page=$1"
|
||||
counter=0
|
||||
count_artists=$(jj -i preload count)
|
||||
echo "$count_artists avalaible"
|
||||
|
@ -63,8 +62,8 @@ load_tracks_to_playlist()
|
|||
echo "https://$instance$i\n" >> playlist.m3u8
|
||||
done
|
||||
count_tracks_results=$(jj -i preload 'results.#')
|
||||
if [ -z $count_tracks_results ] || [ $count_tracks_results -eq 0 ]; then
|
||||
echo 'Error: Page empty or connection error'
|
||||
if [ -z $count_tracks_results ]; then
|
||||
echo 'Error: Page empty or 500 Internal Server Error'
|
||||
else
|
||||
echo "Loaded $count_tracks_results tracks"
|
||||
fi
|
||||
|
@ -74,13 +73,7 @@ get_all_avalaible_count_tracks()
|
|||
{
|
||||
funkwhale_api_get_tracks 1 1>> /dev/null
|
||||
count_all_tracks=$(jj -i preload -l count)
|
||||
if [ -z $count_all_tracks ]; then
|
||||
echo 'Error: Connection error or API limit expired'
|
||||
elif [ $count_all_tracks -eq 0 ]; then
|
||||
echo 'Error: No tracks'
|
||||
else
|
||||
echo "Tracks avalaible on $instance: $count_all_tracks\n"
|
||||
fi
|
||||
echo "Tracks avalaible on $instance: $count_all_tracks\n"
|
||||
}
|
||||
|
||||
get_all_avalaible_count_tracks
|
||||
|
@ -95,8 +88,7 @@ Exit='Exit'
|
|||
while true; do
|
||||
choice=$(echo "$downloadtrackspls\n$startplayer\n$podcasts\n$changepod\n$checkapilimits\n$Exit" | fzy)
|
||||
|
||||
case "$choice" in
|
||||
"$downloadtrackspls")
|
||||
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' | fzy)
|
||||
export ordering
|
||||
|
@ -108,29 +100,21 @@ case "$choice" in
|
|||
export tag
|
||||
echo 'Enter page number: '
|
||||
read page
|
||||
load_tracks_to_playlist $page ;;
|
||||
|
||||
|
||||
"$startplayer")
|
||||
$default_player_command playlist.m3u8 ;;
|
||||
|
||||
|
||||
"$podcasts")
|
||||
load_tracks_to_playlist $page
|
||||
elif [ "$choice" = "$startplayer" ]; then
|
||||
$default_player_command playlist.m3u8
|
||||
elif [ "$choice" = "$podcasts" ]; then
|
||||
echo 'Enter page number: '
|
||||
read page
|
||||
funkwhale_get_podcasts_artists $page ;;
|
||||
|
||||
|
||||
"$changepod")
|
||||
funkwhale_get_podcasts_artists $page
|
||||
elif [ "$choice" = "$changepod" ]; then
|
||||
if [ 'Choice from list' = "$(echo 'Choice from list\nManual input' | fzy)" ]; then
|
||||
instance=$(jj -l -i config.json public_list_instances | sed 's/"//g' | fzy)
|
||||
else
|
||||
echo "Type instance (ex. $instance):"
|
||||
read instance
|
||||
fi
|
||||
|
||||
export instance
|
||||
export instance_point="https://$instance/api/v1"
|
||||
conf_instance_state=$(echo 'Permanent\nTemporaly' | fzy)
|
||||
if [ "$conf_instance_state" = 'Permanent' ]; then
|
||||
jj -i config.json instance -v $instance -o config.json
|
||||
|
@ -138,14 +122,10 @@ case "$choice" in
|
|||
echo ''
|
||||
fi
|
||||
clear
|
||||
get_all_avalaible_count_tracks ;;
|
||||
|
||||
|
||||
"$checkapilimits")
|
||||
funkwhale_api_check_api_limits | more ;;
|
||||
|
||||
|
||||
"$Exit")
|
||||
exit 0 ;;
|
||||
esac
|
||||
get_all_avalaible_count_tracks
|
||||
elif [ "$choice" = "$checkapilimits" ]; then
|
||||
funkwhale_api_check_api_limits | more
|
||||
elif [ "$choice" = "$Exit" ]; then
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue