File size: 1,683 Bytes
0191eab
 
b9adb22
0191eab
 
 
 
 
 
 
 
 
 
 
b9adb22
0191eab
 
 
 
b9adb22
 
 
0191eab
 
 
 
 
 
 
b9adb22
0191eab
 
 
 
b9adb22
0191eab
 
b9adb22
 
 
 
0191eab
b9adb22
 
0191eab
b9adb22
0191eab
 
 
 
 
 
 
 
b9adb22
0191eab
 
 
 
 
 
 
 
 
b9adb22
0191eab
 
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# utils.py
import asyncio
import csv
import platform
from dotenv import find_dotenv, load_dotenv
from utils import *

# msg.py
import msg

# arg_parser.py
from src.arg_parser import parse_args

# video_creator.py
from src.video_creator import ClipMaker

# Default directory
HOME = Path.cwd()

# List of clips to generate
video_csv = HOME / 'clips.csv'
video_data = csv.DictReader(open(video_csv, 'r', encoding='utf-8'), delimiter='|')


#######################
#         CODE        #
#######################


async def main(video_list) -> bool:
    console.clear()  # Clear terminal

    args = await parse_args()

    for video in video_list:
        with console.status(msg.STATUS) as status:

            # Load env vars (if any)
            load_dotenv(find_dotenv())

            console.log(f"{msg.OK}Finish loading environment variables")

            video_creator = ClipMaker(video, args)
            video_creator.download_background_video()
            video_creator.load_model()
            video_creator.merge_clip_text()
            await video_creator.text_to_speech()
            video_creator.generate_transcription()
            video_creator.select_background()
            video_creator.integrate_subtitles()
            if args.upload_tiktok:
                video_creator.upload_to_tiktok()

        console.log(f'{msg.DONE} {str(video_creator.mp4_final_video)}')
    return True


if __name__ == "__main__":

    if platform.system() == 'Windows':
        asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

    loop = asyncio.get_event_loop()

    loop.run_until_complete(main(video_list=video_data))

    loop.close()

    sys.exit(0)