summaryrefslogtreecommitdiff
path: root/internal/scanner/scanner.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/scanner/scanner.go')
-rw-r--r--internal/scanner/scanner.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/scanner/scanner.go b/internal/scanner/scanner.go
index 92bc6c3..dc5f34f 100644
--- a/internal/scanner/scanner.go
+++ b/internal/scanner/scanner.go
@@ -116,6 +116,12 @@ func (s *FSScanner) ensureSet(ctx context.Context, root, setPath string) (int64,
for i := range sets {
if sets[i].RootPath == relRoot {
+ if isPodcastRoot(relRoot) && !sets[i].IsPodcast {
+ sets[i].IsPodcast = true
+ if err := s.store.UpdateSet(ctx, &sets[i]); err != nil {
+ return 0, "", fmt.Errorf("update podcast set %q: %w", setName, err)
+ }
+ }
return sets[i].ID, setName, nil
}
}
@@ -123,6 +129,7 @@ func (s *FSScanner) ensureSet(ctx context.Context, root, setPath string) (int64,
newSet := &model.Set{
Name: setName,
RootPath: relRoot,
+ IsPodcast: isPodcastRoot(relRoot),
CreatedAt: s.clock.Now(),
}
id, err := s.store.CreateSet(ctx, newSet)
@@ -132,6 +139,10 @@ func (s *FSScanner) ensureSet(ctx context.Context, root, setPath string) (int64,
return id, setName, nil
}
+func isPodcastRoot(rootPath string) bool {
+ return strings.EqualFold(filepath.ToSlash(rootPath), "podcast")
+}
+
// loadExistingMedia builds a lookup map of existing media keyed by relPath.
func (s *FSScanner) loadExistingMedia(ctx context.Context, setID int64, setName string) (map[string]model.Media, error) {
existing := make(map[string]model.Media)