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: Futures:
* Download tracks url's in playlist per page * 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 * All others futures maybe working 50/50
Depends: Depends:
@ -13,6 +15,8 @@ Depends:
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...): Demo (sorry for low quality...):
![demo](demo.webm) ![demo](demo.webm)

View file

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

View file

@ -18,15 +18,32 @@ funkwhale_api_get_tracks()
funkwhale_api_get_tracks_from_channel() funkwhale_api_get_tracks_from_channel()
{ {
sub_menu=1
track_list=$(curl -s --compressed "$instance_point/tracks?channel=$1&playable=true&include_channels=true") track_list=$(curl -s --compressed "$instance_point/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
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')
echo > podcast.m3u8 echo > podcast.m3u8
counter=0
track_name_url="{}"
for i in $listen_urls; do 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 echo "https://$instance$i\n" >> podcast.m3u8
counter=$(expr $counter + 1)
done
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 done
$default_player_command podcast.m3u8
} }
funkwhale_get_podcasts_artists() funkwhale_get_podcasts_artists()
@ -38,13 +55,14 @@ funkwhale_get_podcasts_artists()
echo "$count_artists avalaible" echo "$count_artists avalaible"
artist_channels=$(jj -l -i preload 'results.#.channel.uuid' | sed 's/"//g') 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') 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 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) counter=$(expr $counter + 1)
done done
menu_podcast_choice=$(echo $podcast_names | fzy) menu_podcast_choice=$(echo "$podcast_names" | fzy)
channel_uuid=$(jj -i $temp_artists "$menu_podcast_choice") channel_uuid=$(echo $temp_artists | jj "$menu_podcast_choice")
if [ -z $channel_uuid ]; then if [ -z $channel_uuid ]; then
echo 'Error when loading podcast' echo 'Error when loading podcast'
else else