Skip to content

Commit 553ab9c

Browse files
committed
Update color naming
Signed-off-by: Skye <[email protected]>
1 parent dd10815 commit 553ab9c

File tree

23 files changed

+521
-521
lines changed

23 files changed

+521
-521
lines changed

audiobot/cli.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def process(self):
4949
def mono_processor(self):
5050
try:
5151
file_type = self.mime.from_file(self.args.file)
52-
Clogger.info(f"{fg.BLUE_FG}Detected file type: {file_type}{RESET}")
52+
Clogger.info(f"{fg.BLUE}Detected file type: {file_type}{RESET}")
5353
if file_type.startswith("audio"):
5454
if self.args.transcribe:
5555
transcribe_audio(self.args.file)
@@ -81,7 +81,7 @@ def batch_processor(self):
8181
for file in files:
8282
full_path = os.path.join(root, file)
8383
file_type = self.mime.from_file(full_path)
84-
Clogger.info(f"{fg.BLUE_FG}Detected file type: {file_type}{RESET}")
84+
Clogger.info(f"{fg.BLUE}Detected file type: {file_type}{RESET}")
8585
if file_type.startswith("audio"):
8686
if self.args.transcribe:
8787
transcribe_audio(full_path)
@@ -119,7 +119,7 @@ def cli(argsv=None):
119119
)
120120
parser.add_argument(
121121
"file",
122-
help=f"{fg.CYAN_FG}The input audio, video file, or directory.{RESET}",
122+
help=f"{fg.CYAN}The input audio, video file, or directory.{RESET}",
123123
)
124124
parser.add_argument(
125125
"-e",
@@ -139,47 +139,47 @@ def cli(argsv=None):
139139
"distortion",
140140
"denoise",
141141
],
142-
help=f"{fg.CYAN_FG}The voice effect to apply.{RESET}",
142+
help=f"{fg.CYAN}The voice effect to apply.{RESET}",
143143
)
144144
parser.add_argument(
145145
"--cutoff",
146146
type=int,
147-
help=f"Cutoff frequency for denoise operation, defualt={fg.YELLOW_FG}200{RESET}",
147+
help=f"Cutoff frequency for denoise operation, defualt={fg.YELLOW}200{RESET}",
148148
)
149149
parser.add_argument(
150150
"-N",
151151
"--noise",
152152
choices=["low", "high", "both"],
153153
type=str,
154154
default="low",
155-
help=f"Specifies the type of noise to remove choices:[{fg.BLUE_FG}low, high, both{RESET}] defualt={fg.YELLOW_FG}low{RESET}",
155+
help=f"Specifies the type of noise to remove choices:[{fg.BLUE}low, high, both{RESET}] defualt={fg.YELLOW}low{RESET}",
156156
)
157157
parser.add_argument(
158158
"-o",
159159
"--output",
160-
help=f"{fg.CYAN_FG}Output directory for modified files.{RESET}",
160+
help=f"{fg.CYAN}Output directory for modified files.{RESET}",
161161
)
162162
parser.add_argument(
163163
"-v",
164164
"--verbose",
165165
action="store_true",
166-
help=f"{fg.CYAN_FG}Increase output verbosity.{RESET}",
166+
help=f"{fg.CYAN}Increase output verbosity.{RESET}",
167167
)
168168
parser.add_argument(
169169
"-b",
170170
"--batch",
171171
action="store_true",
172-
help=f"{fg.CYAN_FG}Batch process all files in a directory.{RESET}",
172+
help=f"{fg.CYAN}Batch process all files in a directory.{RESET}",
173173
)
174174
parser.add_argument(
175175
"--visualize",
176176
action="store_true",
177-
help=f"{fg.CYAN_FG}Visualize the audio waveform before and after modification.{RESET}",
177+
help=f"{fg.CYAN}Visualize the audio waveform before and after modification.{RESET}",
178178
)
179179
parser.add_argument(
180180
"--transcribe",
181181
action="store_true",
182-
help=f"{fg.CYAN_FG}Transcribe the audio content before applying the effect.{RESET}",
182+
help=f"{fg.CYAN}Transcribe the audio content before applying the effect.{RESET}",
183183
)
184184
parser.add_argument("--audio_effect", action="store_true", help=argparse.SUPPRESS)
185185

