From aaabeded8ccf6e2326aa3836c10a9d81ed676f21 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 10 May 2026 08:31:03 +0300 Subject: Decouple podcast browse logic from BrowseSet via PodcastBrowser interface Extract PodcastBrowser interface and podcastBrowseService implementation to move podcast-specific grid augmentation out of browseService.BrowseSet. - Remove PodcastRepo from BrowseServiceStore and MediaServiceStore. - browseService now delegates podcast set augmentation to an injected PodcastBrowser strategy (kept optional/nil-safe). - Add NewMediaServiceWithPodcastBrowser to wire a real PodcastBrowser (backed by PodcastRepo) in production while keeping the plain NewMediaService for existing callers/tests. - Update main.go to instantiate NewPodcastBrowseService and inject it. - Update browse_test.go to test PodcastBrowser-augmented paths through the new constructor signature. This keeps BrowseSet focused on files and folders only and removes the podcast dependency from the browse contract. --- cmd/player/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/player/main.go b/cmd/player/main.go index afc1a5e..02a9113 100644 --- a/cmd/player/main.go +++ b/cmd/player/main.go @@ -95,7 +95,10 @@ func wireDeps(cfg *internal.Config, store repository.Store, logger *slog.Logger, prober := probe.NewFFProber() thumbGen := thumb.NewFFmpegGenerator() - mediaSvc := service.NewMediaService(store, clk, cfg.MediaRoot, thumbGen, prober) + + helper := service.NewAccessHelper(store) + browser := service.NewPodcastBrowseService(store, cfg.MediaRoot) + mediaSvc := service.NewMediaServiceWithPodcastBrowser(store, clk, cfg.MediaRoot, thumbGen, prober, browser) fsScanner := scanner.NewFSScannerWithLogger(store, prober, thumbGen, clk, cfg.MediaRoot, logger) adminSvc := service.NewAdminServiceWithLogger(store, clk, hasher, fsScanner, cfg.MediaRoot, appCtx, logger) @@ -103,7 +106,6 @@ func wireDeps(cfg *internal.Config, store repository.Store, logger *slog.Logger, progressSvc := service.NewProgressService(store, clk) authSvc := service.NewAuthService(store, clk, hasher, sm) - helper := service.NewAccessHelper(store) podcastSvc := service.NewPodcastServiceWithLogger(store, clk, cfg.MediaRoot, helper, prober, thumbGen, &http.Client{Timeout: service.DefaultHTTPClientTimeout}, cfg.PodcastCheckMinutes, logger) gcWorker := service.NewGCWorker(store, clk, cfg.MediaRoot, time.Duration(cfg.GCIntervalMinutes)*time.Minute, logger) -- cgit v1.2.3