mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-30 04:41:27 +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'
|
ordering='title'
|
||||||
default_player_command='mpv --no-vid --no-ytdl --network-timeout=30'
|
default_player_command='mpv --no-vid --no-ytdl --network-timeout=30'
|
||||||
|
|
||||||
instance_point="https://$instance/api/v1"
|
|
||||||
funkwhale_api_check_api_limits()
|
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()
|
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'
|
jj -i preload -l 'results.#.uploads.0.listen_url' | sed 's/"//g'
|
||||||
}
|
}
|
||||||
|
|
||||||
funkwhale_api_get_tracks_from_channel()
|
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 "Loaded $(echo $track_list | jj count) podcasts"
|
||||||
echo $track_list | jj -l results.#.title
|
echo $track_list | jj -l results.#.title
|
||||||
listen_urls=$(echo $track_list | jj -l results.#.listen_url | sed 's/"//g')
|
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()
|
funkwhale_get_podcasts_artists()
|
||||||
{
|
{
|
||||||
echo 'Loading podcast 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
|
counter=0
|
||||||
count_artists=$(jj -i preload count)
|
count_artists=$(jj -i preload count)
|
||||||
echo "$count_artists avalaible"
|
echo "$count_artists avalaible"
|
||||||
|
@ -63,8 +62,8 @@ load_tracks_to_playlist()
|
||||||
echo "https://$instance$i\n" >> playlist.m3u8
|
echo "https://$instance$i\n" >> playlist.m3u8
|
||||||
done
|
done
|
||||||
count_tracks_results=$(jj -i preload 'results.#')
|
count_tracks_results=$(jj -i preload 'results.#')
|
||||||
if [ -z $count_tracks_results ] || [ $count_tracks_results -eq 0 ]; then
|
if [ -z $count_tracks_results ]; then
|
||||||
echo 'Error: Page empty or connection error'
|
echo 'Error: Page empty or 500 Internal Server Error'
|
||||||
else
|
else
|
||||||
echo "Loaded $count_tracks_results tracks"
|
echo "Loaded $count_tracks_results tracks"
|
||||||
fi
|
fi
|
||||||
|
@ -74,13 +73,7 @@ get_all_avalaible_count_tracks()
|
||||||
{
|
{
|
||||||
funkwhale_api_get_tracks 1 1>> /dev/null
|
funkwhale_api_get_tracks 1 1>> /dev/null
|
||||||
count_all_tracks=$(jj -i preload -l count)
|
count_all_tracks=$(jj -i preload -l count)
|
||||||
if [ -z $count_all_tracks ]; then
|
echo "Tracks avalaible on $instance: $count_all_tracks\n"
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_all_avalaible_count_tracks
|
get_all_avalaible_count_tracks
|
||||||
|
@ -95,8 +88,7 @@ Exit='Exit'
|
||||||
while true; do
|
while true; do
|
||||||
choice=$(echo "$downloadtrackspls\n$startplayer\n$podcasts\n$changepod\n$checkapilimits\n$Exit" | fzy)
|
choice=$(echo "$downloadtrackspls\n$startplayer\n$podcasts\n$changepod\n$checkapilimits\n$Exit" | fzy)
|
||||||
|
|
||||||
case "$choice" in
|
if [ "$choice" = "$downloadtrackspls" ]; then
|
||||||
"$downloadtrackspls")
|
|
||||||
echo 'Order by (prefix - is DESC ordering):'
|
echo 'Order by (prefix - is DESC ordering):'
|
||||||
ordering=$(echo 'title\n-title\ncreation_date\n-creation_date\nrelease_date\n-release_date\nrandom' | fzy)
|
ordering=$(echo 'title\n-title\ncreation_date\n-creation_date\nrelease_date\n-release_date\nrandom' | fzy)
|
||||||
export ordering
|
export ordering
|
||||||
|
@ -108,29 +100,21 @@ case "$choice" in
|
||||||
export tag
|
export tag
|
||||||
echo 'Enter page number: '
|
echo 'Enter page number: '
|
||||||
read page
|
read page
|
||||||
load_tracks_to_playlist $page ;;
|
load_tracks_to_playlist $page
|
||||||
|
elif [ "$choice" = "$startplayer" ]; then
|
||||||
|
$default_player_command playlist.m3u8
|
||||||
"$startplayer")
|
elif [ "$choice" = "$podcasts" ]; then
|
||||||
$default_player_command playlist.m3u8 ;;
|
|
||||||
|
|
||||||
|
|
||||||
"$podcasts")
|
|
||||||
echo 'Enter page number: '
|
echo 'Enter page number: '
|
||||||
read page
|
read page
|
||||||
funkwhale_get_podcasts_artists $page ;;
|
funkwhale_get_podcasts_artists $page
|
||||||
|
elif [ "$choice" = "$changepod" ]; then
|
||||||
|
|
||||||
"$changepod")
|
|
||||||
if [ 'Choice from list' = "$(echo 'Choice from list\nManual input' | fzy)" ]; 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)
|
instance=$(jj -l -i config.json public_list_instances | sed 's/"//g' | fzy)
|
||||||
else
|
else
|
||||||
echo "Type instance (ex. $instance):"
|
echo "Type instance (ex. $instance):"
|
||||||
read instance
|
read instance
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export instance
|
export instance
|
||||||
export instance_point="https://$instance/api/v1"
|
|
||||||
conf_instance_state=$(echo 'Permanent\nTemporaly' | fzy)
|
conf_instance_state=$(echo 'Permanent\nTemporaly' | fzy)
|
||||||
if [ "$conf_instance_state" = 'Permanent' ]; then
|
if [ "$conf_instance_state" = 'Permanent' ]; then
|
||||||
jj -i config.json instance -v $instance -o config.json
|
jj -i config.json instance -v $instance -o config.json
|
||||||
|
@ -138,14 +122,10 @@ case "$choice" in
|
||||||
echo ''
|
echo ''
|
||||||
fi
|
fi
|
||||||
clear
|
clear
|
||||||
get_all_avalaible_count_tracks ;;
|
get_all_avalaible_count_tracks
|
||||||
|
elif [ "$choice" = "$checkapilimits" ]; then
|
||||||
|
funkwhale_api_check_api_limits | more
|
||||||
"$checkapilimits")
|
elif [ "$choice" = "$Exit" ]; then
|
||||||
funkwhale_api_check_api_limits | more ;;
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
"$Exit")
|
|
||||||
exit 0 ;;
|
|
||||||
esac
|
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue