From 7fdb2dded817c000dcca76006ac008b886c50a47 Mon Sep 17 00:00:00 2001 From: Pavel Kirilin <win10@list.ru> Date: Sun, 14 Jun 2020 03:15:12 +0400 Subject: [PATCH] Fixes. Signed-off-by: Pavel Kirilin <win10@list.ru> --- Makefile | 11 +++++++++-- assets/scripts/playerctl_loader.sh | 24 +++++++++++++++--------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index ea03b43..f787392 100644 --- a/Makefile +++ b/Makefile @@ -61,9 +61,16 @@ preview: playerctl_load: @sh ${ASSETS_DIR}/scripts/playerctl_loader.sh -stream: - vlc --no-dbus -vv --sout-keep --sout '#transcode{vcodec=VP80,ab64,acodec=vorbis}:gather:std{access=http,mux=ogg,dst=:8888/}' --sout-all --sout-mux-caching 10000 +analyze: + @python assets/analitics/graphics.py + +install: + sudo pacman -Syu --needed vlc \ + python + pip install --user ffpb +stream: + vlc --no-dbus -vv --sout-keep --sout '#gather:std{access=http,mux=ogg,dst=:8888/}' --sout-all --loop cleanup: @echo "Cleaning up outdir" @rm -rfv "${OUT_DIR}" diff --git a/assets/scripts/playerctl_loader.sh b/assets/scripts/playerctl_loader.sh index 637eec9..485a806 100644 --- a/assets/scripts/playerctl_loader.sh +++ b/assets/scripts/playerctl_loader.sh @@ -2,7 +2,7 @@ workdir="$(mktemp -d playlist-XXXXXX)" ads_dir="../assets/ads/" -today="$(date +%D)" +today="$(date +"%y/%m/%d")" res_dir="radio/${today}" current_player="" job_started=0 @@ -36,9 +36,10 @@ function read_player(){ trap "cleanup_and_exit" EXIT -playerctl -l if [[ !( $(playerctl -l | wc -l) -eq 1) ]];then read_player +else + current_player="$(playerctl -l)" fi if [[ !( $(player status) ) ]]; then @@ -68,12 +69,18 @@ while [[ "$(player status)" = "Playing" ]];do url="$(player metadata xesam:url)" # Downloading song and album cover - wget "${url}" -O "current.mp3" - wget "${artUrl}" -O "cover.jpg" + echo "Loading song" + wget -q "${url}" -O "current.mp3" + echo "loaded" + + echo "Loading album cover" + wget -q "${artUrl}" -O "cover.jpg" + echo "loaded" # Processing background music_bg test "cover.jpg" --output "cover.png" - + + # Adding song name convert -background '#0008' -gravity center \ -fill white -size 800x70 caption:"${artist} - ${title}" \ "cover.png" +swap -gravity south -geometry +0+200 -composite "bg.png" @@ -81,9 +88,8 @@ while [[ "$(player status)" = "Playing" ]];do rm -fv "cover.jpg" "cover.png" target_adv="$(find "$ads_dir" -type f | shuf -n 1)" - echo "Selected ad: $target_adv" - - ffmpeg -loop 1 -r 3 -i bg.png -i current.mp3 -r 25 -i "${target_adv}" \ + echo "Rendering ${index}" + ffpb -loop 1 -r 3 -i bg.png -i current.mp3 -r 25 -i "${target_adv}" \ -filter_complex "[0:v]scale=w=1280:h=720:force_original_aspect_ratio=2,crop=1280:720[img]; \ [2:v]setpts=10*PTS[adv]; \ [adv]loop[ladv]; \ @@ -94,7 +100,7 @@ while [[ "$(player status)" = "Playing" ]];do -c:v vp8 -pix_fmt yuv420p -movflags +faststart \ -vb 4000k \ -f webm \ - -c:a libvorbis \ + -c:a libopus \ -err_detect ignore_err \ -shortest -strict -2 -y \ "${index}.webm" -- GitLab