added more supported formats to track menu generator
This commit is contained in:
parent
b8e091a135
commit
24c769218a
|
@ -4,6 +4,10 @@ from cinput import ControlInput
|
||||||
from graphics import Graphics
|
from graphics import Graphics
|
||||||
from .player import MusicPlayer
|
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):
|
def execute(cinput: ControlInput, graphics: Graphics, directory: str):
|
||||||
is_resume = directory != "music"
|
is_resume = directory != "music"
|
||||||
current_dir = path.join("/home/rudism", directory)
|
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)
|
new_path = path.join(directory, fname)
|
||||||
if path.isdir(new_path):
|
if path.isdir(new_path):
|
||||||
dir_menu.append(create_directory_menu(new_path, fname, is_resume))
|
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, {
|
track_menu.append(MenuItem(fname, MenuType.CMD, {
|
||||||
"dir": directory,
|
"dir": directory,
|
||||||
"mode": "single",
|
"mode": "single",
|
||||||
|
|
Reference in New Issue