Skip to content

Commit 67e8073

Browse files
authored
Merge pull request adafruit#1286 from jepler/jeplayer-macos-metadata
JEplayer_mp3: Avoid trying to open MacOS "._file.mp3" files
2 parents 17653a8 + ed7460d commit 67e8073

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CircuitPython_JEplayer_mp3/code.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def auto_next(self):
234234
@staticmethod
235235
def has_any_mp3s(folder):
236236
"""True if the folder contains at least one item ending in .mp3"""
237-
return any(fn.lower().endswith(".mp3") for fn in os.listdir(folder))
237+
return any(not fn.startswith(".") and fn.lower().endswith(".mp3") for fn in os.listdir(folder))
238238

239239
def choose_folder(self, base='/sd'):
240240
"""Let the user choose a folder within a base directory"""
@@ -493,7 +493,7 @@ def longest_common_prefix(seq):
493493

494494
def play_folder(location):
495495
"""Play everything within a given folder"""
496-
playlist = [d for d in os.listdir(location) if d.lower().endswith('.mp3')]
496+
playlist = [d for d in os.listdir(location) if not d.startswith('.') and d.lower().endswith('.mp3')]
497497
if not playlist:
498498
# hmm, no mp3s in a folder? Well, don't crash okay?
499499
del playlist

0 commit comments

Comments
 (0)