audiobot/core/audio/core.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def lowpass_filter(self, samples, cutoff=200, sample_rate=44100):
139139
"""
140140

141141
cutoff = self._cutoff if self._cutoff else cutoff
142-
Clogger.debug(f"{fg.BLUE_FG}cutoff: {fg.CYAN_FG}{cutoff}{RESET}")
142+
Clogger.debug(f"{fg.BLUE}cutoff: {fg.CYAN}{cutoff}{RESET}")
143143
Clogger.info("Apply a low-pass filter to remove frequencies higher than cutoff")
144144
nyquist = 0.5 * sample_rate
145145
normal_cutoff = cutoff / nyquist
@@ -160,12 +160,12 @@ def whisper(self, audio_segment):
160160

161161
def highpass(self, audio_segment, cutoff: int = 200):
162162
cutoff = self._cutoff if self._cutoff else cutoff
163-
Clogger.info(f"Cutoff: {fg.BBLUE_FG}{cutoff}{RESET}")
163+
Clogger.info(f"Cutoff: {fg.BBLUE}{cutoff}{RESET}")
164164
return effects.high_pass_filter(audio_segment, cutoff=cutoff)
165165

166166
def lowpass(self, audio_segment, cutoff: int = 2200):
167167
cutoff = self._cutoff if self._cutoff else cutoff
168-
Clogger.info(f"Cutoff: {fg.BBLUE_FG}{cutoff}{RESET}")
168+
Clogger.info(f"Cutoff: {fg.BBLUE}{cutoff}{RESET}")
169169
return effects.low_pass_filter(audio_segment, cutoff=cutoff)
170170

171171
def normalize(self, audio_segment):
@@ -179,7 +179,7 @@ def __init__(self, sample_rate=44100):
179179
self._sos_low = {}
180180
self._sos_high = {}
181181
self._cutoff = config.options.get("cutoff")
182-
Clogger.debug(f"{fg.BLUE_FG}cutoff: {fg.CYAN_FG}{self._cutoff}{RESET}")
182+
Clogger.debug(f"{fg.BLUE}cutoff: {fg.CYAN}{self._cutoff}{RESET}")
183183

184184
def lowpass_filter(
185185
self, samples: np.ndarray, cutoff: int = 2200, order: int = 6
@@ -268,7 +268,7 @@ def denoise(
268268
noise = config.options.get("noise") if config.options.get("noise") else "low"
269269

270270
Clogger.info(
271-
f"{fg.BLUE_FG}Noise: {fg.CYAN_FG}{config.options.get('noise')}{RESET}"
271+
f"{fg.BLUE}Noise: {fg.CYAN}{config.options.get('noise')}{RESET}"
272272
)
273273
if noise == "low":
274274
# Remove high-frequency noise

audiobot/core/processor.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ def process_video_file(
3131
Process video file by applying audio effects and retaining original bitrate.
3232
"""
3333

34-
Clogger.info(f"Set Voice effect : {fg.MAGENTA_FG}{effect}{RESET}")
34+
Clogger.info(f"Set Voice effect : {fg.MAGENTA}{effect}{RESET}")
3535
Clogger.info(f"Processing video file: {input_file}")
3636

3737
try:
3838
# Get the original video bitrate
3939
original_bitrate = get_audio_bitrate(input_file, verbosity)
4040
if verbosity and original_bitrate:
4141
Clogger.info(
42-
f"Original video bitrate: {fg.YELLOW_FG}{original_bitrate}{RESET}"
42+
f"Original video bitrate: {fg.YELLOW}{original_bitrate}{RESET}"
4343
)
4444

