added more supported formats to track menu generator

This commit is contained in:
Rudis Muiznieks 2022-12-28 11:17:14 -06:00
parent b8e091a135
commit 24c769218a
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
1 changed files with 5 additions and 1 deletions

View File

@ -4,6 +4,10 @@ from cinput import ControlInput
from graphics import Graphics
from .player import MusicPlayer
SUPPORTED_FORMATS = (
".mp3", ".ogg", ".m4a", ".wav", ".flac", ".ape",
".aiff", ".aif", ".wma", ".mid", ".midi")
def execute(cinput: ControlInput, graphics: Graphics, directory: str):
is_resume = directory != "music"
current_dir = path.join("/home/rudism", directory)
@ -18,7 +22,7 @@ def create_directory_menu(directory: str, dirname: str, is_resume: bool):
new_path = path.join(directory, fname)
if path.isdir(new_path):
dir_menu.append(create_directory_menu(new_path, fname, is_resume))
elif fname.lower().endswith((".mp3", ".ogg")):
elif fname.lower().endswith(tuple(SUPPORTED_FORMATS)):
track_menu.append(MenuItem(fname, MenuType.CMD, {
"dir": directory,
"mode": "single",