Skip to content

Commit

Permalink
Ignore "hidden" files when importing a folder
Browse files Browse the repository at this point in the history
  • Loading branch information
deluan committed Aug 21, 2020
1 parent 6c8535c commit a45c08f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scanner/tag_scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@ func loadAllAudioFiles(dirPath string) (map[string]os.FileInfo, error) {
if f.IsDir() {
continue
}
if strings.HasPrefix(f.Name(), ".") {
continue
}
filePath := filepath.Join(dirPath, f.Name())
if !utils.IsAudioFile(filePath) {
continue
Expand Down
2 changes: 2 additions & 0 deletions scanner/tag_scanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ var _ = Describe("TagScanner", func() {
Expect(files).To(HaveKey("tests/fixtures/test.ogg"))
Expect(files).To(HaveKey("tests/fixtures/test.mp3"))
Expect(files).To(HaveKey("tests/fixtures/01 Invisible (RED) Edit Version.mp3"))
Expect(files).ToNot(HaveKey("tests/fixtures/._02 Invisible.mp3"))
Expect(files).ToNot(HaveKey("tests/fixtures/playlist.m3u"))
})

It("returns error if path does not exist", func() {
_, err := loadAllAudioFiles("./INVALID/PATH")
Expect(err).To(HaveOccurred())
Expand Down
Empty file.

0 comments on commit a45c08f

Please sign in to comment.