mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-29 22:21:27 +00:00
Compare commits
No commits in common. "e9bf20106585a54c16860e3f957e2fa14d3ccd8f" and "658d50a825bbfc262267ebdb9b45d9eccee5f03a" have entirely different histories.
e9bf201065
...
658d50a825
|
@ -22,8 +22,6 @@ make_login()
|
|||
echo '+Authorized account+'
|
||||
export listen_token
|
||||
else
|
||||
listen_token=''
|
||||
export listen_token
|
||||
default_curl_opt()
|
||||
{
|
||||
curl -s --compressed "$@"
|
||||
|
@ -338,7 +336,7 @@ funkwhale_get_podcasts_artists()
|
|||
get_all_avalaible_count_tracks()
|
||||
{
|
||||
funkwhale_api_get_tracks 1 1>> /dev/null
|
||||
export count_all_tracks=$(jj -i preload -l count)
|
||||
count_all_tracks=$(jj -i preload -l count)
|
||||
if [ -z "$count_all_tracks" ]; then
|
||||
echo 'Error: Connection error or API limit expired'
|
||||
elif [ "$count_all_tracks" -eq 0 ]; then
|
||||
|
@ -347,7 +345,6 @@ get_all_avalaible_count_tracks()
|
|||
echo "Tracks avalaible on $instance: $count_all_tracks\n"
|
||||
fi
|
||||
}
|
||||
get_all_avalaible_count_tracks
|
||||
|
||||
funkwhale_pseudofs_load()
|
||||
{
|
||||
|
@ -360,73 +357,37 @@ funkwhale_pseudofs_load()
|
|||
# | |
|
||||
# | | -- плейлист с треками
|
||||
# | ...
|
||||
echo "Processing..."
|
||||
mkdir -p "fwfs_$instance"
|
||||
counter_page=1
|
||||
tracks_counter_watch=0
|
||||
skip_count=0
|
||||
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"
|
||||
if [ ! -f "fwfs_$instance/$idartist/playlist.m3u8" ]; then
|
||||
echo '#EXTM3U' > "fwfs_$instance/$idartist/playlist.m3u8"
|
||||
fi
|
||||
|
||||
get_tracks_uuid_by_artist_id=$(echo "$tracks" | jj -l "results.#[artist.id=$idartist]#.uploads.0.uuid" | delq)
|
||||
for track in $get_tracks_uuid_by_artist_id; do
|
||||
artist_name=$(echo "$tracks" | jj "results.#[uploads.0.uuid="$track"].artist.name")
|
||||
album_name=$(echo "$tracks" | jj "results.#[uploads.0.uuid="$track"].album.title")
|
||||
track_name=$(echo "$tracks" | jj "results.#[uploads.0.uuid="$track"].title")
|
||||
extension=$(echo "$tracks" | jj "results.#[uploads.0.uuid="$track"].uploads.0.extension")
|
||||
duration=$(echo "$tracks" | jj "results.#[uploads.0.uuid="$track"].uploads.0.duration")
|
||||
track_filename=$(echo "$artist_name - $album_name - $track_name.$extension")
|
||||
listen_url=$(echo "$tracks" | jj "results.#[uploads.0.uuid="$track"].uploads.0.listen_url")
|
||||
full_url=$(echo $listen_url | delq | sed "s/^/https:\/\/$instance/ ; s/$/\&token=$listen_token\&to=ogg/")
|
||||
echo "adding "$idartist"_$track_filename"
|
||||
exists_test=$(grep -F ""$idartist"_$track_filename" "fwfs_$instance/$idartist/playlist.m3u8")
|
||||
if [ -n "$exists_test" ]; then
|
||||
skip_count=$(expr $skip_count + 1)
|
||||
else
|
||||
echo "#EXTINF:$duration, "$idartist"_$track_filename\n$full_url" >> "fwfs_$instance/$idartist/playlist.m3u8"
|
||||
fi
|
||||
tracks_counter_watch=$(expr $tracks_counter_watch + 1)
|
||||
echo "current: $tracks_counter_watch skipped: $skip_count total: $count_all_tracks"
|
||||
done
|
||||
chmod 600 "fwfs_$instance/$idartist/playlist.m3u8"
|
||||
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)
|
||||
echo "page $counter_page"
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
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=/' {} +
|
||||
else
|
||||
find "fwfs_$instance" -type f -exec sed -i "s/to=.*/to=$transcode_ch/" {} +
|
||||
fi
|
||||
}
|
||||
# funkwhale_pseudofs_load # beta
|
||||
get_all_avalaible_count_tracks
|
||||
|
||||
trackspls='Tracks'
|
||||
albumsmenu='Albums'
|
||||
artistmenu='Artists'
|
||||
podcasts='Podcasts'
|
||||
changepod='Switch instance'
|
||||
load_pseudofs='Create artists local playlist'
|
||||
checkapilimits='Check API limits (debug)'
|
||||
Exit='Exit'
|
||||
|
||||
while true; do
|
||||
choice=$(echo "$trackspls\n$albumsmenu\n$artistmenu\n$podcasts\n$changepod\n$load_pseudofs\n$checkapilimits\n$Exit" | fzy)
|
||||
choice=$(echo "$trackspls\n$albumsmenu\n$artistmenu\n$podcasts\n$changepod\n$checkapilimits\n$Exit" | fzy)
|
||||
|
||||
case "$choice" in
|
||||
"$trackspls")
|
||||
|
@ -493,9 +454,6 @@ case "$choice" in
|
|||
get_all_avalaible_count_tracks
|
||||
fi ;;
|
||||
|
||||
"$load_pseudofs")
|
||||
funkwhale_pseudofs_load ;; # beta
|
||||
|
||||
|
||||
"$checkapilimits")
|
||||
funkwhale_api_check_api_limits | more ;;
|
||||
|
|
Loading…
Reference in a new issue