-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
29 lines (23 loc) · 1.15 KB
/
main.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
from user_input_handler import get_user_input
from gradient_generator import generate_gradient
from halo import Halo
from colorama import Fore, Style
def main():
# Step 1: Get user inputs
user_inputs_list = get_user_input()
# Step 2: Process each cover
for i, user_inputs in enumerate(user_inputs_list, start=1):
print(Fore.CYAN + Style.BRIGHT + f"\nGenerating Cover {i}/{len(user_inputs_list)}...")
# Step 3: Use a spinner while generating the gradient
spinner = Halo(text=f"Generating gradient for cover {i}...", spinner="dots")
spinner.start()
try:
# Step 4: Generate the gradient with text
generate_gradient(**user_inputs)
spinner.succeed(Style.BRIGHT + f"Cover {i} successfully generated!")
print(Style.BRIGHT + Fore.GREEN + "→ " + Fore.WHITE + "Cover location: " + Style.NORMAL + user_inputs["output_file"])
except Exception as e:
spinner.fail(Fore.RED + f"An error occurred while generating cover {i}: {e}")
print(Fore.GREEN + Style.BRIGHT + "\nAll covers have been successfully generated!")
if __name__ == "__main__":
main()