check_video_sequence.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env bash
  2. # Checks the playlist settings "videosequence" (wallpaper64 2.8.42 sub_140076BE0 / sub_140067720): a video of a timer
  3. # playlist plays once and the playlist moves on when it ends, with the setting off the 60 minute timer keeps the first
  4. # video, and "beginfirst" + "playintro" (sub_140067A00): only the first video plays to its end, the second stays. Makes two 3 second video wallpapers and a private HOME whose config.json holds the playlist (the real WE
  5. # config is never touched), renders headlessly and counts how often the video was (re)loaded.
  6. # Usage: tools/check_video_sequence.sh <engine binary> [assets dir]
  7. set -euo pipefail
  8. HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  9. BINARY=$(readlink -f "${1:?engine binary}")
  10. ASSETS=${2:-/workspace/SteamLibrary/steamapps/common/wallpaper_engine/assets}
  11. command -v ffmpeg > /dev/null || { echo "SKIP: no ffmpeg"; exit 0; }
  12. work=$(mktemp -d /tmp/lwe-video-sequence.XXXXXX)
  13. trap 'rm -rf "$work"' EXIT
  14. for name in a b; do
  15. mkdir -p "$work/items/$name"
  16. colour=red; [ "$name" = b ] && colour=blue
  17. ffmpeg -loglevel error -f lavfi -i "color=c=$colour:s=320x180:r=30" -t 3 -pix_fmt yuv420p "$work/items/$name/v.mp4"
  18. echo "{\"file\":\"v.mp4\",\"title\":\"$name\",\"type\":\"video\"}" > "$work/items/$name/project.json"
  19. done
  20. steam="$work/home/.steam/steam/steamapps/common/wallpaper_engine"
  21. mkdir -p "$steam"
  22. ln -s "$ASSETS" "$steam/assets"
  23. loads() {
  24. printf '{"steamuser":{"general":{"playlists":[{"name":"seq","items":["%s","%s"],"settings":{"mode":"timer","delay":60,"order":"sequential",%s}}]}}}\n' \
  25. "$work/items/a/project.json" "$work/items/b/project.json" "$2" > "$steam/config.json"
  26. HOME="$work/home" HEADLESS_RENDER_SIZE=640x360 HEADLESS_RENDER_DELAY=100000 HEADLESS_RENDER_TIMEOUT=16 \
  27. "$HERE/headless_render.sh" "$BINARY" "$work/shot.png" --assets-dir "$ASSETS" --fps 30 --silent --playlist seq \
  28. > "$work/run-$1.log" 2>&1 < /dev/null || true
  29. grep -c 'VO: \[libmpv\]' "$work/run-$1.log" || true
  30. }
  31. on=$(loads on '"videosequence":true')
  32. off=$(loads off '"videosequence":false')
  33. intro=$(loads intro '"videosequence":false,"beginfirst":true,"playintro":true')
  34. if [ "$on" -ge 3 ] && [ "$off" -eq 1 ] && [ "$intro" -eq 2 ]; then
  35. echo "PASS: $on loads in 16 s with videosequence, $off without, $intro with an intro video"
  36. else
  37. echo "FAIL: $on loads with videosequence (want >= 3), $off without (want 1), $intro with playintro (want 2)"
  38. exit 1
  39. fi