2121
2222
2323@app .command ()
24- def new (
25- input : list [str ] = typer .Argument (
26- ...,
24+ def generate (
25+ name : str = typer .Option (..., help = "Name of the podcast episode" ),
26+ input : list [str ] | None = typer .Argument (
27+ None ,
2728 help = "Paths to input files or URLs. Can specify multiple inputs." ,
2829 ),
29- name : str = typer .Option (..., help = "Name of the podcast episode" ),
3030 config : Path = typer .Option (
3131 Path ("config/config_openai.json" ),
3232 help = "Path to the podcast configuration file" ,
@@ -38,34 +38,44 @@ def new(
3838
3939 For example:
4040
41- nn new <url|file> [<url|file>...] --name <name> --config config/config_openai.json
41+ nn generate <url|file> [<url|file>...] --name <name> --config config/config_openai.json
4242 """
43- typer .echo (f"Generating script from { len ( input ) } source(s)" )
43+ typer .secho (f"Generating podcast episode { name } " , fg = typer . colors . GREEN )
4444
4545 output_dir = Path ("output" ) / name
4646 output_dir .mkdir (parents = True , exist_ok = True )
4747
48- typer .echo ("Extracting content from inputs" )
4948 content_path = output_dir / "content.txt"
5049
5150 if content_path .exists ():
5251 with open (content_path , "r" ) as f :
5352 content = f .read ()
5453 else :
54+ if input is None :
55+ typer .secho (
56+ "No input provided. Please specify input files or URLs." ,
57+ fg = typer .colors .RED ,
58+ )
59+ raise typer .Exit (1 )
60+
61+ typer .secho (f"Extracting content from inputs { input } " , fg = typer .colors .YELLOW )
5562 content = extract_content (input )
5663
5764 with open (output_dir / "content.txt" , "w" ) as f :
5865 f .write (content )
5966
60- typer .echo (f"Generating podcast episode { name } " )
67+ typer .secho (f"Generating podcast episode { name } " , fg = typer . colors . GREEN )
6168 create_podcast_episode (
6269 name ,
6370 content ,
6471 config_path = config ,
6572 only_script = only_script ,
6673 )
6774
68- typer .echo (f"Podcast generation complete. Output saved to { output_dir } " )
75+ typer .secho (
76+ f"Podcast generation complete. Output saved to { output_dir } " ,
77+ fg = typer .colors .GREEN ,
78+ )
6979
7080
7181def get_audio_length (file_path : Path ) -> float :
0 commit comments