sorting music dirs
This commit is contained in:
parent
558d0a275b
commit
685be38c83
1 changed files with 5 additions and 2 deletions
|
@ -12,11 +12,14 @@ def execute(cinput: ControlInput, graphics: Graphics, directory: str):
|
|||
|
||||
def create_directory_menu(directory: str, dirname: str):
|
||||
sub_menu = list()
|
||||
for fname in listdir(directory):
|
||||
for fname in sorted(listdir(directory)):
|
||||
new_path = path.join(directory, fname)
|
||||
if path.isdir(new_path):
|
||||
sub_menu.append(create_directory_menu(new_path, fname))
|
||||
if len(sub_menu) > 0:
|
||||
return MenuItem(dirname, MenuType.SUB_MENU, {"sub_menu": sub_menu})
|
||||
else:
|
||||
return MenuItem(dirname, MenuType.CMD, {"directory": directory})
|
||||
if dirname.startswith("_"):
|
||||
return MenuItem(dirname.lstrip("_"), MenuType.CMD, {"random": directory})
|
||||
else:
|
||||
return MenuItem(dirname, MenuType.CMD, {"album": directory})
|
||||
|
|
Reference in a new issue