Skip to content

fix: recover transcoder panics, allow AutoDJ edit, add Dockerfile#19

Merged
DatanoiseTV merged 2 commits intomainfrom
fix/transcoder-autodj-docker
Apr 16, 2026
Merged

fix: recover transcoder panics, allow AutoDJ edit, add Dockerfile#19
DatanoiseTV merged 2 commits intomainfrom
fix/transcoder-autodj-docker

Conversation

@DatanoiseTV
Copy link
Copy Markdown
Owner

Summary

  • Recover from panics inside the transcoder goroutine so malformed or non-MP3 inputs can no longer crash the server (Transcoder fails and panics #18).
  • Add StreamerManager.DeleteStreamer and wire it into the AutoDJ delete/update handlers so editing an AutoDJ no longer fails with streamer for mount ... already exists (Error when editing AutoDJ streams #17).
  • Make the music directory optional when an external song command is configured, and preserve song_command on the HTML update handler (Error when editing AutoDJ streams #17).
  • Add a multi-stage Dockerfile (frontend -> Go builder -> Alpine runtime) and .dockerignore so the project can be run as a container (Docker image #15).

Changes

  • relay/transcode.go: safePerformTranscode wraps performTranscode in a defer/recover; the retry loop continues normally after a recovered panic.
  • relay/streamer.go: new DeleteStreamer(mount) stops the streamer and removes it from sm.instances. StopStreamer remains as-is (keeps the instance so the UI can restart it).
  • server/handlers_api_v2.go, server/handlers_player.go: delete and update paths call DeleteStreamer; music_dir is optional when song_command is set; SongCommand now persisted on HTML form updates.
  • Dockerfile, .dockerignore: container build.

Test plan

  • go build ./...
  • go vet ./...
  • go test ./relay/... (passing; unrelated pre-existing failure in server/TestIPWhitelistAndBanning remains on main)
  • Reproduce Transcoder fails and panics #18: point a transcoder at a non-MP3 input and verify the server no longer panics.
  • Reproduce Error when editing AutoDJ streams #17: create an AutoDJ, edit and save it, verify success.
  • docker build -t tinyice . and start the resulting container.

Closes #17
Closes #18
Addresses #15

- Wrap performTranscode in a panic recovery so malformed or non-MP3
  input can no longer crash the server. The retry loop continues to
  attempt re-initialization after a recovered panic (#18).
- Add StreamerManager.DeleteStreamer which fully removes the streamer
  from the manager's map, and use it from AutoDJ delete/update handlers
  so editing an existing AutoDJ no longer fails with
  "streamer for mount already exists" (#17).
- Make music_dir optional when song_command is set, in both the JSON
  API and HTML form handlers; preserve song_command in the HTML update
  handler (#17).
- Add a multi-stage Dockerfile (frontend -> Go builder -> alpine
  runtime) and a .dockerignore so the project can be run as a
  container (#15).
TestIPWhitelistAndBanning called recordScanAttempt, which invokes
logger.L.Warnf on the 10th scan attempt. The package-level logger
was nil under `go test ./...`, causing a nil-pointer panic. Mirror
the relay package pattern with a package-level init() that calls
logger.Init so the logger is ready before any test runs.
@DatanoiseTV DatanoiseTV merged commit cc26bbd into main Apr 16, 2026
@DatanoiseTV DatanoiseTV deleted the fix/transcoder-autodj-docker branch April 16, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transcoder fails and panics Error when editing AutoDJ streams

1 participant