@@ -35,8 +35,9 @@ def main() -> None:
3535 parser .add_argument ("input" , type = str , help = "Input recording path" )
3636 parser .add_argument ("output" , type = str , help = "Output SigMF path (no extension)" )
3737 parser .add_argument ("-v" , "--verbose" , action = "count" , default = 0 , help = "Increase verbosity level" )
38- parser .add_argument ("-a" , "--archive" , action = "store_true" , help = "Output .sigmf archive only" )
39- parser .add_argument (
38+ exclusive_group = parser .add_mutually_exclusive_group ()
39+ exclusive_group .add_argument ("-a" , "--archive" , action = "store_true" , help = "Output .sigmf archive only" )
40+ exclusive_group .add_argument (
4041 "--ncd" , action = "store_true" , help = "Output .sigmf-meta only and process as a Non-Conforming Dataset (NCD)"
4142 )
4243 parser .add_argument ("--version" , action = "version" , version = f"%(prog)s v{ toolversion } " )
@@ -52,16 +53,19 @@ def main() -> None:
5253 input_path = Path (args .input )
5354 output_path = Path (args .output )
5455
55- # validate that ncd files are in same directory as input
56+ # for ncd check that input & output files are in same directory
5657 if args .ncd and input_path .parent .resolve () != output_path .parent .resolve ():
5758 raise SigMFConversionError (
5859 f"NCD files must be in the same directory as input file. "
5960 f"Input: { input_path .parent .resolve ()} , Output: { output_path .parent .resolve ()} "
6061 )
6162
63+ # check that the output path is a file and not a directory
64+ if output_path .is_dir ():
65+ raise SigMFConversionError (f"Output path must be a filename, not a directory: { output_path } " )
66+
6267 # detect file type using magic bytes (same logic as fromfile())
6368 magic_bytes = get_magic_bytes (input_path , count = 4 , offset = 0 )
64-
6569 if magic_bytes == b"RIFF" :
6670 # WAV file
6771 _ = wav_to_sigmf (wav_path = input_path , out_path = output_path , create_archive = args .archive , create_ncd = args .ncd )
0 commit comments