-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py_backup
166 lines (145 loc) · 6.38 KB
/
main.py_backup
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
import os
import time
import random
import src.services.VideoService as VideoService
from src.utils.colors import Colors, RGBColors
from src.utils.logger import Logger
from src.ui.menu import Menu
class VideoProcessor:
def __init__(self):
menu = Menu()
self.video_files = self.find_mp4_files()
self.selected_font = menu.get_user_font_choice()
# self.rgb_color = self.get_user_color_choice()
# self.language_selected = self.get_language_choice()
# self.process_directory_videos()
# def get_user_font_choice(self):
# self.print_separator()
# print(f"SELECT FONT. Default: 0 ({VideoService.DEFAULT_FONT_NAME})")
# print()
# [print(f"{id}. {name}") for name, id in VideoService.FONTS_AVAILABLE.items()]
# return self.prompt_font_selection()
# def get_language_choice(self):
# self.print_separator()
# print(f"SELECT LANGUAGE. Default: 0 (English)")
# print()
# print(f"0. English")
# print(f"1. Spanish")
# print()
# try:
# choice = int(input("> "))
# if choice == 1:
# return "spanish"
# except ValueError:
# pass
# return "english"
# def get_user_color_choice(self):
# self.print_separator()
# print(f"SELECT COLOR. Default: 0 (White)")
# print()
# print(f"0. White")
# print(f"1. {Colors.BOLD}Black{Colors.ENDC}")
# print(f"2. {Colors.RED}Red{Colors.ENDC}")
# print(f"3. {Colors.GREEN}Green{Colors.ENDC}")
# print(f"4. {Colors.BLUE}Blue{Colors.ENDC}")
# print("5. Custom RGB")
# print()
# try:
# choice = int(input("> "))
# if 0 <= choice < 5:
# return RGBColors.COLORS[choice]
# if choice == 5:
# return self.prompt_color_selection()
# except ValueError:
# pass
# print(
# f"{Colors.BOLD}{Colors.WARNING}[WARNING]{Colors.ENDC} Invalid input. Using default color: white"
# )
# return RGBColors.COLORS[0]
# def prompt_color_selection(self):
# print()
# print("Enter RGB values (0-255) separated by commas (e.g. 255,0,0 for red): ")
# print()
# try:
# rgb = input("> ").split(",")
# if len(rgb) == 3:
# return tuple(map(int, rgb))
# except ValueError:
# pass
# print(
# f"{Colors.BOLD}{Colors.WARNING}[WARNING]{Colors.ENDC} Invalid input. Using default color: white"
# )
# return (255, 255, 255)
# def prompt_font_selection(self):
# try:
# print()
# choice = int(input("> "))
# if 0 <= choice < len(VideoService.FONTS_AVAILABLE):
# return choice
# except ValueError:
# pass
# print(
# f"{Colors.BOLD}{Colors.WARNING}[WARNING]{Colors.ENDC} Invalid input. Using default font: {VideoService.DEFAULT_FONT_NAME}"
# )
# return VideoService.DEFAULT_FONT_VALUE
# def process_directory_videos(self):
# if self.video_files:
# [
# self.process_video(file, language=self.language_selected)
# for file in self.video_files
# ]
# else:
# print(
# f"{Colors.BOLD}{Colors.WARNING}[WARNING]{Colors.ENDC} No video files found."
# )
def find_mp4_files(self):
Logger.log(
"Searching mp4 files in current directory",
Logger.Severity.INFO,
end="",
flush=True,
)
Logger.print_dot_animation()
video_files = [f for f in os.listdir() if f.lower().endswith(".mp4")]
# time.sleep(random.randint(1, 3))
if not video_files:
Logger.log("No video files found in current directory.", Logger.Severity.WARNING)
exit()
Logger.log(f"\nFound {len(video_files)} video files.", Logger.Severity.SUCCESS)
Logger.log(f"Video files found: {video_files}", Logger.Severity.INFO)
time.sleep(random.randint(2, 3))
return video_files
# def process_video(self, file_name, language):
# self.print_separator()
# print(
# f"{Colors.BOLD}{Colors.OKBLUE}[INFO]{Colors.ENDC} Processing video: {file_name}..."
# )
# try:
# VideoService.process_video(
# file_name,
# language=language,
# font=self.selected_font,
# color=self.rgb_color,
# )
# except Exception as e:
# print(
# f"{Colors.BOLD}{Colors.FAIL}[ERROR]{Colors.ENDC} Failed to process video: {file_name}\nError: {e}"
# )
# print(e.message)
# self.print_separator()
if __name__ == "__main__":
print(
"""
████████╗██╗███╗ ███╗███████╗███████╗████████╗ █████╗ ███╗ ███╗██████╗ ██╗ ██╗
╚══██╔══╝██║████╗ ████║██╔════╝██╔════╝╚══██╔══╝██╔══██╗████╗ ████║██╔══██╗╚██╗ ██╔╝
██║ ██║██╔████╔██║█████╗ ███████╗ ██║ ███████║██╔████╔██║██████╔╝ ╚████╔╝
██║ ██║██║╚██╔╝██║██╔══╝ ╚════██║ ██║ ██╔══██║██║╚██╔╝██║██╔═══╝ ╚██╔╝
██║ ██║██║ ╚═╝ ██║███████╗███████║ ██║ ██║ ██║██║ ╚═╝ ██║██║ ██║
╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝
Version: 1.1.0
Author: @Robbna
Repository: https://github.com/Robbna/TimestamPy
"""
)
VideoProcessor()
input("Press any key to exit...")