Compare commits

...

6 commits

3 changed files with 52 additions and 12 deletions

View file

@ -3,6 +3,8 @@ Just for fun. Simple "player" API script for FunkWhale instances.
Futures:
* Download tracks url's in playlist per page
* Select and listen podcasts
* Switch instance from public list in config.json[1] or manual input
* All others futures maybe working 50/50
Depends:
@ -11,7 +13,9 @@ Depends:
* [curl](https://curl.se/)
* [fzy](https://github.com/jhawthorn/fzy)
Also, thk Horhik for FunkWhale instance (set by default instance)
Also, thk Horhik for FunkWhale instance (set by default instance)
[1]**Warning:** "Public" list instances in config.json may content _unofficial instance_
___
Demo (sorry for low quality...):

View file

@ -3,13 +3,31 @@
"tags": [
"TagOFF",
"8bit",
"Alternative",
"Ambient",
"Bluez",
"Reggae",
"Classical",
"Comedy",
"Country",
"Dance",
"Blues",
"Electronic",
"Electronica",
"Classic",
"Violin"
"Hip-Hop",
"Industrial",
"Instrumental",
"J-Pop",
"Jazz",
"Karaoke",
"Latin",
"Metal",
"Opera",
"Pop",
"Progressive",
"Reggae",
"Rock",
"Singler",
"Songwriter",
"Soundtrack",
"Vocal"
],
"public_list_instances": [
"open.audio",

View file

@ -18,15 +18,32 @@ funkwhale_api_get_tracks()
funkwhale_api_get_tracks_from_channel()
{
sub_menu=1
track_list=$(curl -s --compressed "$instance_point/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')
echo > podcast.m3u8
counter=0
track_name_url="{}"
for i in $listen_urls; do
title=$(echo $track_list | jj results.$counter.title | sed 's/["#\.]//g')
track_name_url_writer=$(echo $track_name_url | jj -v $i "$title")
track_name_url="${track_name_url_writer}"
echo "https://$instance$i\n" >> podcast.m3u8
counter=$(expr $counter + 1)
done
$default_player_command podcast.m3u8
while [ $sub_menu -eq 1 ]; do
menu_podcast_choice=$(echo $track_list | jj -l 'results.#.title' | sed 's/["#\.]//g' | fzy)
play_track=$(echo $track_name_url | jj "$menu_podcast_choice")
$default_player_command "https://$instance$play_track"
case $(echo "Back\nMain menu" | fzy) in
"Back") echo '' ;;
"Main menu") sub_menu=0 ;;
esac
done
}
funkwhale_get_podcasts_artists()
@ -38,13 +55,14 @@ funkwhale_get_podcasts_artists()
echo "$count_artists avalaible"
artist_channels=$(jj -l -i preload 'results.#.channel.uuid' | sed 's/"//g')
podcast_names=$(jj -l -i preload results.#.name | sed 's/\./_/g' | sed 's/"//g')
temp_artists=$(mktemp)
temp_artists="{}"
for i in $artist_channels; do
jj -i $temp_artists -v "$i" -o $temp_artists "$(jj -i preload results.$counter.name | sed 's/\./_/g' | sed 's/\"//g')"
name_uuid=$(echo $temp_artists | jj -v "$i" "$(jj -i preload results.$counter.name | sed 's/\./_/g' | sed 's/\"//g')")
temp_artists="${name_uuid}"
counter=$(expr $counter + 1)
done
menu_podcast_choice=$(echo $podcast_names | fzy)
channel_uuid=$(jj -i $temp_artists "$menu_podcast_choice")
menu_podcast_choice=$(echo "$podcast_names" | fzy)
channel_uuid=$(echo $temp_artists | jj "$menu_podcast_choice")
if [ -z $channel_uuid ]; then
echo 'Error when loading podcast'
else