From deba845a03de659b490452e00f7b7d501ba1fdb2 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 3 May 2026 20:18:26 +0300 Subject: refactor(api): extract Remuxer interface and move ffmpeg/MPEG-TS/mime logic to internal/probe Move LooksLikeMPEGTS, MimeTypeForFilename and the ffmpeg remux path out of the api transport layer into a new internal/probe/remux.go package. This removes os/exec and mime tables from the api layer, satisfying the DIP principle. - New probe.Remuxer interface with FFRemuxer implementation - Server depends on probe.Remuxer, injected via NewServer - Updated cmd/mediaplayer wiring and all test helpers - All tests pass: go test ./... -race -cover --- cmd/mediaplayer/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/mediaplayer/main.go b/cmd/mediaplayer/main.go index f7c5928..7ecf052 100644 --- a/cmd/mediaplayer/main.go +++ b/cmd/mediaplayer/main.go @@ -96,7 +96,8 @@ func runWithSignal(args []string, sigCh <-chan os.Signal) error { defer gcWorker.Stop() staticFS := http.Dir("web") - server := api.NewServer(store, hasher, sm, cfg, mediaSvc, adminSvc, progressSvc, authSvc, staticFS) + remuxer := probe.NewFFRemuxer() + server := api.NewServer(store, hasher, sm, cfg, mediaSvc, adminSvc, progressSvc, authSvc, staticFS, remuxer) gs := api.NewGracefulServer(server, cfg) -- cgit v1.2.3