4545
# Capture stdout and stderr
@@ -64,7 +64,7 @@ def process_video_file(
6464

6565
# Apply the selected voice effect
6666
Clogger.info(
67-
f"Applying the [{fg.BBWHITE_FG}{effect}{RESET}{fg.GREEN_FG}] effect"
67+
f"Applying the [{fg.BBWHITE}{effect}{RESET}{fg.GREEN}] effect"
6868
)
6969
modified_audio = VoiceEffectProcessor(audio_segment, effect).apply_effect()
7070

@@ -92,9 +92,9 @@ def process_video_file(
9292
# Use the original bitrate or default to 5000k if unavailable
9393
if verbosity:
9494
Clogger.info(
95-
f"Set:\n\tCodec = [{fg.fg.MAGENTA_FG}libx264{fg.GREEN_FG}\n"
96-
f"\tCodec type = [{fg.fg.MAGENTA_FG}aac{fg.GREEN_FG}\n"
97-
f"\tBitrate = [{fg.MAGENTA_FG}{original_bitrate or '5000k'}{RESET}]"
95+
f"Set:\n\tCodec = [{fg.fg.MAGENTA}libx264{fg.GREEN}\n"
96+
f"\tCodec type = [{fg.fg.MAGENTA}aac{fg.GREEN}\n"
97+
f"\tBitrate = [{fg.MAGENTA}{original_bitrate or '5000k'}{RESET}]"
9898
)
9999

100100
final_video.write_videofile(
@@ -130,9 +130,9 @@ def __init__(self):
130130
def process_audio_file(
131131
self, input_file, effect, output_dir, verbosity, visualize=False
132132
):
133-
Clogger.info(f"Set Voice effect : {fg.MAGENTA_FG}{effect}{RESET}")
133+
Clogger.info(f"Set Voice effect : {fg.MAGENTA}{effect}{RESET}")
134134

135-
Clogger.info(f"Processing audio file: {fg.MAGENTA_FG}{input_file}{RESET}")
135+
Clogger.info(f"Processing audio file: {fg.MAGENTA}{input_file}{RESET}")
136136

137137
try:
138138
audio_segment = AudioSegment.from_file(input_file)

audiobot/utils/logging_utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
class LoggingFormatter(logging.Formatter):
88
COLORS = {
9-
logging.DEBUG: fg.BBLUE_FG,
10-
logging.INFO: fg.GREEN_FG,
11-
logging.WARNING: fg.YELLOW_FG,
12-
logging.ERROR: fg.RED_FG,
13-
logging.CRITICAL: fg.MAGENTA_FG,
9+
logging.DEBUG: fg.BBLUE,
10+
logging.INFO: fg.GREEN,
11+
logging.WARNING: fg.YELLOW,
12+
logging.ERROR: fg.RED,
13+
logging.CRITICAL: fg.MAGENTA,
1414
}
1515

1616
def format(self, record):
17-
log_color = self.COLORS.get(record.levelno, fg.WHITE_FG)
17+
log_color = self.COLORS.get(record.levelno, fg.WHITE)
1818
log_message = super().format(record)
1919
return f"{log_color}{log_message}{RESET}"
2020

audiobot/utils/metadata_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def get_audio_bitrate(input_file, verbosity=False):
2525
"""
2626
if verbosity:
2727
Clogger.info(
28-
f"Fetch the original bitrate of the video file using {fg.YELLOW_FG}ffmpeg{RESET}."
28+
f"Fetch the original bitrate of the video file using {fg.YELLOW}ffmpeg{RESET}."
2929
)
3030
try:
3131
try:

filemac/cli/converter.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __init__(self, _dir_, _format_, no_resume, threads, _isolate_=None):
3434
)
3535
if self._isolate_:
3636
print(
37-
f"INFO\t {fg.FMAGENTA_FG}Isolate {fg.DCYAN_FG}{self._isolate_}{RESET}"
37+
f"INFO\t {fg.FMAGENTA}Isolate {fg.DCYAN}{self._isolate_}{RESET}"
3838
)
3939

4040
def _unbundle_dir_(self):
@@ -49,7 +49,7 @@ def _unbundle_dir_(self):
4949

5050
if _ext_ in self._ls_ and os.path.exists(_path_):
5151
print(
52-
f"INFO\t {fg.FYELLOW_FG}Parse {fg.BLUE_FG}{_path_}{RESET}"
52+
f"INFO\t {fg.FYELLOW}Parse {fg.BLUE}{_path_}{RESET}"
5353
)
5454
init = MethodMappingEngine(_path_, self._format_)
5555
init.document_eval()
@@ -104,7 +104,7 @@ def spreedsheet(self, conv):
104104
elif self.outf.lower() == "db":
105105
conv.convert_xlsx_to_database()
106106
else:
107-
print(f"{fg.RED_FG}Unsupported output format❌{RESET}")
107+
print(f"{fg.RED}Unsupported output format❌{RESET}")
108108

109109
def word(self, conv):
110110
if self.outf.lower() in ("txt", "text"):
@@ -117,7 +117,7 @@ def word(self, conv):
117117
conv = GoogleTTS(self.file)
118118
conv.audiofy()
119119
else:
120-
print(f"{fg.RED_FG}Unsupported output format❌{RESET}")
120+
print(f"{fg.RED}Unsupported output format❌{RESET}")
121121

122122
def text(self, conv):
123123
if self.outf.lower() == "pdf":
@@ -128,7 +128,7 @@ def text(self, conv):
128128
conv = GoogleTTS(self.file)
129129
conv.audiofy()
130130
else:
131-
print(f"{fg.RED_FG}Unsupported output format❌{RESET}")
131+
print(f"{fg.RED}Unsupported output format❌{RESET}")
132132

133133
def ppt(self, conv):
134134
if self.outf.lower() in ("doc", "docx", "word"):
@@ -143,7 +143,7 @@ def ppt(self, conv):
143143
conv = GoogleTTS(self.file)
144144
conv.audiofy()
145145
else:
146-
print(f"{fg.RED_FG}Unsupported output format❌{RESET}")
146+
print(f"{fg.RED}Unsupported output format❌{RESET}")
147147

148148
def pdf(self, conv):
149149
if self.outf.lower() in ("doc", "docx", "word"):
@@ -154,7 +154,7 @@ def pdf(self, conv):
154154
conv = GoogleTTS(self.file)
155155
conv.audiofy()
156156
else:
157-
print(f"{fg.RED_FG}Unsupported output format❌{RESET}")
157+
print(f"{fg.RED}Unsupported output format❌{RESET}")
158158

159159
def document_eval(self):
160160
self.doc_ls = ["docx", "doc"]
@@ -181,7 +181,7 @@ def document_eval(self):
181181
conv.convert_csv_to_xlsx()
182182

183183
else:
184-
print(f"{fg.fg.BYELLOW_FG}Unsupported Conversion type❌{RESET}")
184+
print(f"{fg.fg.BYELLOW}Unsupported Conversion type❌{RESET}")
185185
pass
186186
except Exception as e:
187187
logger.error(e)

0 commit comments

Comments
 (0)