Menu for pseudofs

This commit is contained in:
localhost_frssoft 2022-08-02 11:51:06 +03:00
parent dba175f9a6
commit caa120b0d5

View File

@ -360,7 +360,7 @@ funkwhale_pseudofs_load()
next_check=$(echo "$tracks" | jj next) next_check=$(echo "$tracks" | jj next)
for idartist in $(echo "$tracks" | jj -l 'results.#.artist.id' | delq | sort -u); do for idartist in $(echo "$tracks" | jj -l 'results.#.artist.id' | delq | sort -u); do
mkdir -p "fwfs_$instance/$idartist" 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" echo '#EXTM3U' > "fwfs_$instance/$idartist/playlist.m3u8"
fi fi
@ -401,12 +401,19 @@ funkwhale_pseudofs_transcode_switch()
echo "Transcode to" echo "Transcode to"
transcode_ch=$(echo "none\nogg\nmp3" | fzy) transcode_ch=$(echo "none\nogg\nmp3" | fzy)
if [ "$transcode_ch" = 'none' ]; then 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 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 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' trackspls='Tracks'
albumsmenu='Albums' albumsmenu='Albums'
artistmenu='Artists' artistmenu='Artists'
@ -485,8 +492,13 @@ case "$choice" in
fi ;; fi ;;
"$load_pseudofs") "$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") "$checkapilimits")
funkwhale_api_check_api_limits | more ;; funkwhale_api_check_api_limits | more ;;