diff --git a/musicutil/commands/genhtml_command.py b/musicutil/commands/genhtml_command.py index f90a63c..2941865 100644 --- a/musicutil/commands/genhtml_command.py +++ b/musicutil/commands/genhtml_command.py @@ -9,6 +9,7 @@ class GenHTMLArgs(): dest: str title: str description: str + by_folder: bool def add_genhtml_command(subparsers): genhtml_parser = subparsers.add_parser('genhtml') @@ -28,6 +29,9 @@ def add_genhtml_command(subparsers): 'description', type=str, help='description') + genhtml_parser.add_argument( + '--by-folder', + action='store_true') def get_genhtml_args(args) -> GenHTMLArgs: command_args = GenHTMLArgs() @@ -35,15 +39,18 @@ def get_genhtml_args(args) -> GenHTMLArgs: command_args.dest = args.dest command_args.title = args.title command_args.description = args.description + command_args.by_folder = args.by_folder return command_args -def make_table_for_files(files: list[File]) -> str: +def make_table_for_files(files: list[File], by_folder: bool = False) -> str: html_content = "" - html_content += """ + path_head = "
Path | + {path_head}Title | Artist | Format | @@ -52,15 +59,18 @@ def make_table_for_files(files: list[File]) -> str:{data_path} | " if not by_folder else "" + html_content += f"""
---|---|---|---|
{data_path} | + {path_data}{data_title} | {data_artist} | {data_extension} | @@ -71,8 +81,7 @@ def make_table_for_files(files: list[File]) -> str: