mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-22 10:31:28 +00:00
New: simulate funkwhale fs (beta)
This commit is contained in:
parent
64e74bca2f
commit
658d50a825
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"instance": "sound.redeyes.club",
|
"instance": "fw.ponychord.rocks",
|
||||||
"download_selected_track": false,
|
"download_selected_track": false,
|
||||||
"tags": [
|
"tags": [
|
||||||
"8bit",
|
"8bit",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
instance=$(jj -i config.json instance)
|
instance=$(jj -i config.json instance)
|
||||||
instance_hist='instance.hist'
|
instance_hist='instance.hist'
|
||||||
ordering='title'
|
ordering='-creation_date'
|
||||||
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"
|
instance_point="https://$instance/api/v1"
|
||||||
download_selected_track=$(jj -i config.json download_selected_track)
|
download_selected_track=$(jj -i config.json download_selected_track)
|
||||||
|
@ -64,7 +64,7 @@ funkwhale_api_tags()
|
||||||
funkwhale_api_get_tracks()
|
funkwhale_api_get_tracks()
|
||||||
{
|
{
|
||||||
default_curl_opt \
|
default_curl_opt \
|
||||||
"$instance_point/tracks?ordering=$ordering&playable=true&page=$1&tag=$tag&artist=$2" \
|
"$instance_point/tracks?ordering=$ordering&playable=true&page_size=50&page=$1&tag=$tag&artist=$2" \
|
||||||
2>&1 | tee preload
|
2>&1 | tee preload
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,6 +346,36 @@ get_all_avalaible_count_tracks()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
funkwhale_pseudofs_load()
|
||||||
|
{
|
||||||
|
# Создаёт дерево каталогов из id исполнителей
|
||||||
|
# В каждый каталог складывает плейлист с URL треков для прослушивания\закачки
|
||||||
|
# tree:
|
||||||
|
# [fwfs_instance.url]
|
||||||
|
# |
|
||||||
|
# | -- [id исполнителя]
|
||||||
|
# | |
|
||||||
|
# | | -- плейлист с треками
|
||||||
|
# | ...
|
||||||
|
mkdir -p "fwfs_$instance"
|
||||||
|
counter_page=1
|
||||||
|
while true; do
|
||||||
|
tracks=$(funkwhale_api_get_tracks $counter_page)
|
||||||
|
next_check=$(echo "$tracks" | jj next)
|
||||||
|
echo "$next_check"
|
||||||
|
for idartist in $(echo "$tracks" | jj -l 'results.#.artist.id' | delq | sort -u); do
|
||||||
|
mkdir -p "fwfs_$instance/$idartist"
|
||||||
|
echo "$tracks" | jj -l "results.#[artist.id=$idartist].uploads.0.listen_url" | delq | sed "s/^/https:\/\/$instance/" | sed "s/$/\&token=$listen_token/" >> "fwfs_$instance/$idartist/playlist.m3u8"
|
||||||
|
chmod 600 fwfs_$instance/$idartist/playlist.m3u8
|
||||||
|
done
|
||||||
|
if [ -z "$next_check" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
counter_page=$(expr $counter_page + 1)
|
||||||
|
|
||||||
|
done
|
||||||
|
}
|
||||||
|
# funkwhale_pseudofs_load # beta
|
||||||
get_all_avalaible_count_tracks
|
get_all_avalaible_count_tracks
|
||||||
|
|
||||||
trackspls='Tracks'
|
trackspls='Tracks'
|
||||||
|
|
Loading…
Reference in a new issue