refactor(scanner): export ExtractAndUploadAudiobookCover

Required for the enricher to call it during deferred cover extraction.
Also exports FFmpegPathFromFFprobe for the same reason.
This commit is contained in:
RXWatcher
2026-05-27 09:04:04 +02:00
parent 7ea763cdb7
commit 5aa0462338
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -17,9 +17,9 @@ type audiobookCoverCacher interface {
CacheAudiobookCover(ctx context.Context, data []byte, contentID string) (basePath string, ext string, thumbhash string, err error)
}
// ffmpegPathFromFFprobe derives the ffmpeg binary path from a configured
// FFmpegPathFromFFprobe derives the ffmpeg binary path from a configured
// ffprobe path. They live side by side in every silo deployment.
func ffmpegPathFromFFprobe(ffprobePath string) string {
func FFmpegPathFromFFprobe(ffprobePath string) string {
if ffprobePath == "" {
return ""
}
@@ -32,12 +32,12 @@ func ffmpegPathFromFFprobe(ffprobePath string) string {
return ""
}
// extractAndUploadAudiobookCover reads the embedded cover image (if any)
// ExtractAndUploadAudiobookCover reads the embedded cover image (if any)
// from the given audio file via ffmpeg, pushes it through the silo
// imagecache (resize + thumbhash + S3 upload), and returns the
// poster_path S3 key plus thumbhash. Returns "", "" (no error) when no
// embedded cover exists or the cacher is unavailable.
func extractAndUploadAudiobookCover(
func ExtractAndUploadAudiobookCover(
ctx context.Context,
ffmpegPath string,
cacher audiobookCoverCacher,
+1 -1
View File
@@ -301,7 +301,7 @@ func (s *Scanner) reconcileAudiobookFolder(ctx context.Context, folder *models.M
}
}
if len(parsed.Files) > 0 && s.imageCacher != nil {
poster, thumb := extractAndUploadAudiobookCover(ctx, ffmpegPathFromFFprobe(s.ffprobePath), s.imageCacher, parsed.Files[0].Path, contentID)
poster, thumb := ExtractAndUploadAudiobookCover(ctx, FFmpegPathFromFFprobe(s.ffprobePath), s.imageCacher, parsed.Files[0].Path, contentID)
if poster != "" {
if _, err := s.fileRepo.Pool().Exec(ctx, `
UPDATE media_items