From caa120b0d546feabf954e4a9176d3ee6a19a2046 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Tue, 2 Aug 2022 11:51:06 +0300 Subject: [PATCH] Menu for pseudofs --- funkwhale-cli.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/funkwhale-cli.sh b/funkwhale-cli.sh index a80b1a9..e5ef30f 100755 --- a/funkwhale-cli.sh +++ b/funkwhale-cli.sh @@ -360,7 +360,7 @@ funkwhale_pseudofs_load() next_check=$(echo "$tracks" | jj next) for idartist in $(echo "$tracks" | jj -l 'results.#.artist.id' | delq | sort -u); do mkdir -p "fwfs_$instance/$idartist" - if [ ! -f "fwfs_$instance/$idartist/playlist.m3u8" ]; then + if [ ! -f "fwfs_$instance/$idartist/playlist.m3u8" && ! -f "fwfs_$instance/$idartist/playlist.m3u8.noplay" ]; then echo '#EXTM3U' > "fwfs_$instance/$idartist/playlist.m3u8" fi @@ -401,12 +401,19 @@ funkwhale_pseudofs_transcode_switch() echo "Transcode to" transcode_ch=$(echo "none\nogg\nmp3" | fzy) if [ "$transcode_ch" = 'none' ]; then - find "fwfs_$instance" -type f -exec sed -i 's/to=.*/to=/' {} + + sed -i 's/to=.*/to=/' ./fwfs_$instance/*/*.m3u8 else - find "fwfs_$instance" -type f -exec sed -i "s/to=.*/to=$transcode_ch/" {} + + sed -i "s/to=.*/to=$transcode_ch/" ./fwfs_$instance/*/*.m3u8 fi } +funkwhale_pseudofs_update_listen_token() +{ + echo "Updating listen token for all tracks $instance ..." + sed -i "s/token=.*\&/token=$listen_token\&/" ./fwfs_$instance/*/*.m3u8 + echo "Done" +} + trackspls='Tracks' albumsmenu='Albums' artistmenu='Artists' @@ -485,8 +492,13 @@ case "$choice" in fi ;; "$load_pseudofs") - funkwhale_pseudofs_load ;; # beta - + menu_pseudofs=$(echo "Start\nSwitch transcode\nUpdate listen token" | fzy) + case "$menu_pseudofs" in + 'Start') funkwhale_pseudofs_load ;; # beta + 'Switch transcode') funkwhale_pseudofs_transcode_switch ;; + 'Update listen token') funkwhale_pseudofs_update_listen_token ;; + esac + ;; "$checkapilimits") funkwhale_api_check_api_limits | more ;;