diff --git a/internal/services/media_scanner.go b/internal/services/media_scanner.go index dcf3ad8..65a32a6 100644 --- a/internal/services/media_scanner.go +++ b/internal/services/media_scanner.go @@ -1871,9 +1871,6 @@ func (s *MediaScanner) waitForFileStability(filePath string) bool { } func (s *MediaScanner) scanDirectory(ctx context.Context, dirPath string) { - // Debug: Track file processing - filesSeen := 0 - filesProcessed := 0 // Prevent concurrent scans of ANY directory // Simple mutex is enough - job queue already serializes by directory s.scan_mutex.Lock() @@ -1904,7 +1901,10 @@ func (s *MediaScanner) scanDirectory(ctx context.Context, dirPath string) { return err } if d.IsDir() { - return filepath.SkipDir + if path != dirPath { + return filepath.SkipDir + } + return nil } if !s.isScannableFile(path) { return nil @@ -1914,7 +1914,6 @@ func (s *MediaScanner) scanDirectory(ctx context.Context, dirPath string) { if !s.waitForFileStability(path) { return nil } - filesSeen++ relPath := strings.TrimPrefix(path, rootFolder+"/") _, err = s.db.GetMediaItemByFilePath(ctx, database.GetMediaItemByFilePathParams{ FilePath: relPath, @@ -1928,14 +1927,10 @@ func (s *MediaScanner) scanDirectory(ctx context.Context, dirPath string) { s.newItems++ } s.totalFiles++ - filesProcessed++ } return nil }) - // Debug: Report scan results - fmt.Printf("DEBUG: scanDirectory of %s - filesSeen: %d, filesProcessed: %d, totalFiles: %d, newItems: %d, errors: %d\n", - dirPath, filesSeen, filesProcessed, s.totalFiles, s.newItems, s.errors) } // performInitialScan scans all root folders on startup diff --git a/internal/services/worker.go b/internal/services/worker.go index c7dd2b1..5346648 100644 --- a/internal/services/worker.go +++ b/internal/services/worker.go @@ -910,9 +910,6 @@ func (w *Worker) processDirectoryScanJob(job *Job) (interface{}, error) { } // Now scan the directory scanner.scanDirectory(ctx, directory) - // Debug logging - fmt.Printf("DEBUG: scanDirectory completed - totalFiles: %d, newItems: %d, errors: %d\n", - scanner.totalFiles, scanner.newItems, scanner.errors) // Return scan results return &DirectoryScanJobResult{