| Age | Commit message (Collapse) | Author |
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
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.
|
|
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
|
|
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.
|
|
|
|
- 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.
|
|
|
|
|
|
|
|
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
|
|
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
|
|
|
|
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
|
|
- 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 .
|
|
|
|
|
|
- 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
|