sorting music dirs
This commit is contained in:
parent
558d0a275b
commit
685be38c83
|
@ -12,11 +12,14 @@ def execute(cinput: ControlInput, graphics: Graphics, directory: str):
|
||||||
|
|
||||||
def create_directory_menu(directory: str, dirname: str):
|
def create_directory_menu(directory: str, dirname: str):
|
||||||
sub_menu = list()
|
sub_menu = list()
|
||||||
for fname in listdir(directory):
|
for fname in sorted(listdir(directory)):
|
||||||
new_path = path.join(directory, fname)
|
new_path = path.join(directory, fname)
|
||||||
if path.isdir(new_path):
|
if path.isdir(new_path):
|
||||||
sub_menu.append(create_directory_menu(new_path, fname))
|
sub_menu.append(create_directory_menu(new_path, fname))
|
||||||
if len(sub_menu) > 0:
|
if len(sub_menu) > 0:
|
||||||
return MenuItem(dirname, MenuType.SUB_MENU, {"sub_menu": sub_menu})
|
return MenuItem(dirname, MenuType.SUB_MENU, {"sub_menu": sub_menu})
|
||||||
else:
|
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 New Issue