From b87efb9989ee3cc2ad9aef75b9a026c5c9971882 Mon Sep 17 00:00:00 2001 From: Peter Scheidler Date: Thu, 16 Oct 2025 13:01:32 -0400 Subject: [PATCH 1/2] Adding a -n option to skip the standard EBML header when using tools.xml2ebml --- ebmlite/tools/xml2ebml.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ebmlite/tools/xml2ebml.py b/ebmlite/tools/xml2ebml.py index c5f3fed..4eacdc8 100644 --- a/ebmlite/tools/xml2ebml.py +++ b/ebmlite/tools/xml2ebml.py @@ -26,10 +26,14 @@ def main(): '-c', '--clobber', action="store_true", help="Clobber (overwrite) existing files.", ) + argparser.add_argument( + '-n', '--no_header', action="store_false", + help="Do not write the standard EBML header segment.", + ) args = argparser.parse_args() with utils.load_files(args, binary_output=True) as (schema, out): - ebmlite.util.xml2ebml(args.input, out, schema) # , sizeLength=4, headers=True, unknown=True) + ebmlite.util.xml2ebml(args.input, out, schema, headers=args.no_header) # , sizeLength=4, headers=True, unknown=True) if __name__ == "__main__": From 0c31e00635ab378118fc37f49bbc70e8c6f89adb Mon Sep 17 00:00:00 2001 From: Peter Scheidler Date: Thu, 16 Oct 2025 13:11:30 -0400 Subject: [PATCH 2/2] Clearing up naming. Tested with and without new option --- ebmlite/tools/xml2ebml.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ebmlite/tools/xml2ebml.py b/ebmlite/tools/xml2ebml.py index 4eacdc8..0c77f55 100644 --- a/ebmlite/tools/xml2ebml.py +++ b/ebmlite/tools/xml2ebml.py @@ -27,13 +27,14 @@ def main(): help="Clobber (overwrite) existing files.", ) argparser.add_argument( - '-n', '--no_header', action="store_false", + '-n', '--no_header', action="store_true", help="Do not write the standard EBML header segment.", ) args = argparser.parse_args() + header = not args.no_header # Removing some naming confusion, if no_header=false, header argument should be true with utils.load_files(args, binary_output=True) as (schema, out): - ebmlite.util.xml2ebml(args.input, out, schema, headers=args.no_header) # , sizeLength=4, headers=True, unknown=True) + ebmlite.util.xml2ebml(args.input, out, schema, headers=header) # , sizeLength=4, headers=True, unknown=True) if __name__ == "__main__":