From 4ab05592633ae75de5a39d16495f57eb6ea263a2 Mon Sep 17 00:00:00 2001 From: jakka Date: Sat, 12 Apr 2025 19:30:05 +0300 Subject: reimplemented database in badger so it actually works --- files/index.go | 56 -------------------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 files/index.go (limited to 'files/index.go') diff --git a/files/index.go b/files/index.go deleted file mode 100644 index ea05dc4..0000000 --- a/files/index.go +++ /dev/null @@ -1,56 +0,0 @@ -package files - -import ( - "context" - "io/fs" - "path/filepath" - "time" - - "github.com/briandowns/spinner" - "golang.org/x/sync/errgroup" -) - -func IndexFlacs(ctx context.Context) error { - spin := spinner.New(spinner.CharSets[9], 100*time.Millisecond) - spin.Suffix = " Indexing flacs..." - - spin.Start() - - wg := new(errgroup.Group) - wg.SetLimit(100) - - if err := filepath.WalkDir(ctx.Value("path").(string), func(path string, info fs.DirEntry, err error) error { - select { - case <-ctx.Done(): - spin.FinalMSG = "Stopping...\n" - spin.Stop() - return nil - default: - if err != nil { - return err - } - if !info.IsDir() { - if filepath.Ext(path) == ".flac" { - wg.Go(func() error { - select { - case <-ctx.Done(): - return nil - default: - return ProcessFile(ctx, path, info) - } - }) - } - - } - return nil - } - - }); err != nil { - return err - } - - wg.Wait() - spin.FinalMSG = "Done indexing flacs" - spin.Stop() - return nil -} -- cgit v1.3.1