@@ -16,6 +16,7 @@ def _parse_args():
1616 )
1717 parser .add_argument ('input_folder' , nargs = "?" , type = str , help = "The folder to scan for input files." )
1818 parser .add_argument ('-a' , "--author" , type = str , help = "Name of the author." )
19+ parser .add_argument ('-b' , "--bitrate" , type = str , default = "128k" , help = "Bitrate to use for the audiobook. (e.g. 128k)" )
1920 parser .add_argument ('-c' , "--cover" , type = str , help = "Image file to use as cover" )
2021 parser .add_argument ('-f' , "--files" , nargs = '+' , type = str , action = 'extend' ,
2122 help = "Specific files to use for the audiobook. Overrides `input_folder`." )
@@ -40,7 +41,7 @@ def check_args(input_folder, files, output_dir):
4041 # We either need an input folder or a list of files.
4142 if not input_folder and not files :
4243 print ("[bold red]Error:[/] You must provide either an input folder or a list of files." )
43- return - 1
44+ return False
4445
4546 # Warn the user if they specified both an input folder and a list of files.
4647 if input_folder and files :
@@ -50,18 +51,22 @@ def check_args(input_folder, files, output_dir):
5051 # Make sure the output directory exists, if it was specified.
5152 if output_dir and not Path (output_dir ).is_dir ():
5253 print (f"[bold red]Error:[/] '{ output_dir } ' is not a directory." )
53- return - 1
54+ return False
55+
56+ return True
5457
5558
5659def run ():
5760 """Entrypoint for bind subcommand."""
5861 args = _parse_args ()
5962
60- check_args (args .input_folder , args .files , args .output_dir )
63+ if not check_args (args .input_folder , args .files , args .output_dir ):
64+ return - 1
6165
6266 # Set info from args
6367 book = Audiobook (
6468 author = args .author ,
69+ bitrate = args .bitrate ,
6570 cover = args .cover ,
6671 output_name = args .output_name ,
6772 title = args .title ,
@@ -95,9 +100,6 @@ def run():
95100 return 0
96101
97102 # Add the files to the binder
98- if not args .input_folder :
99- print ("[red]Error:[/] No input folder specified." )
100- return - 1
101103 book .add_chapters_from_directory (
102104 input_dir = args .input_folder ,
103105 use_filenames = args .use_filename ,
0 commit comments