summaryrefslogtreecommitdiff
path: root/files/index.go
diff options
context:
space:
mode:
authorjakka <jakkadoujin@gmail.com>2025-04-12 19:30:05 +0300
committerjakka <jakkadoujin@gmail.com>2025-04-12 19:30:05 +0300
commit4ab05592633ae75de5a39d16495f57eb6ea263a2 (patch)
treeb674ee9229d9a85abb59fd03b2400d37e82ea915 /files/index.go
parent1675136966473083e970badfe92433a05d2d7fee (diff)
reimplemented database in badger so it actually works
Diffstat (limited to 'files/index.go')
-rw-r--r--files/index.go56
1 files changed, 0 insertions, 56 deletions
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
-}