21
21
22
22
23
23
@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 ,
27
28
help = "Paths to input files or URLs. Can specify multiple inputs." ,
28
29
),
29
- name : str = typer .Option (..., help = "Name of the podcast episode" ),
30
30
config : Path = typer .Option (
31
31
Path ("config/config_openai.json" ),
32
32
help = "Path to the podcast configuration file" ,
@@ -38,34 +38,44 @@ def new(
38
38
39
39
For example:
40
40
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
42
42
"""
43
- typer .echo (f"Generating script from { len ( input ) } source(s)" )
43
+ typer .secho (f"Generating podcast episode { name } " , fg = typer . colors . GREEN )
44
44
45
45
output_dir = Path ("output" ) / name
46
46
output_dir .mkdir (parents = True , exist_ok = True )
47
47
48
- typer .echo ("Extracting content from inputs" )
49
48
content_path = output_dir / "content.txt"
50
49
51
50
if content_path .exists ():
52
51
with open (content_path , "r" ) as f :
53
52
content = f .read ()
54
53
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 )
55
62
content = extract_content (input )
56
63
57
64
with open (output_dir / "content.txt" , "w" ) as f :
58
65
f .write (content )
59
66
60
- typer .echo (f"Generating podcast episode { name } " )
67
+ typer .secho (f"Generating podcast episode { name } " , fg = typer . colors . GREEN )
61
68
create_podcast_episode (
62
69
name ,
63
70
content ,
64
71
config_path = config ,
65
72
only_script = only_script ,
66
73
)
67
74
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
+ )
69
79
70
80
71
81
def get_audio_length (file_path : Path ) -> float :
0 commit comments