| Age | Commit message (Collapse) | Author |
|
|
|
Refactored the following functions per CLAUDE.md (50+ line limit):
- internal/scanner/scanner.go: scanSet (192 → 56 lines)
Extracted: ensureSet, loadExistingMedia, gatherCoverImages,
thumbnailForVideo, thumbnailForImage, buildThumbnailPath,
processNewFile, updateAudioThumbnails
- internal/repository/migrate.go: Migrate (134 → 23 lines)
Extracted: enableForeignKeys, execSchema; split schema into
tablesSchema and indexesSchema constants
- internal/config.go: LoadConfig (85 → 28 lines)
Extracted: defaultConfig, loadNumericSettings, loadStringSettings,
loadLogLevel, loadSecureCookies; added validLogLevels variable
- cmd/mediaplayer/main.go: run / runWithSignal (114 → 26 / 26 lines)
Extracted: parseVersionFlag, buildLogger, wireDeps, runServer,
ensureSignalChannel, shutdownGracefully; introduced appDeps struct
- internal/api/server.go: routes (96 → 8 lines)
Extracted per route group: routesPublic, routesSharePublic,
routesStatic, routesHTML, routesAuth, routesSets, routesMedia,
routesNotes, routesProgress, routesShares, routesAdmin
Added helpers: requireSession, requireAdmin, publicMethod
- internal/service/browse.go: BrowseSet (85 → 26 lines)
Extracted: prefixForParent, classifyMediaPath, buildFolderMap,
folderHasCover, buildFolders
All public interfaces remain unchanged. Tests pass: go test ./... -race -cover
|
|
background scans
|
|
Split Server struct to accept narrow service interfaces instead of fat
composites (MediaService, AdminService). Each handler now depends only on
its specific slice (MediaBrowseService, MediaWriteService, etc.).
Split Middleware to depend on a narrow UserStore interface instead of full
repository.Store. Updated all constructors, call sites, and tests.
Added negative tests for nil AdminService and ProgressService returning
501 Not Implemented.
References task 6.
|
|
|
|
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: add runWithSignal injection point for testing; cover
version flag, invalid flags, invalid config, normal shutdown, all log
levels, invalid DB, and privileged-port bind failure. Refactor run()
to delegate to runWithSignal with optional signal channel.
- internal/config: allow PORT=0 (ephemeral) to support test server startup.
Update AGENTS.md validation docs accordingly.
- internal/model: add comprehensive ScanProgress tests (Start, Done,
IncrementFile/Set, SetCurrentSet/FilesTotal, Copy isolation, and
concurrent access).
- internal/probe: add image tests for isImagePath (all extensions and
case insensitivity), real EXIF extraction via ImageMagick + exiv2,
Probe against real JPEG, MP4, empty file, and nonexistent paths.
- internal/config_test: replace PORT=0 invalid-value test with PORT=-1.
|
|
Introduce service.AuthService interface with Bootstrap and Login methods,
a concrete authService implementation, and a MockAuthService for testing.
Wire AuthService into api.Server and update cmd/mediaplayer/main.go to use it.
This removes direct store access from handleBootstrap and handleLogin,
fixing the DIP violation. Sentinel errors (ErrAlreadyBootstrapped,
ErrInvalidCredentials) are added to the service package so the API layer
can map them to the correct HTTP status codes without leaking DB details.
Files created:
- internal/service/auth.go
Files modified:
- internal/service/service.go
- internal/service/media.go
- internal/service/mock.go
- internal/repository/repository.go
- internal/repository/mock.go
- internal/api/server.go
- internal/api/handlers_auth.go
- internal/api/handlers_test.go
- internal/api/handlers_more_test.go
- cmd/mediaplayer/main.go
|
|
|
|
keyboard shortcuts
- Redesign UI to be invisible by default: only header + '?' button shown
- Press m to show sidebar, t for toolbar, / for search, ? for help
- Add help modal with all keyboard shortcuts
- Fix scanner to skip corrupt/unprobeable files instead of aborting
- Fix scanner to skip thumbnail errors instead of aborting
- Fix rescan to use background context so it completes after HTTP response
- Rename project from KISS Media Player to Player
|
|
|
|
- mediaService: implement RegenerateThumbnail and RegenerateSetCover
- Inject thumb.Generator and probe.Prober into MediaService
- Update NewMediaService constructor and all call sites
- Add service tests for success, failure, permission denied, and not-found
- Add API tests for cover regeneration and thumbnail error mapping
- All tests pass
|
|
- Refactor main into run(args) for testability and clean error propagation.
- Create slog.Logger from cfg.LogLevel using TextHandler.
- Instantiate service.NewGCWorker with store, clock, cfg.MediaRoot, and
time.Duration(cfg.GCIntervalMinutes)*time.Minute.
- Start GCWorker after construction and defer Stop for graceful shutdown.
- Add cmd/mediaplayer/main_test.go as an integration smoke test wiring the
GCWorker against a real SQLite store.
|
|
- Add scanner.Scanner and mediaRoot fields to adminService.
- Update NewAdminService signature to accept scanner and mediaRoot.
- Implement TriggerRescan delegation to injected scanner.
- Wire probe.NewFFProber, thumb.NewFFmpegGenerator, and scanner.NewFSScanner
in cmd/mediaplayer/main.go.
- Add tests for TriggerRescan delegation, error propagation, and nil scanner.
|
|
- Update go.mod module path
- Replace all internal imports from github.com/paul/kiss-media-player to codeberg.org/snonux/play
- Run go mod tidy and gofmt -w .
|
|
|