summaryrefslogtreecommitdiff
path: root/internal/scanner
AgeCommit message (Collapse)Author
2026-05-17Restructure repo: move Go server into player-server/Paul Buetow
2026-05-10refactor(service,scanner): return concrete types from constructorsPaul Buetow
Apply the Go best-practice convention 'accept interfaces, return concrete types' across the service and scanner packages: - NewBrowseService -> *browseService - NewWriteService -> *writeService - NewMediaStreamer -> *mediaStreamer - NewFSScanner -> *FSScanner - NewFSScannerWithLogger -> *FSScanner - NewPodcastBrowseService -> *podcastBrowseService - NewTagService -> *tagService - NewShareService -> *shareService - NewProgressService -> *progressService - NewAdminService -> *adminService - NewAdminServiceWithLogger -> *adminService - NewAuthService -> *authService - NewNoteService -> *noteService - NewFavService -> *favService - NewMediaService -> *mediaService - NewMediaServiceWithPodcastBrowser -> *mediaService Callers continue to work unchanged because Go allows assigning a concrete type to an interface variable. All tests pass with -race -cover.
2026-05-09s1 add media rescan hotkey and progress indicatorPaul Buetow
2026-05-09Refine media browsing and set coversPaul Buetow
2026-05-06Split scanSet into smaller helpers and fix mockFS SkipDir (task y0)Paul Buetow
2026-05-06Make file indexing concurrent with worker pool in scannerPaul Buetow
2026-05-06fix(scanner, browse): fallback to original image when thumbnail generation ↵Paul Buetow
fails for cover.jpg When scanning image files (e.g. cover.jpg in audiobook folders), thumbnailForImage can fail or produce a missing .thumbnails/cover.jpg. This caused broken thumbnails in the grid. - scanner.go buildThumbnailPath: after generating an image thumbnail, verify the output file exists via fs.Stat. If it does not exist, fall back to using the original image path as the thumbnail_path. - browse.go GetThumbnail: if os.Stat(ThumbnailPath) fails and the media type is image, fall back to serving the original AbsPath. All tests pass.
2026-05-04task 7: refactor oversized functions into helpersPaul Buetow
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
2026-05-04task 9: Centralize file extension and media type mappings in internal/mediatypePaul Buetow
Create a new internal/mediatype package with a single source of truth for: - Extension-to-media-type mappings (TypeForExt) - Extension-to-MIME mappings (MIMETypeForExt) - Supported extension checks (IsSupportedExt, IsImageExt, IsCoverImageExt) Replace duplicated logic across: - internal/service/service.go (supportedExtensions, guessMediaType) - internal/scanner/scanner.go (mediaExtensions, imageExtensions, mediaTypeFromExt) - internal/api/handlers.go (probe.MimeTypeForFilename) - internal/probe/probe.go (imageExtensions, isImagePath) - internal/probe/remux.go (MimeTypeForFilename) Divergent defaults unified: both scanner and service now default unknown extensions to video (model.MediaTypeVideo) via mediatype.TypeForExt. Update tests to use mediatype package and remove obsolete scanner tests. Update AGENTS.md to reflect the new package.
2026-05-03Task 8: standardize scanner and handler loggingPaul Buetow
2026-05-03fix(admin): fix rescan goroutine lifecycle and race on shared ScanProgressPaul Buetow
- Protect adminService scan state (cancel func + progress pointer) with sync.Mutex. - Allocate fresh ScanProgress per trigger and pass it to the scanner, eliminating races on the previously shared progress struct. - Cancel previous scan context before starting a new one. - Add tests for cancellation, fresh progress per scan, concurrent triggers, and empty progress when never started. - Fix race-prone tests by polling Running==true before waiting for completion.
2026-05-02fix detached playback and scan progressPaul Buetow
2026-05-02more on thisPaul Buetow
2026-05-01add readme and so onPaul Buetow
2026-05-01Add support for audiobook/cover images with ancestor lookup and fix keyboard ↵Paul Buetow
navigation Backend: - Add UpdateMediaThumbnail to MediaRepo for efficient thumbnail-only updates - Update ScannerStore interface to include thumbnail update capability - Update mock implementations across repository and API layers for interface changes - Enhance scanner to detect image files in ancestor directories for audio covers - Add background goroutine for async rescan to avoid HTTP timeout Frontend: - Fix hjkl cursor keys to navigate grid properly - Implement ancestor directory cover image lookup for audiobooks Infrastructure: - Add start.sh helper script for quick server startup during development
2026-05-01Add cover image detection for audio files in scannerPaul Buetow
During scanning, when an audio file is found in a directory that also contains an image file (jpg/png/gif), the scanner now assigns that image as the audio file's thumbnail_path. This is common for audiobooks which have cover.jpg alongside the audio files. Changes: - scanner: two-pass walk to collect sibling images, then pair with audio - CSS: add .row-cover style for audio items with covers - JS: render audio rows with cover images when thumbnail_path is set
2026-05-01Rename Go module from codeberg.org/snonux/play to codeberg.org/snonux/playerPaul Buetow
2026-05-01Minimalist UI: hide all elements until activated; add help modal and ↵Paul Buetow
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
2026-04-30Rename module to codeberg.org/snonux/play (task aa)Paul Buetow
- 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 .
2026-04-30refactor: split repository.Store into focused interfacesPaul Buetow
2026-04-29feat: implement filesystem scannerPaul Buetow
2026-04-28h9: scaffold go project structurePaul Buetow
- Initialize go.mod (github.com/paul/kiss-media-player) - Add internal/version.go with const Version - Add internal/config.go with env-based Config struct and validation (PORT, MEDIA_ROOT, DB_PATH, MAX_UPLOAD_SIZE_MB, SESSION_TIMEOUT_HOURS, GC_INTERVAL_MINUTES, SHARE_DEFAULT_EXPIRY_DAYS, LOG_LEVEL) - Add table-driven config validation tests (defaults, overrides, invalid values) - Add cmd/mediaplayer/main.go with -version flag - Create directory scaffold: internal/{model,repository,scanner,probe,thumb, clock,auth,service,api,setassign}, web/{css,js}, k8s - Add .gitignore for binaries and data.db - Refactor env parsing into envInt/envString helpers per go-best-practices