-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathedit_blog_post.py
37 lines (30 loc) · 1.07 KB
/
edit_blog_post.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import os
import argparse
from src.video import Video
from src.blog_post import BlogPost
from src.editor import read_process_dict, read_text, process_text
def edit_blog_post(video_url):
output_directory = 'output'
input_directory = 'input'
process_dict_name = 'process_dictionary.json'
process_dict_path = os.path.join(input_directory, process_dict_name)
video = Video(video_url, output_directory)
blog_post = BlogPost(video, output_directory)
blog_post_path = blog_post.get_md_path()
process_dict = read_process_dict(process_dict_path)
text = read_text(blog_post_path)
processed_text = process_text(text, process_dict)
blog_post.set_text(processed_text)
markdown_post = blog_post.generate_markdown_post()
blog_post.save_markdown_post(markdown_post)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'-v',
'--video',
action='store',
dest='video_url',
help='The Youtube video url'
)
args = parser.parse_args()
edit_blog_post(args.video_url)