Compare commits

...
7 Commits
13 changed files with 663 additions and 633 deletions

No files matched your search

+28 -19
View File
@@ -1558,8 +1558,8 @@ class KaraokeComposer:
background_image = self._load_image(
self.config.title_screen_background,
[
(17, 20, 39), # background
(255, 170, 204), # border
self.config.background, # background
self.config.border, # border
self.config.title_color, # title color
self.config.artist_color, # artist color
],
@@ -1658,8 +1658,9 @@ class KaraokeComposer:
for coord in self._gradient_to_tile_positions(transition):
self.writer.queue_packets(packets.get(coord, []))
INTRO_DURATION = 5 * CDG_FPS # 5 seconds * 300 frames per second = 1500 frames
FIRST_SYLLABLE_BUFFER = 3 * CDG_FPS # 3 seconds * 300 frames per second = 900 frames
# Replace hardcoded values with configured ones
INTRO_DURATION = int(self.config.intro_duration_seconds * CDG_FPS)
FIRST_SYLLABLE_BUFFER = int(self.config.first_syllable_buffer_seconds * CDG_FPS)
# Queue the intro screen for 5 seconds
end_time = INTRO_DURATION
@@ -1676,14 +1677,14 @@ class KaraokeComposer:
logger.debug(f"first syllable starts at {first_syllable_start_offset}")
MINIMUM_FIRST_SYLLABLE_TIME_FOR_NO_SILENCE = INTRO_DURATION + FIRST_SYLLABLE_BUFFER
# If the first syllable is within 8 seconds, add 5 seconds of silence
# If the first syllable is within buffer+intro time, add silence
# Otherwise, don't add any silence
if first_syllable_start_offset < MINIMUM_FIRST_SYLLABLE_TIME_FOR_NO_SILENCE:
self.intro_delay = MINIMUM_FIRST_SYLLABLE_TIME_FOR_NO_SILENCE
logger.info(f"First syllable within 8 seconds. Adding {self.intro_delay} frames of silence.")
logger.info(f"First syllable within {self.config.intro_duration_seconds + self.config.first_syllable_buffer_seconds} seconds. Adding {self.intro_delay} frames of silence.")
else:
self.intro_delay = 0
logger.info("First syllable after 8 seconds. No additional silence needed.")
logger.info("First syllable after buffer period. No additional silence needed.")
def _compose_outro(self, end: int):
# TODO Make it so the outro screen is not hardcoded
@@ -1695,12 +1696,12 @@ class KaraokeComposer:
logger.debug("loading outro background image")
# Load background image
background_image = self._load_image(
self.config.title_screen_background,
self.config.outro_background,
[
(17, 20, 39), # background
(255, 170, 204), # border
self.config.artist_color, # "Thank you for singing" color
self.config.title_color, # "nomadkaraoke.com" color
self.config.background, # background
self.config.border, # border
self.config.outro_line1_color,
self.config.outro_line2_color,
],
)
@@ -1712,33 +1713,41 @@ class KaraokeComposer:
text_image = Image.new("P", (CDG_VISIBLE_WIDTH, MAX_HEIGHT * 2), 0)
y = 0
# Render "Thank you for singing" text
# Render first line of outro text
outro_text_line1 = self.config.outro_text_line1.replace("$artist", self.config.artist).replace("$title", self.config.title)
for image in render_lines(
get_wrapped_text(
"THANK YOU FOR SINGING!",
outro_text_line1,
font=smallfont,
width=text_image.width,
).split("\n"),
font=smallfont,
):
text_image.paste(
image.point(lambda v: v and 2, "P"), # Use index 2 for artist color
image.point(lambda v: v and 2, "P"), # Use index 2 for line 1 color
((text_image.width - image.width) // 2, y),
mask=image.point(lambda v: v and 255, "1"),
)
y += int(smallfont.size)
# Render "nomadkaraoke.com" text
# Add vertical gap between title and artist using configured value
y += self.config.outro_line1_line2_gap
# Render second line of outro text
outro_text_line2 = self.config.outro_text_line2.replace("$artist", self.config.artist).replace("$title", self.config.title)
for image in render_lines(
get_wrapped_text(
"nomadkaraoke.com",
outro_text_line2,
font=smallfont,
width=text_image.width,
).split("\n"),
font=smallfont,
):
text_image.paste(
image.point(lambda v: v and 3, "P"), # Use index 3 for title color
image.point(lambda v: v and 3, "P"), # Use index 3 for line 2 color
((text_image.width - image.width) // 2, y),
mask=image.point(lambda v: v and 255, "1"),
)
@@ -1778,7 +1787,7 @@ class KaraokeComposer:
# Queue background image packets (and apply transition)
transition = Image.open(
package_dir / "transitions" / f"{self.config.title_screen_transition}.png"
package_dir / "transitions" / f"{self.config.outro_transition}.png"
)
for coord in self._gradient_to_tile_positions(transition):
self.writer.queue_packets(packets.get(coord, []))
+11
View File
@@ -104,6 +104,7 @@ class Settings:
file: Path
font: Path
title_screen_background: Path
outro_background: Path
outname: str = "output"
clear_mode: LyricClearMode = LyricClearMode.LINE_DELAYED
@@ -126,6 +127,16 @@ class Settings:
title_screen_transition: str = "centertexttoplogobottomtext"
title_artist_gap: int = 30
intro_duration_seconds: float = 5.0
first_syllable_buffer_seconds: float = 3.0
outro_transition: str = "centertexttoplogobottomtext"
outro_text_line1: str = "THANK YOU FOR SINGING!"
outro_text_line2: str = "nomadkaraoke.com"
outro_line1_line2_gap: int = 30
outro_line1_color: RGBColor = field(converter=to_rgbcolor, default="#ffffff")
outro_line2_color: RGBColor = field(converter=to_rgbcolor, default="#ffffff")
__all__ = [
"RGBColor",
Binary file not shown.
+27
View File
@@ -124,6 +124,15 @@ def generate_toml(
- lead_in_duration
- lead_in_total
- title_artist_gap
- intro_duration_seconds
- first_syllable_buffer_seconds
- outro_background
- outro_transition
- outro_text_line1
- outro_text_line2
- outro_line1_color
- outro_line2_color
- outro_line1_line2_gap
"""
# Validate required style parameters
required_styles = {
@@ -156,6 +165,15 @@ def generate_toml(
"lead_in_duration",
"lead_in_total",
"title_artist_gap",
"intro_duration_seconds",
"first_syllable_buffer_seconds",
"outro_background",
"outro_transition",
"outro_text_line1",
"outro_text_line2",
"outro_line1_color",
"outro_line2_color",
"outro_line1_line2_gap",
}
missing_styles = required_styles - set(cdg_styles.keys())
@@ -241,6 +259,15 @@ def generate_toml(
"title_screen_background": cdg_styles["title_screen_background"],
"title_screen_transition": cdg_styles["title_screen_transition"],
"instrumentals": instrumentals,
"intro_duration_seconds": cdg_styles["intro_duration_seconds"],
"first_syllable_buffer_seconds": cdg_styles["first_syllable_buffer_seconds"],
"outro_background": cdg_styles["outro_background"],
"outro_transition": cdg_styles["outro_transition"],
"outro_text_line1": cdg_styles["outro_text_line1"],
"outro_text_line2": cdg_styles["outro_text_line2"],
"outro_line1_color": cdg_styles["outro_line1_color"],
"outro_line2_color": cdg_styles["outro_line2_color"],
"outro_line1_line2_gap": cdg_styles["outro_line1_line2_gap"],
}
with open(output_file, "w", encoding="utf-8") as f:
@@ -109,6 +109,7 @@ class KaraokeFinalise:
"karaoke_mp3": " (Karaoke).mp3",
"karaoke_mov": " (Karaoke).mov",
"final_karaoke_mp4": " (Final Karaoke).mp4",
"final_karaoke_lossless_mkv": " (Final Karaoke Lossless).mkv",
"final_karaoke_cdg_zip": " (Final Karaoke CDG).zip",
"final_karaoke_txt_zip": " (Final Karaoke TXT).zip",
"final_karaoke_720p_mp4": " (Final Karaoke 720p).mp4",
@@ -166,6 +167,7 @@ class KaraokeFinalise:
"karaoke_mp3": f"{base_name}{self.suffixes['karaoke_mp3']}",
"with_vocals_mp4": f"{base_name}{self.suffixes['with_vocals_mp4']}",
"final_karaoke_mp4": f"{base_name}{self.suffixes['final_karaoke_mp4']}",
"final_karaoke_lossless_mkv": f"{base_name}{self.suffixes['final_karaoke_lossless_mkv']}",
"final_karaoke_720p_mp4": f"{base_name}{self.suffixes['final_karaoke_720p_mp4']}",
}
@@ -349,10 +351,10 @@ class KaraokeFinalise:
return truncated_title
def upload_final_mp4_to_youtube_with_title_thumbnail(self, artist, title, input_files, output_files):
self.logger.info(f"Uploading final MP4 to YouTube with title thumbnail...")
self.logger.info(f"Uploading final lossless MKV to YouTube with title thumbnail...")
if self.dry_run:
self.logger.info(
f'DRY RUN: Would upload {output_files["final_karaoke_mp4"]} to YouTube with thumbnail {input_files["title_jpg"]} using client secrets file: {self.youtube_client_secrets_file}'
f'DRY RUN: Would upload {output_files["final_karaoke_lossless_mkv"]} to YouTube with thumbnail {input_files["title_jpg"]} using client secrets file: {self.youtube_client_secrets_file}'
)
else:
youtube_title = f"{artist} - {title} (Karaoke)"
@@ -387,11 +389,11 @@ class KaraokeFinalise:
"status": {"privacyStatus": "public"},
}
# Use MediaFileUpload to handle the video file
media_file = MediaFileUpload(output_files["final_karaoke_mp4"], mimetype="video/mp4", resumable=True)
# Use MediaFileUpload to handle the video file - now using the lossless MKV
media_file = MediaFileUpload(output_files["final_karaoke_lossless_mkv"], mimetype="video/x-matroska", resumable=True)
# Call the API's videos.insert method to create and upload the video.
self.logger.info(f"Uploading final MP4 to YouTube...")
self.logger.info(f"Uploading final lossless MKV to YouTube...")
request = youtube.videos().insert(part="snippet,status", body=body, media_body=media_file)
response = request.execute()
@@ -541,11 +543,15 @@ class KaraokeFinalise:
self.logger.info(f"Remuxing and encoding output video files...")
# Check if output files already exist, if so, ask user to overwrite or skip
if os.path.isfile(output_files["karaoke_mov"]) and os.path.isfile(output_files["final_karaoke_mp4"]):
if (
os.path.isfile(output_files["karaoke_mov"])
and os.path.isfile(output_files["final_karaoke_mp4"])
and os.path.isfile(output_files["final_karaoke_lossless_mkv"])
):
if not self.prompt_user_bool(
f"Found existing Final Karaoke output file: {output_files['final_karaoke_mp4']}. Overwrite (y) or skip (n)?",
f"Found existing Final Karaoke output files. Overwrite (y) or skip (n)?",
):
self.logger.info(f"Skipping Karaoke MOV remux and Final MP4 render, existing files will be used.")
self.logger.info(f"Skipping Karaoke MOV remux and Final video renders, existing files will be used.")
return
# Remux the synced video with the instrumental audio to produce an instrumental karaoke MOV file
@@ -574,7 +580,7 @@ class KaraokeFinalise:
# Check if end_mov file exists and include it in the concat command
if "end_mov" in input_files and os.path.isfile(input_files["end_mov"]):
self.logger.info(f"Found end_mov file: {input_files['end_mov']}, including in final MP4")
self.logger.info(f"Found end_mov file: {input_files['end_mov']}, including in final MKV")
end_mov_file = shlex.quote(os.path.abspath(input_files["end_mov"]))
env_mov_input = f"-i {end_mov_file}"
ffmpeg_filter = '-filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0][2:v:0][2:a:0]concat=n=3:v=1:a=1[outv][outa]"'
@@ -587,15 +593,31 @@ class KaraokeFinalise:
if "aac_at" in result:
aac_codec = "aac_at"
join_ffmpeg_command = f'{self.ffmpeg_base_command} -i {title_mov_file} -i {karaoke_mov_file} {env_mov_input} {ffmpeg_filter} -map "[outv]" -map "[outa]" -c:v libx264 -c:a {aac_codec} -q:a 14 {output_final_mp4_file}'
# Create the lossless MKV version first (for YouTube upload)
env_mov_input = ""
ffmpeg_filter = '-filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[outv][outa]"'
self.logger.debug(f"Running command: {join_ffmpeg_command}")
self.execute_command(join_ffmpeg_command, "Joining title and instrumental videos")
# Check if end_mov file exists and include it in the concat command
if "end_mov" in input_files and os.path.isfile(input_files["end_mov"]):
self.logger.info(f"Found end_mov file: {input_files['end_mov']}, including in final MKV")
end_mov_file = shlex.quote(os.path.abspath(input_files["end_mov"]))
env_mov_input = f"-i {end_mov_file}"
ffmpeg_filter = '-filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0][2:v:0][2:a:0]concat=n=3:v=1:a=1[outv][outa]"'
# Prompt user to check final MP4 file before proceeding
# Create lossless MKV with FLAC audio
join_ffmpeg_command_mkv = f'{self.ffmpeg_base_command} -i {title_mov_file} -i {karaoke_mov_file} {env_mov_input} {ffmpeg_filter} -map "[outv]" -map "[outa]" -c:v libx264 -c:a flac "{output_files["final_karaoke_lossless_mkv"]}"'
self.execute_command(join_ffmpeg_command_mkv, "Creating lossless MKV version with FLAC audio")
# Create the regular MP4 version (for sharing)
join_ffmpeg_command = f'{self.ffmpeg_base_command} -i {title_mov_file} -i {karaoke_mov_file} {env_mov_input} {ffmpeg_filter} -map "[outv]" -map "[outa]" -c:v libx264 -c:a {aac_codec} -q:a 14 "{output_files["final_karaoke_mp4"]}"'
self.execute_command(join_ffmpeg_command, "Creating MP4 version with AAC audio")
# Prompt user to check final video files before proceeding
self.prompt_user_confirmation_or_raise_exception(
f"Final MP4 file created: {output_files['final_karaoke_mp4']}, please check it! Proceed?",
"Refusing to proceed without user confirmation they're happy with the Final MP4.",
f"Final video files created: {output_files['final_karaoke_mp4']} and {output_files['final_karaoke_lossless_mkv']}, please check them! Proceed?",
"Refusing to proceed without user confirmation they're happy with the Final videos.",
allow_empty=True,
)
+310 -188
View File
@@ -3,69 +3,52 @@ import sys
import re
import glob
import logging
import lyricsgenius
import tempfile
import shutil
import importlib.resources as pkg_resources
import yt_dlp.YoutubeDL as ydl
from PIL import Image, ImageDraw, ImageFont
from lyrics_transcriber import LyricsTranscriber
from karaoke_lyrics_processor import KaraokeLyricsProcessor
from pydub import AudioSegment
class KaraokePrep:
def __init__(
self,
# Basic inputs
input_media=None,
artist=None,
title=None,
filename_pattern=None,
# Logging & Debugging
dry_run=False,
log_level=logging.DEBUG,
log_formatter=None,
render_bounding_boxes=False,
# Input/Output Configuration
output_dir=".",
create_track_subfolders=False,
lossless_output_format="FLAC",
output_png=True,
output_jpg=True,
# Audio Processing Configuration
clean_instrumental_model="model_bs_roformer_ep_317_sdr_12.9755.ckpt",
backing_vocals_models=["mel_band_roformer_karaoke_aufr33_viperx_sdr_10.1956.ckpt"],
other_stems_models=["htdemucs_6s.yaml"],
model_file_dir=os.path.join(tempfile.gettempdir(), "audio-separator-models"),
output_dir=".",
existing_instrumental=None,
lossless_output_format="FLAC",
denoise_enabled=True,
normalization_enabled=True,
# Hardware Acceleration
use_cuda=False,
use_coreml=False,
normalization_enabled=True,
denoise_enabled=True,
create_track_subfolders=False,
# Lyrics Configuration
lyrics_artist=None,
lyrics_title=None,
skip_lyrics=False,
output_png=True,
output_jpg=True,
render_bounding_boxes=False,
existing_title_image=None,
intro_video_duration=5,
intro_background_color="#000000",
intro_background_image=None,
intro_font="Montserrat-Bold.ttf",
intro_artist_color="#ffffff",
intro_title_color="#ffdf6b",
intro_extra_text=None,
intro_extra_text_color="#ffffff",
intro_extra_text_region=None,
intro_title_region=None,
intro_artist_region=None,
existing_end_image=None,
end_video_duration=5,
end_background_color="#000000",
end_background_image=None,
end_font="Montserrat-Bold.ttf",
end_artist_color="#ffffff",
end_title_color="#ffdf6b",
end_extra_text="THANK YOU FOR SINGING!",
end_extra_text_color="#ffffff",
end_extra_text_region=None,
end_title_region=None,
end_artist_region=None,
skip_transcription=False,
# Style Configuration
style_params=None,
):
self.logger = logging.getLogger(__name__)
self.logger.setLevel(log_level)
@@ -83,7 +66,6 @@ class KaraokePrep:
self.logger.debug(f"KaraokePrep instantiating with input_media: {input_media} artist: {artist} title: {title}")
self.dry_run = dry_run
self.extractor = None
self.media_id = None
self.url = None
@@ -91,27 +73,123 @@ class KaraokePrep:
self.artist = artist
self.title = title
self.filename_pattern = filename_pattern
# Audio Processing
self.clean_instrumental_model = clean_instrumental_model
self.backing_vocals_models = backing_vocals_models
self.other_stems_models = other_stems_models
self.model_file_dir = model_file_dir
self.existing_instrumental = existing_instrumental
self.denoise_enabled = denoise_enabled
self.normalization_enabled = normalization_enabled
# Input/Output
self.output_dir = output_dir
self.lossless_output_format = lossless_output_format.lower()
self.create_track_subfolders = create_track_subfolders
self.output_png = output_png
self.output_jpg = output_jpg
# Hardware
self.use_cuda = use_cuda
self.use_coreml = use_coreml
self.normalization_enabled = normalization_enabled
self.denoise_enabled = denoise_enabled
self.create_track_subfolders = create_track_subfolders
self.existing_instrumental = existing_instrumental
self.existing_title_image = existing_title_image
# Lyrics
self.lyrics = None
self.lyrics_artist = lyrics_artist
self.lyrics_title = lyrics_title
self.skip_lyrics = skip_lyrics
self.skip_transcription = skip_transcription
# Style
self.render_bounding_boxes = render_bounding_boxes
self.output_png = output_png
self.output_jpg = output_jpg
self.intro_video_duration = intro_video_duration
self.end_video_duration = end_video_duration
# Set default style parameters if none provided
if style_params is None:
style_params = {
"intro": {
"video_duration": 5,
"existing_image": None,
"background_color": "#000000",
"background_image": None,
"font": "Montserrat-Bold.ttf",
"artist_color": "#ffdf6b",
"artist_gradient": None,
"title_color": "#ffffff",
"title_gradient": None,
"title_region": "370, 200, 3100, 480",
"artist_region": "370, 700, 3100, 480",
"extra_text": None,
"extra_text_color": "#ffffff",
"extra_text_gradient": None,
"extra_text_region": "370, 1200, 3100, 480",
"title_text_transform": None, # none, uppercase, lowercase, propercase
"artist_text_transform": None, # none, uppercase, lowercase, propercase
},
"end": {
"video_duration": 5,
"existing_image": None,
"background_color": "#000000",
"background_image": None,
"font": "Montserrat-Bold.ttf",
"artist_color": "#ffdf6b",
"artist_gradient": None,
"title_color": "#ffffff",
"title_gradient": None,
"title_region": None,
"artist_region": None,
"extra_text": "THANK YOU FOR SINGING!",
"extra_text_color": "#ff7acc",
"extra_text_gradient": None,
"extra_text_region": None,
"title_text_transform": None, # none, uppercase, lowercase, propercase
"artist_text_transform": None, # none, uppercase, lowercase, propercase
},
}
# Set up title format from style params
self.title_format = {
"background_color": style_params["intro"]["background_color"],
"background_image": style_params["intro"]["background_image"],
"font": style_params["intro"]["font"],
"artist_color": style_params["intro"]["artist_color"],
"artist_gradient": style_params["intro"]["artist_gradient"],
"title_color": style_params["intro"]["title_color"],
"title_gradient": style_params["intro"]["title_gradient"],
"extra_text": style_params["intro"]["extra_text"],
"extra_text_color": style_params["intro"]["extra_text_color"],
"extra_text_gradient": style_params["intro"]["extra_text_gradient"],
"extra_text_region": style_params["intro"]["extra_text_region"],
"title_region": style_params["intro"]["title_region"],
"artist_region": style_params["intro"]["artist_region"],
"title_text_transform": style_params["intro"]["title_text_transform"],
"artist_text_transform": style_params["intro"]["artist_text_transform"],
}
# Set up end format from style params
self.end_format = {
"background_color": style_params["end"]["background_color"],
"background_image": style_params["end"]["background_image"],
"font": style_params["end"]["font"],
"artist_color": style_params["end"]["artist_color"],
"artist_gradient": style_params["end"]["artist_gradient"],
"title_color": style_params["end"]["title_color"],
"title_gradient": style_params["end"]["title_gradient"],
"extra_text": style_params["end"]["extra_text"],
"extra_text_color": style_params["end"]["extra_text_color"],
"extra_text_gradient": style_params["end"]["extra_text_gradient"],
"extra_text_region": style_params["end"]["extra_text_region"],
"title_region": style_params["end"]["title_region"],
"artist_region": style_params["end"]["artist_region"],
"title_text_transform": style_params["end"]["title_text_transform"],
"artist_text_transform": style_params["end"]["artist_text_transform"],
}
# Store video durations and existing images
self.intro_video_duration = style_params["intro"]["video_duration"]
self.end_video_duration = style_params["end"]["video_duration"]
self.existing_title_image = style_params["intro"]["existing_image"]
self.existing_end_image = style_params["end"]["existing_image"]
# Path to the Windows PyInstaller frozen bundled ffmpeg.exe, or the system-installed FFmpeg binary on Mac/Linux
ffmpeg_path = os.path.join(sys._MEIPASS, "ffmpeg.exe") if getattr(sys, "frozen", False) else "ffmpeg"
@@ -123,40 +201,12 @@ class KaraokePrep:
else:
self.ffmpeg_base_command += " -loglevel fatal"
self.title_format = {
"background_color": intro_background_color,
"background_image": intro_background_image,
"font": intro_font,
"artist_color": intro_artist_color,
"title_color": intro_title_color,
"extra_text": intro_extra_text,
"extra_text_color": intro_extra_text_color,
"extra_text_region": self.parse_region(intro_extra_text_region) or (370, 1200, 3100, 480),
"title_region": self.parse_region(intro_title_region) or (370, 200, 3100, 480),
"artist_region": self.parse_region(intro_artist_region) or (370, 700, 3100, 480),
}
self.logger.debug(f"Initialized title_format with extra_text: {self.title_format['extra_text']}")
self.logger.debug(f"Initialized title_format with extra_text_region: {self.title_format['extra_text_region']}")
self.end_format = {
"background_color": end_background_color,
"background_image": end_background_image,
"font": end_font,
"artist_color": end_artist_color,
"title_color": end_title_color,
"extra_text": end_extra_text,
"extra_text_color": end_extra_text_color,
"extra_text_region": self.parse_region(end_extra_text_region) or (370, 300, 3100, 400),
"title_region": self.parse_region(end_title_region) or (370, 800, 3100, 400),
"artist_region": self.parse_region(end_artist_region) or (370, 1300, 3100, 400),
}
self.logger.debug(f"Initialized end_format with extra_text: {self.end_format['extra_text']}")
self.logger.debug(f"Initialized end_format with extra_text_region: {self.end_format['extra_text_region']}")
self.existing_end_image = existing_end_image
self.extracted_info = None
self.persistent_artist = None
@@ -260,6 +310,13 @@ class KaraokePrep:
self.logger.debug(f"Copying media from local path {input_media} to filename {output_filename_no_extension} + existing extension")
copied_file_name = output_filename_no_extension + os.path.splitext(input_media)[1]
self.logger.debug(f"Target filename: {copied_file_name}")
# Check if source and destination are the same
if os.path.abspath(input_media) == os.path.abspath(copied_file_name):
self.logger.info("Source and destination are the same file, skipping copy")
return input_media
self.logger.debug(f"Copying {input_media} to {copied_file_name}")
shutil.copy2(input_media, copied_file_name)
@@ -305,43 +362,6 @@ class KaraokePrep:
os.system(ffmpeg_command)
return output_filename
def write_lyrics_from_genius(self, artist, title, filename):
if self._file_exists(filename):
with open(filename, "r") as f:
return f.read().split("\n")
genius = lyricsgenius.Genius(access_token=os.environ["GENIUS_API_TOKEN"], verbose=False, remove_section_headers=True)
song = genius.search_song(title, artist)
if song:
lyrics = self.clean_genius_lyrics(song.lyrics)
if not self.dry_run:
with open(filename, "w") as f:
f.write(lyrics)
self.logger.info("Lyrics for %s by %s fetched successfully", title, artist)
return lyrics.split("\n")
else:
self.logger.warning("Could not find lyrics for %s by %s", title, artist)
return None
def clean_genius_lyrics(self, lyrics):
lyrics = lyrics.replace("\\n", "\n")
lyrics = re.sub(r"You might also like", "", lyrics)
lyrics = re.sub(
r".*?Lyrics([A-Z])", r"\1", lyrics
) # Remove the song name and word "Lyrics" if this has a non-newline char at the start
lyrics = re.sub(r"^[0-9]* Contributors.*Lyrics", "", lyrics) # Remove this example: 27 ContributorsSex Bomb Lyrics
lyrics = re.sub(
r"See.*Live.*Get tickets as low as \$[0-9]+", "", lyrics
) # Remove this example: See Tom Jones LiveGet tickets as low as $71
lyrics = re.sub(r"[0-9]+Embed$", "", lyrics) # Remove the word "Embed" at end of line with preceding numbers if found
lyrics = re.sub(r"(\S)Embed$", r"\1", lyrics) # Remove the word "Embed" if it has been tacked onto a word at the end of a line
lyrics = re.sub(r"^Embed$", r"", lyrics) # Remove the word "Embed" if it has been tacked onto a word at the end of a line
lyrics = re.sub(r".*?\[.*?\].*?", "", lyrics) # Remove lines containing square brackets
# add any additional cleaning rules here
return lyrics
def find_best_split_point(self, line):
"""
Find the best split point in a line based on the specified criteria.
@@ -423,54 +443,35 @@ class KaraokePrep:
return processed_lines
def transcribe_lyrics(self, input_audio_wav, track_output_dir):
self.logger.info(f"Transcribing lyrics from audio file: {input_audio_wav} with output directory: {track_output_dir}")
def transcribe_lyrics(self, input_audio_wav, artist, title, track_output_dir):
self.logger.info(
f"Transcribing lyrics for track {artist} - {title} from audio file: {input_audio_wav} with output directory: {track_output_dir}"
)
if os.environ.get("AUDIOSHAKE_API_TOKEN") is None:
self.logger.warning("Error: AUDIOSHAKE_API_TOKEN environment variable is not set, skipping transcription")
return
self.logger.debug("Loading LyricsTranscriber class")
# Create lyrics subdirectory
lyrics_dir = os.path.join(track_output_dir, "lyrics")
os.makedirs(lyrics_dir, exist_ok=True)
self.logger.info(f"Created lyrics directory: {lyrics_dir}")
transcriber = LyricsTranscriber(
input_audio_wav,
log_level=self.log_level,
log_formatter=self.log_formatter,
audioshake_api_token=os.environ["AUDIOSHAKE_API_TOKEN"],
output_dir=track_output_dir,
artist=self.artist,
title=self.title,
artist=artist,
title=title,
output_dir=lyrics_dir,
skip_transcription=self.skip_transcription,
)
transcriber_outputs = transcriber.generate()
self.logger.info(f"*** Outputs: ***")
self.logger.info(f"Transcription output data file: {transcriber_outputs['transcription_data_filepath']}")
self.logger.info(f"Transcribed lyrics text file: {transcriber_outputs['transcribed_lyrics_text_filepath']}")
self.logger.info(f"MidiCo LRC output file: {transcriber_outputs['midico_lrc_filepath']}")
if transcriber_outputs:
self.logger.info(f"*** Transcriber Filepath Outputs: ***")
for key, value in transcriber_outputs.items():
if key.endswith("_filepath"):
self.logger.info(f" {key}: {value}")
def write_processed_lyrics(self, lyrics_file, processed_lyrics_file):
if self._file_exists(processed_lyrics_file):
return processed_lyrics_file
self.logger.info(f"Processing lyrics from {lyrics_file} and writing to {processed_lyrics_file}")
if not self.dry_run:
processor = KaraokeLyricsProcessor(
log_level=self.log_level,
log_formatter=self.log_formatter,
input_filename=lyrics_file,
output_filename=processed_lyrics_file,
max_line_length=36, # Using the default max line length
)
processor.process()
processor.write_to_output_file()
self.logger.info(f"Lyrics processing complete, processed lyrics written to: {processed_lyrics_file}")
else:
self.logger.info(f"DRY RUN: Would process lyrics from {lyrics_file} and write to: {processed_lyrics_file}")
return processed_lyrics_file
return transcriber_outputs
def sanitize_filename(self, filename):
"""Replace or remove characters that are unsafe for filenames."""
@@ -555,16 +556,67 @@ class KaraokePrep:
return track_output_dir, artist_title
def _create_gradient_mask(self, size, gradient_config):
"""Create a gradient mask for text coloring.
Args:
size (tuple): (width, height) of the mask
gradient_config (dict): Configuration with keys:
- color1: First color (hex)
- color2: Second color (hex)
- direction: 'horizontal' or 'vertical'
- start: Start point of gradient transition (0-1)
- stop: Stop point of gradient transition (0-1)
"""
mask = Image.new("L", size)
draw = ImageDraw.Draw(mask)
width, height = size
start = gradient_config["start"]
stop = gradient_config["stop"]
if gradient_config["direction"] == "horizontal":
for x in range(width):
# Calculate position in gradient (0 to 1)
pos = x / width
# Calculate color intensity
if pos < start:
intensity = 0
elif pos > stop:
intensity = 255
else:
# Linear interpolation between start and stop
intensity = int(255 * (pos - start) / (stop - start))
draw.line([(x, 0), (x, height)], fill=intensity)
else: # vertical
for y in range(height):
pos = y / height
if pos < start:
intensity = 0
elif pos > stop:
intensity = 255
else:
intensity = int(255 * (pos - start) / (stop - start))
draw.line([(0, y), (width, y)], fill=intensity)
return mask
def calculate_text_size_to_fit(self, draw, text, font_path, region):
font_size = 500 # Start with a large font size
font = ImageFont.truetype(font_path, size=font_size) if os.path.exists(font_path) else ImageFont.load_default()
def get_text_size(text, font):
return draw.textbbox((0, 0), text, font=font)[2:]
bbox = draw.textbbox((0, 0), text, font=font)
# Use the actual text height without the font's internal padding
return bbox[2], bbox[3] - bbox[1]
text_width, text_height = get_text_size(text, font)
target_height = region[3] # Use full region height as target
while text_width > region[2] or text_height > region[3]:
while text_width > region[2] or text_height > target_height:
font_size -= 10
if font_size <= 150:
# Split the text into two lines
@@ -582,7 +634,11 @@ class KaraokePrep:
text_width2, text_height2 = get_text_size(line2, font)
total_height = text_height1 + text_height2
if max(text_width1, text_width2) <= region[2] and total_height <= region[3]:
# Add a small gap between lines (10% of line height)
line_gap = text_height1 * 0.1
total_height_with_gap = total_height + line_gap
if max(text_width1, text_width2) <= region[2] and total_height_with_gap <= target_height:
return font, (line1, line2)
font_size -= 10
@@ -595,14 +651,18 @@ class KaraokePrep:
return font, text
def _render_text_in_region(self, draw, text, font_path, region, color, font=None):
def _render_text_in_region(self, draw, text, font_path, region, color, gradient=None, font=None):
"""Helper method to render text within a specified region."""
self.logger.debug(f"Rendering text: '{text}' in region: {region} with color: {color}")
self.logger.debug(f"Rendering text: '{text}' in region: {region} with color: {color} gradient: {gradient}")
if text is None:
self.logger.debug("Text is None, skipping rendering")
return region
if region is None:
self.logger.debug("Region is None, skipping rendering")
return region
if font is None:
font, text_lines = self.calculate_text_size_to_fit(draw, text, font_path, region)
else:
@@ -612,32 +672,81 @@ class KaraokePrep:
x, y, width, height = region
# Get font metrics
ascent, descent = font.getmetrics()
font_height = ascent + descent
def render_text_with_gradient(text, position, bbox):
# Convert position coordinates to integers
position = (int(position[0]), int(position[1]))
if gradient is None:
draw.text(position, text, fill=color, font=font)
else:
# Create a temporary image for this text
text_layer = Image.new("RGBA", (bbox[2], bbox[3]), (0, 0, 0, 0))
text_draw = ImageDraw.Draw(text_layer)
# Draw text in first color
text_draw.text((0, 0), text, fill=gradient["color1"], font=font)
# Create and apply gradient mask
mask = self._create_gradient_mask((bbox[2], bbox[3]), gradient)
# Create second color layer
color2_layer = Image.new("RGBA", (bbox[2], bbox[3]), (0, 0, 0, 0))
color2_draw = ImageDraw.Draw(color2_layer)
color2_draw.text((0, 0), text, fill=gradient["color2"], font=font)
# Composite using gradient mask
text_layer.paste(color2_layer, mask=mask)
# Paste onto main image
draw._image.paste(text_layer, position, text_layer)
if isinstance(text_lines, tuple): # Two lines
line1, line2 = text_lines
bbox1 = draw.textbbox((0, 0), line1, font=font)
bbox2 = draw.textbbox((0, 0), line2, font=font)
total_height = bbox1[3] + bbox2[3]
y_offset = (height - total_height) // 2
# Calculate line heights using bounding boxes
line1_height = bbox1[3] - bbox1[1]
line2_height = bbox2[3] - bbox2[1]
# Use a small gap between lines (20% of average line height)
line_gap = int((line1_height + line2_height) * 0.1)
# Calculate total height needed
total_height = line1_height + line_gap + line2_height
# Center the entire text block vertically in the region
y_start = y + (height - total_height) // 2
# Draw first line
draw.text((x + (width - bbox1[2]) // 2, y + y_offset), line1, fill=color, font=font)
pos1 = (x + (width - bbox1[2]) // 2, y_start)
render_text_with_gradient(line1, pos1, bbox1)
# Draw second line
draw.text((x + (width - bbox2[2]) // 2, y + y_offset + bbox1[3]), line2, fill=color, font=font)
pos2 = (x + (width - bbox2[2]) // 2, y_start + line1_height + line_gap)
render_text_with_gradient(line2, pos2, bbox2)
else:
# Single line
bbox = draw.textbbox((0, 0), text_lines, font=font)
position = (
x + (width - bbox[2]) // 2,
y + (height - bbox[3]) // 2,
)
draw.text(position, text_lines, fill=color, font=font)
# Center text vertically using font metrics
y_pos = y + (height - font_height) // 2
position = (x + (width - bbox[2]) // 2, y_pos)
render_text_with_gradient(text_lines, position, bbox)
return region
def _draw_bounding_box(self, draw, region, color):
"""Helper method to draw a bounding box around a region."""
if region is None:
self.logger.debug("Region is None, skipping drawing bounding box")
return
x, y, width, height = region
draw.rectangle([x, y, x + width, y + height], outline=color, width=2)
@@ -727,19 +836,28 @@ class KaraokePrep:
def _render_all_text(self, draw, font_path, title_text, artist_text, format, render_bounding_boxes):
"""Render all text elements on the image."""
# Render title
region = self._render_text_in_region(draw, title_text.upper(), font_path, format["title_region"], format["title_color"])
if render_bounding_boxes:
self._draw_bounding_box(draw, region, format["title_color"])
if format["title_region"]:
region_parsed = self.parse_region(format["title_region"])
region = self._render_text_in_region(
draw, title_text, font_path, region_parsed, format["title_color"], gradient=format.get("title_gradient")
)
if render_bounding_boxes:
self._draw_bounding_box(draw, region, format["title_color"])
# Render artist
region = self._render_text_in_region(draw, artist_text.upper(), font_path, format["artist_region"], format["artist_color"])
if render_bounding_boxes:
self._draw_bounding_box(draw, region, format["artist_color"])
if format["artist_region"]:
region_parsed = self.parse_region(format["artist_region"])
region = self._render_text_in_region(
draw, artist_text, font_path, region_parsed, format["artist_color"], gradient=format.get("artist_gradient")
)
if render_bounding_boxes:
self._draw_bounding_box(draw, region, format["artist_color"])
# Render extra text if provided
if format["extra_text"]:
region_parsed = self.parse_region(format["extra_text_region"])
region = self._render_text_in_region(
draw, format["extra_text"], font_path, format["extra_text_region"], format["extra_text_color"]
draw, format["extra_text"], font_path, region_parsed, format["extra_text_color"], gradient=format.get("extra_text_gradient")
)
if render_bounding_boxes:
self._draw_bounding_box(draw, region, format["extra_text_color"])
@@ -772,9 +890,19 @@ class KaraokePrep:
self.logger.debug(f"Running command: {ffmpeg_command}")
os.system(ffmpeg_command)
def _transform_text(self, text, transform_type):
"""Helper method to transform text based on specified type."""
if transform_type == "uppercase":
return text.upper()
elif transform_type == "lowercase":
return text.lower()
elif transform_type == "propercase":
return text.title()
return text # "none" or any other value returns original text
def create_title_video(self, artist, title, format, output_image_filepath_noext, output_video_filepath):
title_text = title.upper()
artist_text = artist.upper()
title_text = self._transform_text(title, format["title_text_transform"])
artist_text = self._transform_text(artist, format["artist_text_transform"])
self.create_video(
title_text=title_text,
artist_text=artist_text,
@@ -790,8 +918,8 @@ class KaraokePrep:
)
def create_end_video(self, artist, title, format, output_image_filepath_noext, output_video_filepath):
title_text = title.upper()
artist_text = artist.upper()
title_text = self._transform_text(title, format["title_text_transform"])
artist_text = self._transform_text(artist, format["artist_text_transform"])
self.create_video(
title_text=title_text,
artist_text=artist_text,
@@ -826,6 +954,9 @@ class KaraokePrep:
stems_dir = self._create_stems_directory(track_output_dir)
result = {"clean_instrumental": {}, "other_stems": {}, "backing_vocals": {}, "combined_instrumentals": {}}
if os.environ.get("KARAOKE_PREP_SKIP_AUDIO_SEPARATION"):
return result
result["clean_instrumental"] = self._separate_clean_instrumental(separator, audio_file, artist_title, track_output_dir, stems_dir)
result["other_stems"] = self._separate_other_stems(separator, audio_file, artist_title, stems_dir)
result["backing_vocals"] = self._separate_backing_vocals(separator, result["clean_instrumental"]["vocals"], artist_title, stems_dir)
@@ -1087,30 +1218,21 @@ class KaraokePrep:
processed_track["lyrics"] = None
processed_track["processed_lyrics"] = None
else:
processed_track["lyrics"] = os.path.join(track_output_dir, f"{artist_title} (Lyrics).txt")
if os.path.exists(processed_track["lyrics"]):
self.logger.debug(f"Lyrics file already exists, skipping fetch: {processed_track['lyrics']}")
else:
self.logger.info("Fetching lyrics from Genius...")
lyrics_artist = self.lyrics_artist or self.artist
lyrics_title = self.lyrics_title or self.title
self.lyrics = self.write_lyrics_from_genius(lyrics_artist, lyrics_title, processed_track["lyrics"])
lyrics_artist = self.lyrics_artist or self.artist
lyrics_title = self.lyrics_title or self.title
processed_track["processed_lyrics"] = os.path.join(track_output_dir, f"{artist_title} (Lyrics Processed).txt")
if self.lyrics is None:
processed_track["lyrics"] = None
processed_track["processed_lyrics"] = None
else:
self.write_processed_lyrics(processed_track["lyrics"], processed_track["processed_lyrics"])
transcriber_outputs = self.transcribe_lyrics(processed_track["input_audio_wav"], lyrics_artist, lyrics_title, track_output_dir)
self.transcribe_lyrics(processed_track["input_audio_wav"], track_output_dir)
if transcriber_outputs:
self.lyrics = transcriber_outputs.get("corrected_lyrics_text")
processed_track["lyrics"] = transcriber_outputs.get("corrected_lyrics_text_filepath")
output_image_filepath_noext = os.path.join(track_output_dir, f"{artist_title} (Title)")
processed_track["title_image_png"] = f"{output_image_filepath_noext}.png"
processed_track["title_image_jpg"] = f"{output_image_filepath_noext}.jpg"
processed_track["title_video"] = os.path.join(track_output_dir, f"{artist_title} (Title).mov")
if not self._file_exists(processed_track["title_video"]):
if not self._file_exists(processed_track["title_video"]) and not os.environ.get("KARAOKE_PREP_SKIP_TITLE_END_SCREENS"):
self.logger.info(f"Creating title video...")
self.create_title_video(self.artist, self.title, self.title_format, output_image_filepath_noext, processed_track["title_video"])
@@ -1119,7 +1241,7 @@ class KaraokePrep:
processed_track["end_image_jpg"] = f"{output_image_filepath_noext}.jpg"
processed_track["end_video"] = os.path.join(track_output_dir, f"{artist_title} (End).mov")
if not self._file_exists(processed_track["end_video"]):
if not self._file_exists(processed_track["end_video"]) and not os.environ.get("KARAOKE_PREP_SKIP_TITLE_END_SCREENS"):
self.logger.info(f"Creating end screen video...")
self.create_end_video(self.artist, self.title, self.end_format, output_image_filepath_noext, processed_track["end_video"])
Binary file not shown.
Binary file not shown.
+8 -7
View File
@@ -121,9 +121,9 @@ def main():
)
parser.add_argument(
"--cdg_styles_json",
"--style_params_json",
default=None,
help="Optional: Path to JSON file containing CDG style configuration. Required if --enable_cdg is used. Example: --cdg_styles_json='/path/to/cdg_styles.json'",
help="Optional: Path to JSON file containing CDG style configuration. Required if --enable_cdg is used. Example: --style_params_json='/path/to/cdg_styles.json'",
)
args = parser.parse_args()
@@ -136,14 +136,15 @@ def main():
# Load CDG styles if CDG generation is enabled
cdg_styles = None
if args.enable_cdg:
if not args.cdg_styles_json:
logger.error("CDG styles JSON file path (--cdg_styles_json) is required when --enable_cdg is used")
if not args.style_params_json:
logger.error("CDG styles JSON file path (--style_params_json) is required when --enable_cdg is used")
sys.exit(1)
try:
with open(args.cdg_styles_json, "r") as f:
cdg_styles = json.loads(f.read())
with open(args.style_params_json, "r") as f:
style_params = json.loads(f.read())
cdg_styles = style_params["cdg"]
except FileNotFoundError:
logger.error(f"CDG styles configuration file not found: {args.cdg_styles_json}")
logger.error(f"CDG styles configuration file not found: {args.style_params_json}")
sys.exit(1)
except json.JSONDecodeError as e:
logger.error(f"Invalid JSON in CDG styles configuration file: {e}")
+122 -223
View File
@@ -4,6 +4,8 @@ import logging
import pkg_resources
import tempfile
import os
import json
import sys
from karaoke_prep import KaraokePrep
@@ -29,6 +31,7 @@ def main():
formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, max_help_position=54),
)
# Basic information
parser.add_argument(
"args",
nargs="*",
@@ -38,36 +41,68 @@ def main():
package_version = pkg_resources.get_distribution("karaoke-prep").version
parser.add_argument("-v", "--version", action="version", version=f"%(prog)s {package_version}")
# Logging & Debugging
parser.add_argument(
"--log_level",
default="info",
help="Optional: logging level, e.g. info, debug, warning (default: %(default)s). Example: --log_level=debug",
)
parser.add_argument(
"--filename_pattern",
help="Required if processing a folder: Python regex pattern to extract track names from filenames. Must contain a named group 'title'. Example: --filename_pattern='(?P<index>\\d+) - (?P<title>.+).mp3'",
)
parser.add_argument(
"--dry_run",
action="store_true",
help="Optional: perform a dry run without making any changes (default: %(default)s). Example: --dry_run=true",
)
parser.add_argument(
"--render_bounding_boxes",
action="store_true",
help="Optional: render bounding boxes around text regions for debugging (default: %(default)s). Example: --render_bounding_boxes",
)
# Input/Output Configuration
parser.add_argument(
"--filename_pattern",
help="Required if processing a folder: Python regex pattern to extract track names from filenames. Must contain a named group 'title'. Example: --filename_pattern='(?P<index>\\d+) - (?P<title>.+).mp3'",
)
parser.add_argument(
"--output_dir",
default=".",
help="Optional: directory to write output files (default: <current dir>). Example: --output_dir=/app/karaoke",
)
parser.add_argument(
"--no_track_subfolders",
action="store_false",
help="Optional: do NOT create a named subfolder for each track. Example: --no_track_subfolders",
)
parser.add_argument(
"--lossless_output_format",
default="FLAC",
help="Optional: lossless output format for separated audio (default: FLAC). Example: --lossless_output_format=WAV",
)
parser.add_argument(
"--output_png",
type=lambda x: (str(x).lower() == "true"),
default=True,
help="Optional: output PNG format for title and end images (default: %(default)s). Example: --output_png=False",
)
parser.add_argument(
"--output_jpg",
type=lambda x: (str(x).lower() == "true"),
default=True,
help="Optional: output JPG format for title and end images (default: %(default)s). Example: --output_jpg=False",
)
# Audio Processing Configuration
parser.add_argument(
"--clean_instrumental_model",
default="model_bs_roformer_ep_317_sdr_12.9755.ckpt",
help="Optional: Model for clean instrumental separation (default: %(default)s).",
)
parser.add_argument(
"--backing_vocals_models",
nargs="+",
default=["mel_band_roformer_karaoke_aufr33_viperx_sdr_10.1956.ckpt"],
help="Optional: List of models for backing vocals separation (default: %(default)s).",
)
parser.add_argument(
"--other_stems_models",
nargs="+",
@@ -87,38 +122,16 @@ def main():
default=default_model_dir,
help="Optional: model files directory (default: %(default)s). Example: --model_file_dir=/app/models",
)
parser.add_argument(
"--output_dir",
default=".",
help="Optional: directory to write output files (default: <current dir>). Example: --output_dir=/app/karaoke",
"--existing_instrumental",
help="Optional: Path to an existing instrumental audio file. If provided, audio separation will be skipped.",
)
parser.add_argument(
"--lossless_output_format",
default="FLAC",
help="Optional: lossless output format for separated audio (default: FLAC). Example: --lossless_output_format=WAV",
)
parser.add_argument(
"--use_cuda",
action="store_true",
help="Optional: use Nvidia GPU with CUDA for separation (default: %(default)s). Example: --use_cuda=true",
)
parser.add_argument(
"--use_coreml",
action="store_true",
help="Optional: use Apple Silicon GPU with CoreML for separation (default: %(default)s). Example: --use_coreml=true",
)
parser.add_argument(
"--denoise",
type=lambda x: (str(x).lower() == "true"),
default=True,
help="Optional: enable or disable denoising during separation (default: %(default)s). Example: --denoise=False",
)
parser.add_argument(
"--normalize",
type=lambda x: (str(x).lower() == "true"),
@@ -126,186 +139,42 @@ def main():
help="Optional: enable or disable normalization during separation (default: %(default)s). Example: --normalize=False",
)
# Hardware Acceleration
parser.add_argument(
"--no_track_subfolders",
action="store_false",
help="Optional: do NOT create a named subfolder for each track. Example: --no_track_subfolders",
"--use_cuda",
action="store_true",
help="Optional: use Nvidia GPU with CUDA for separation (default: %(default)s). Example: --use_cuda=true",
)
parser.add_argument(
"--intro_background_color",
default="#000000",
help="Optional: Background color for intro video (default: black). Example: --intro_background_color=#123456",
)
parser.add_argument(
"--intro_background_image",
help="Optional: Path to background image for intro video. Overrides background color if provided. Example: --intro_background_image=path/to/image.jpg",
)
parser.add_argument(
"--intro_font",
default="Montserrat-Bold.ttf",
help="Optional: Font file for intro video (default: Montserrat-Bold.ttf). Example: --intro_font=AvenirNext-Bold.ttf",
)
parser.add_argument(
"--intro_artist_color",
default="#ffdf6b",
help="Optional: Font color for intro video artist text (default: #ffdf6b). Example: --intro_artist_color=#123456",
)
parser.add_argument(
"--intro_title_color",
default="#ffffff",
help="Optional: Font color for intro video title text (default: #ffffff). Example: --intro_title_color=#123456",
)
parser.add_argument(
"--existing_instrumental",
help="Optional: Path to an existing instrumental audio file. If provided, audio separation will be skipped.",
)
parser.add_argument(
"--existing_title_image",
help="Optional: Path to an existing title image file. If provided, title image generation will be skipped.",
)
parser.add_argument(
"--end_background_color",
default="#000000",
help="Optional: Background color for end screen video (default: black). Example: --end_background_color=#123456",
)
parser.add_argument(
"--end_background_image",
help="Optional: Path to background image for end screen video. Overrides background color if provided. Example: --end_background_image=path/to/image.jpg",
)
parser.add_argument(
"--end_extra_text",
default="THANK YOU FOR SINGING!",
help="Optional: Extra text to display on the end screen video. Example: --end_extra_text='THANK YOU FOR WATCHING!'",
)
parser.add_argument(
"--end_font",
default="Montserrat-Bold.ttf",
help="Optional: Font file for end screen video (default: Montserrat-Bold.ttf). Example: --end_font=AvenirNext-Bold.ttf",
)
parser.add_argument(
"--end_extra_text_color",
default="#ff7acc",
help="Optional: Font color for end screen video text (default: #ffffff). Example: --end_extra_text_color=#123456",
)
parser.add_argument(
"--end_artist_color",
default="#ffdf6b",
help="Optional: Font color for end screen video artist text (default: #ffdf6b). Example: --end_artist_color=#123456",
)
parser.add_argument(
"--end_title_color",
default="#ffffff",
help="Optional: Font color for end screen video title text (default: #ffffff). Example: --end_title_color=#123456",
)
parser.add_argument(
"--existing_end_image",
help="Optional: Path to an existing end screen image file. If provided, end screen image generation will be skipped.",
)
parser.add_argument(
"--intro_video_duration",
type=int,
default=5,
help="Optional: duration of the title video in seconds (default: 5). Example: --intro_video_duration=10",
)
parser.add_argument(
"--end_video_duration",
type=int,
default=5,
help="Optional: duration of the end video in seconds (default: 5). Example: --end_video_duration=10",
"--use_coreml",
action="store_true",
help="Optional: use Apple Silicon GPU with CoreML for separation (default: %(default)s). Example: --use_coreml=true",
)
# Lyrics Configuration
parser.add_argument(
"--lyrics_artist",
help="Optional: Override the artist name used for lyrics search. Example: --lyrics_artist='The Beatles'",
)
parser.add_argument(
"--lyrics_title",
help="Optional: Override the song title used for lyrics search. Example: --lyrics_title='Hey Jude'",
)
parser.add_argument(
"--skip_lyrics",
action="store_true",
help="Optional: Skip fetching and processing lyrics. Example: --skip_lyrics",
)
parser.add_argument(
"--render_bounding_boxes",
"--skip_transcription",
action="store_true",
help="Optional: render bounding boxes around text regions for debugging (default: %(default)s). Example: --render_bounding_boxes",
help="Optional: Skip audio transcription but still attempt to fetch lyrics from Spotify/Genius. Example: --skip_transcription",
)
# Style Configuration
parser.add_argument(
"--output_png",
type=lambda x: (str(x).lower() == "true"),
default=True,
help="Optional: output PNG format for title and end images (default: %(default)s). Example: --output_png=False",
)
parser.add_argument(
"--output_jpg",
type=lambda x: (str(x).lower() == "true"),
default=True,
help="Optional: output JPG format for title and end images (default: %(default)s). Example: --output_jpg=False",
)
parser.add_argument(
"--intro_extra_text",
help="Optional: Extra text to display on the intro video. Example: --intro_extra_text='GET READY TO SING!'",
)
parser.add_argument(
"--intro_extra_text_color",
default="#ffffff",
help="Optional: Font color for intro video extra text (default: #ffffff). Example: --intro_extra_text_color=#123456",
)
parser.add_argument(
"--intro_extra_text_region",
help="Optional: Region for extra text in intro video (x, y, width, height; default: 370,1950,3100,480). Example: --intro_extra_text_region=370,1950,3100,480",
)
parser.add_argument(
"--end_extra_text_region",
help="Optional: Region for extra text in end video (x, y, width, height; default: 370,1950,3100,480). Example: --end_extra_text_region=370,1950,3100,480",
)
parser.add_argument(
"--intro_title_region",
help="Optional: Region for title text in intro video (x, y, width, height; default: 370,470,3100,480). Example: --intro_title_region=370,470,3100,480",
)
parser.add_argument(
"--intro_artist_region",
help="Optional: Region for artist text in intro video (x, y, width, height; default: 370,1210,3100,480). Example: --intro_artist_region=370,1210,3100,480",
)
parser.add_argument(
"--end_title_region",
help="Optional: Region for title text in end video (x, y, width, height; default: 370,470,3100,480). Example: --end_title_region=370,470,3100,480",
)
parser.add_argument(
"--end_artist_region",
help="Optional: Region for artist text in end video (x, y, width, height; default: 370,1210,3100,480). Example: --end_artist_region=370,1210,3100,480",
"--style_params_json",
help="Optional: Path to JSON file containing style configuration for intro/end videos. Example: --style_params_json='/path/to/style_params.json'",
)
args = parser.parse_args()
@@ -354,6 +223,51 @@ def main():
log_level = getattr(logging, args.log_level.upper())
logger.setLevel(log_level)
# Load style parameters if JSON file is provided
style_params = None
if args.style_params_json:
try:
with open(args.style_params_json, "r") as f:
style_params = json.loads(f.read())
except FileNotFoundError:
logger.error(f"Style parameters configuration file not found: {args.style_params_json}")
sys.exit(1)
except json.JSONDecodeError as e:
logger.error(f"Invalid JSON in style parameters configuration file: {e}")
sys.exit(1)
else:
# Use default values
style_params = {
"intro": {
"video_duration": 5,
"existing_image": None,
"background_color": "#000000",
"background_image": None,
"font": "Montserrat-Bold.ttf",
"artist_color": "#ffdf6b",
"title_color": "#ffffff",
"title_region": "370, 200, 3100, 480",
"artist_region": "370, 700, 3100, 480",
"extra_text": None,
"extra_text_color": "#ffffff",
"extra_text_region": "370, 1200, 3100, 480",
},
"end": {
"video_duration": 5,
"existing_image": None,
"background_color": "#000000",
"background_image": None,
"font": "Montserrat-Bold.ttf",
"artist_color": "#ffdf6b",
"title_color": "#ffffff",
"title_region": None,
"artist_region": None,
"extra_text": "THANK YOU FOR SINGING!",
"extra_text_color": "#ff7acc",
"extra_text_region": None,
},
}
if args.existing_instrumental:
args.clean_instrumental_model = None
args.backing_vocals_models = []
@@ -362,55 +276,40 @@ def main():
logger.info(f"KaraokePrep beginning with input_media: {input_media} artist: {artist} and title: {title}")
kprep = KaraokePrep(
# Basic inputs
artist=artist,
title=title,
input_media=input_media,
filename_pattern=filename_pattern,
# Logging & Debugging
dry_run=args.dry_run,
log_formatter=log_formatter,
log_level=log_level,
render_bounding_boxes=args.render_bounding_boxes,
# Input/Output Configuration
filename_pattern=filename_pattern,
output_dir=args.output_dir,
create_track_subfolders=args.no_track_subfolders,
lossless_output_format=args.lossless_output_format,
output_png=args.output_png,
output_jpg=args.output_jpg,
# Audio Processing Configuration
existing_instrumental=args.existing_instrumental,
clean_instrumental_model=args.clean_instrumental_model,
backing_vocals_models=args.backing_vocals_models,
other_stems_models=args.other_stems_models,
model_file_dir=args.model_file_dir,
output_dir=args.output_dir,
lossless_output_format=args.lossless_output_format,
denoise_enabled=args.denoise,
normalization_enabled=args.normalize,
# Hardware Acceleration
use_cuda=args.use_cuda,
use_coreml=args.use_coreml,
normalization_enabled=args.normalize,
denoise_enabled=args.denoise,
create_track_subfolders=args.no_track_subfolders,
existing_instrumental=args.existing_instrumental,
existing_title_image=args.existing_title_image,
existing_end_image=args.existing_end_image,
intro_video_duration=args.intro_video_duration,
intro_background_color=args.intro_background_color,
intro_background_image=args.intro_background_image,
intro_font=args.intro_font,
intro_artist_color=args.intro_artist_color,
intro_title_color=args.intro_title_color,
intro_title_region=args.intro_title_region,
intro_artist_region=args.intro_artist_region,
end_video_duration=args.end_video_duration,
end_background_color=args.end_background_color,
end_background_image=args.end_background_image,
end_font=args.end_font,
end_extra_text_color=args.end_extra_text_color,
end_artist_color=args.end_artist_color,
end_title_color=args.end_title_color,
end_title_region=args.end_title_region,
end_artist_region=args.end_artist_region,
# Lyrics Configuration
lyrics_artist=args.lyrics_artist,
lyrics_title=args.lyrics_title,
skip_lyrics=args.skip_lyrics,
render_bounding_boxes=args.render_bounding_boxes,
output_png=args.output_png,
output_jpg=args.output_jpg,
intro_extra_text=args.intro_extra_text,
intro_extra_text_color=args.intro_extra_text_color,
intro_extra_text_region=args.intro_extra_text_region,
end_extra_text=args.end_extra_text,
end_extra_text_region=args.end_extra_text_region,
skip_transcription=args.skip_transcription,
# Style Configuration
style_params=style_params,
)
tracks = kprep.process()
Generated
+101 -113
View File
@@ -1,4 +1,4 @@
# This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand.
# This file is automatically @generated by Poetry 1.8.5 and should not be changed by hand.
[[package]]
name = "absl-py"
@@ -422,116 +422,103 @@ pycparser = "*"
[[package]]
name = "charset-normalizer"
version = "3.4.0"
version = "3.4.1"
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
optional = false
python-versions = ">=3.7.0"
python-versions = ">=3.7"
files = [
{file = "charset_normalizer-3.4.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:4f9fc98dad6c2eaa32fc3af1417d95b5e3d08aff968df0cd320066def971f9a6"},
{file = "charset_normalizer-3.4.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0de7b687289d3c1b3e8660d0741874abe7888100efe14bd0f9fd7141bcbda92b"},
{file = "charset_normalizer-3.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5ed2e36c3e9b4f21dd9422f6893dec0abf2cca553af509b10cd630f878d3eb99"},
{file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:40d3ff7fc90b98c637bda91c89d51264a3dcf210cade3a2c6f838c7268d7a4ca"},
{file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1110e22af8ca26b90bd6364fe4c763329b0ebf1ee213ba32b68c73de5752323d"},
{file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:86f4e8cca779080f66ff4f191a685ced73d2f72d50216f7112185dc02b90b9b7"},
{file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7f683ddc7eedd742e2889d2bfb96d69573fde1d92fcb811979cdb7165bb9c7d3"},
{file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:27623ba66c183eca01bf9ff833875b459cad267aeeb044477fedac35e19ba907"},
{file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:f606a1881d2663630ea5b8ce2efe2111740df4b687bd78b34a8131baa007f79b"},
{file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:0b309d1747110feb25d7ed6b01afdec269c647d382c857ef4663bbe6ad95a912"},
{file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:136815f06a3ae311fae551c3df1f998a1ebd01ddd424aa5603a4336997629e95"},
{file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:14215b71a762336254351b00ec720a8e85cada43b987da5a042e4ce3e82bd68e"},
{file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:79983512b108e4a164b9c8d34de3992f76d48cadc9554c9e60b43f308988aabe"},
{file = "charset_normalizer-3.4.0-cp310-cp310-win32.whl", hash = "sha256:c94057af19bc953643a33581844649a7fdab902624d2eb739738a30e2b3e60fc"},
{file = "charset_normalizer-3.4.0-cp310-cp310-win_amd64.whl", hash = "sha256:55f56e2ebd4e3bc50442fbc0888c9d8c94e4e06a933804e2af3e89e2f9c1c749"},
{file = "charset_normalizer-3.4.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:0d99dd8ff461990f12d6e42c7347fd9ab2532fb70e9621ba520f9e8637161d7c"},
{file = "charset_normalizer-3.4.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c57516e58fd17d03ebe67e181a4e4e2ccab1168f8c2976c6a334d4f819fe5944"},
{file = "charset_normalizer-3.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:6dba5d19c4dfab08e58d5b36304b3f92f3bd5d42c1a3fa37b5ba5cdf6dfcbcee"},
{file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bf4475b82be41b07cc5e5ff94810e6a01f276e37c2d55571e3fe175e467a1a1c"},
{file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ce031db0408e487fd2775d745ce30a7cd2923667cf3b69d48d219f1d8f5ddeb6"},
{file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8ff4e7cdfdb1ab5698e675ca622e72d58a6fa2a8aa58195de0c0061288e6e3ea"},
{file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3710a9751938947e6327ea9f3ea6332a09bf0ba0c09cae9cb1f250bd1f1549bc"},
{file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:82357d85de703176b5587dbe6ade8ff67f9f69a41c0733cf2425378b49954de5"},
{file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:47334db71978b23ebcf3c0f9f5ee98b8d65992b65c9c4f2d34c2eaf5bcaf0594"},
{file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:8ce7fd6767a1cc5a92a639b391891bf1c268b03ec7e021c7d6d902285259685c"},
{file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:f1a2f519ae173b5b6a2c9d5fa3116ce16e48b3462c8b96dfdded11055e3d6365"},
{file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:63bc5c4ae26e4bc6be6469943b8253c0fd4e4186c43ad46e713ea61a0ba49129"},
{file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:bcb4f8ea87d03bc51ad04add8ceaf9b0f085ac045ab4d74e73bbc2dc033f0236"},
{file = "charset_normalizer-3.4.0-cp311-cp311-win32.whl", hash = "sha256:9ae4ef0b3f6b41bad6366fb0ea4fc1d7ed051528e113a60fa2a65a9abb5b1d99"},
{file = "charset_normalizer-3.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:cee4373f4d3ad28f1ab6290684d8e2ebdb9e7a1b74fdc39e4c211995f77bec27"},
{file = "charset_normalizer-3.4.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:0713f3adb9d03d49d365b70b84775d0a0d18e4ab08d12bc46baa6132ba78aaf6"},
{file = "charset_normalizer-3.4.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:de7376c29d95d6719048c194a9cf1a1b0393fbe8488a22008610b0361d834ecf"},
{file = "charset_normalizer-3.4.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4a51b48f42d9358460b78725283f04bddaf44a9358197b889657deba38f329db"},
{file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b295729485b06c1a0683af02a9e42d2caa9db04a373dc38a6a58cdd1e8abddf1"},
{file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ee803480535c44e7f5ad00788526da7d85525cfefaf8acf8ab9a310000be4b03"},
{file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3d59d125ffbd6d552765510e3f31ed75ebac2c7470c7274195b9161a32350284"},
{file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8cda06946eac330cbe6598f77bb54e690b4ca93f593dee1568ad22b04f347c15"},
{file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07afec21bbbbf8a5cc3651aa96b980afe2526e7f048fdfb7f1014d84acc8b6d8"},
{file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6b40e8d38afe634559e398cc32b1472f376a4099c75fe6299ae607e404c033b2"},
{file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:b8dcd239c743aa2f9c22ce674a145e0a25cb1566c495928440a181ca1ccf6719"},
{file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:84450ba661fb96e9fd67629b93d2941c871ca86fc38d835d19d4225ff946a631"},
{file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:44aeb140295a2f0659e113b31cfe92c9061622cadbc9e2a2f7b8ef6b1e29ef4b"},
{file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1db4e7fefefd0f548d73e2e2e041f9df5c59e178b4c72fbac4cc6f535cfb1565"},
{file = "charset_normalizer-3.4.0-cp312-cp312-win32.whl", hash = "sha256:5726cf76c982532c1863fb64d8c6dd0e4c90b6ece9feb06c9f202417a31f7dd7"},
{file = "charset_normalizer-3.4.0-cp312-cp312-win_amd64.whl", hash = "sha256:b197e7094f232959f8f20541ead1d9862ac5ebea1d58e9849c1bf979255dfac9"},
{file = "charset_normalizer-3.4.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:dd4eda173a9fcccb5f2e2bd2a9f423d180194b1bf17cf59e3269899235b2a114"},
{file = "charset_normalizer-3.4.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e9e3c4c9e1ed40ea53acf11e2a386383c3304212c965773704e4603d589343ed"},
{file = "charset_normalizer-3.4.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:92a7e36b000bf022ef3dbb9c46bfe2d52c047d5e3f3343f43204263c5addc250"},
{file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:54b6a92d009cbe2fb11054ba694bc9e284dad30a26757b1e372a1fdddaf21920"},
{file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ffd9493de4c922f2a38c2bf62b831dcec90ac673ed1ca182fe11b4d8e9f2a64"},
{file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:35c404d74c2926d0287fbd63ed5d27eb911eb9e4a3bb2c6d294f3cfd4a9e0c23"},
{file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4796efc4faf6b53a18e3d46343535caed491776a22af773f366534056c4e1fbc"},
{file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e7fdd52961feb4c96507aa649550ec2a0d527c086d284749b2f582f2d40a2e0d"},
{file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:92db3c28b5b2a273346bebb24857fda45601aef6ae1c011c0a997106581e8a88"},
{file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:ab973df98fc99ab39080bfb0eb3a925181454d7c3ac8a1e695fddfae696d9e90"},
{file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:4b67fdab07fdd3c10bb21edab3cbfe8cf5696f453afce75d815d9d7223fbe88b"},
{file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:aa41e526a5d4a9dfcfbab0716c7e8a1b215abd3f3df5a45cf18a12721d31cb5d"},
{file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:ffc519621dce0c767e96b9c53f09c5d215578e10b02c285809f76509a3931482"},
{file = "charset_normalizer-3.4.0-cp313-cp313-win32.whl", hash = "sha256:f19c1585933c82098c2a520f8ec1227f20e339e33aca8fa6f956f6691b784e67"},
{file = "charset_normalizer-3.4.0-cp313-cp313-win_amd64.whl", hash = "sha256:707b82d19e65c9bd28b81dde95249b07bf9f5b90ebe1ef17d9b57473f8a64b7b"},
{file = "charset_normalizer-3.4.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:dbe03226baf438ac4fda9e2d0715022fd579cb641c4cf639fa40d53b2fe6f3e2"},
{file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dd9a8bd8900e65504a305bf8ae6fa9fbc66de94178c420791d0293702fce2df7"},
{file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b8831399554b92b72af5932cdbbd4ddc55c55f631bb13ff8fe4e6536a06c5c51"},
{file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a14969b8691f7998e74663b77b4c36c0337cb1df552da83d5c9004a93afdb574"},
{file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dcaf7c1524c0542ee2fc82cc8ec337f7a9f7edee2532421ab200d2b920fc97cf"},
{file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:425c5f215d0eecee9a56cdb703203dda90423247421bf0d67125add85d0c4455"},
{file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:d5b054862739d276e09928de37c79ddeec42a6e1bfc55863be96a36ba22926f6"},
{file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_i686.whl", hash = "sha256:f3e73a4255342d4eb26ef6df01e3962e73aa29baa3124a8e824c5d3364a65748"},
{file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_ppc64le.whl", hash = "sha256:2f6c34da58ea9c1a9515621f4d9ac379871a8f21168ba1b5e09d74250de5ad62"},
{file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_s390x.whl", hash = "sha256:f09cb5a7bbe1ecae6e87901a2eb23e0256bb524a79ccc53eb0b7629fbe7677c4"},
{file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:0099d79bdfcf5c1f0c2c72f91516702ebf8b0b8ddd8905f97a8aecf49712c621"},
{file = "charset_normalizer-3.4.0-cp37-cp37m-win32.whl", hash = "sha256:9c98230f5042f4945f957d006edccc2af1e03ed5e37ce7c373f00a5a4daa6149"},
{file = "charset_normalizer-3.4.0-cp37-cp37m-win_amd64.whl", hash = "sha256:62f60aebecfc7f4b82e3f639a7d1433a20ec32824db2199a11ad4f5e146ef5ee"},
{file = "charset_normalizer-3.4.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:af73657b7a68211996527dbfeffbb0864e043d270580c5aef06dc4b659a4b578"},
{file = "charset_normalizer-3.4.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:cab5d0b79d987c67f3b9e9c53f54a61360422a5a0bc075f43cab5621d530c3b6"},
{file = "charset_normalizer-3.4.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:9289fd5dddcf57bab41d044f1756550f9e7cf0c8e373b8cdf0ce8773dc4bd417"},
{file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6b493a043635eb376e50eedf7818f2f322eabbaa974e948bd8bdd29eb7ef2a51"},
{file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9fa2566ca27d67c86569e8c85297aaf413ffab85a8960500f12ea34ff98e4c41"},
{file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a8e538f46104c815be19c975572d74afb53f29650ea2025bbfaef359d2de2f7f"},
{file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6fd30dc99682dc2c603c2b315bded2799019cea829f8bf57dc6b61efde6611c8"},
{file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2006769bd1640bdf4d5641c69a3d63b71b81445473cac5ded39740a226fa88ab"},
{file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:dc15e99b2d8a656f8e666854404f1ba54765871104e50c8e9813af8a7db07f12"},
{file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:ab2e5bef076f5a235c3774b4f4028a680432cded7cad37bba0fd90d64b187d19"},
{file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:4ec9dd88a5b71abfc74e9df5ebe7921c35cbb3b641181a531ca65cdb5e8e4dea"},
{file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:43193c5cda5d612f247172016c4bb71251c784d7a4d9314677186a838ad34858"},
{file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:aa693779a8b50cd97570e5a0f343538a8dbd3e496fa5dcb87e29406ad0299654"},
{file = "charset_normalizer-3.4.0-cp38-cp38-win32.whl", hash = "sha256:7706f5850360ac01d80c89bcef1640683cc12ed87f42579dab6c5d3ed6888613"},
{file = "charset_normalizer-3.4.0-cp38-cp38-win_amd64.whl", hash = "sha256:c3e446d253bd88f6377260d07c895816ebf33ffffd56c1c792b13bff9c3e1ade"},
{file = "charset_normalizer-3.4.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:980b4f289d1d90ca5efcf07958d3eb38ed9c0b7676bf2831a54d4f66f9c27dfa"},
{file = "charset_normalizer-3.4.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:f28f891ccd15c514a0981f3b9db9aa23d62fe1a99997512b0491d2ed323d229a"},
{file = "charset_normalizer-3.4.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a8aacce6e2e1edcb6ac625fb0f8c3a9570ccc7bfba1f63419b3769ccf6a00ed0"},
{file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bd7af3717683bea4c87acd8c0d3d5b44d56120b26fd3f8a692bdd2d5260c620a"},
{file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5ff2ed8194587faf56555927b3aa10e6fb69d931e33953943bc4f837dfee2242"},
{file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e91f541a85298cf35433bf66f3fab2a4a2cff05c127eeca4af174f6d497f0d4b"},
{file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:309a7de0a0ff3040acaebb35ec45d18db4b28232f21998851cfa709eeff49d62"},
{file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:285e96d9d53422efc0d7a17c60e59f37fbf3dfa942073f666db4ac71e8d726d0"},
{file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:5d447056e2ca60382d460a604b6302d8db69476fd2015c81e7c35417cfabe4cd"},
{file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:20587d20f557fe189b7947d8e7ec5afa110ccf72a3128d61a2a387c3313f46be"},
{file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:130272c698667a982a5d0e626851ceff662565379baf0ff2cc58067b81d4f11d"},
{file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:ab22fbd9765e6954bc0bcff24c25ff71dcbfdb185fcdaca49e81bac68fe724d3"},
{file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:7782afc9b6b42200f7362858f9e73b1f8316afb276d316336c0ec3bd73312742"},
{file = "charset_normalizer-3.4.0-cp39-cp39-win32.whl", hash = "sha256:2de62e8801ddfff069cd5c504ce3bc9672b23266597d4e4f50eda28846c322f2"},
{file = "charset_normalizer-3.4.0-cp39-cp39-win_amd64.whl", hash = "sha256:95c3c157765b031331dd4db3c775e58deaee050a3042fcad72cbc4189d7c8dca"},
{file = "charset_normalizer-3.4.0-py3-none-any.whl", hash = "sha256:fe9f97feb71aa9896b81973a7bbada8c49501dc73e58a10fcef6663af95e5079"},
{file = "charset_normalizer-3.4.0.tar.gz", hash = "sha256:223217c3d4f82c3ac5e29032b3f1c2eb0fb591b72161f86d93f5719079dae93e"},
{file = "charset_normalizer-3.4.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:91b36a978b5ae0ee86c394f5a54d6ef44db1de0815eb43de826d41d21e4af3de"},
{file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7461baadb4dc00fd9e0acbe254e3d7d2112e7f92ced2adc96e54ef6501c5f176"},
{file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e218488cd232553829be0664c2292d3af2eeeb94b32bea483cf79ac6a694e037"},
{file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:80ed5e856eb7f30115aaf94e4a08114ccc8813e6ed1b5efa74f9f82e8509858f"},
{file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b010a7a4fd316c3c484d482922d13044979e78d1861f0e0650423144c616a46a"},
{file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4532bff1b8421fd0a320463030c7520f56a79c9024a4e88f01c537316019005a"},
{file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:d973f03c0cb71c5ed99037b870f2be986c3c05e63622c017ea9816881d2dd247"},
{file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:3a3bd0dcd373514dcec91c411ddb9632c0d7d92aed7093b8c3bbb6d69ca74408"},
{file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:d9c3cdf5390dcd29aa8056d13e8e99526cda0305acc038b96b30352aff5ff2bb"},
{file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:2bdfe3ac2e1bbe5b59a1a63721eb3b95fc9b6817ae4a46debbb4e11f6232428d"},
{file = "charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:eab677309cdb30d047996b36d34caeda1dc91149e4fdca0b1a039b3f79d9a807"},
{file = "charset_normalizer-3.4.1-cp310-cp310-win32.whl", hash = "sha256:c0429126cf75e16c4f0ad00ee0eae4242dc652290f940152ca8c75c3a4b6ee8f"},
{file = "charset_normalizer-3.4.1-cp310-cp310-win_amd64.whl", hash = "sha256:9f0b8b1c6d84c8034a44893aba5e767bf9c7a211e313a9605d9c617d7083829f"},
{file = "charset_normalizer-3.4.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:8bfa33f4f2672964266e940dd22a195989ba31669bd84629f05fab3ef4e2d125"},
{file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:28bf57629c75e810b6ae989f03c0828d64d6b26a5e205535585f96093e405ed1"},
{file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f08ff5e948271dc7e18a35641d2f11a4cd8dfd5634f55228b691e62b37125eb3"},
{file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:234ac59ea147c59ee4da87a0c0f098e9c8d169f4dc2a159ef720f1a61bbe27cd"},
{file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fd4ec41f914fa74ad1b8304bbc634b3de73d2a0889bd32076342a573e0779e00"},
{file = "charset_normalizer-3.4.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eea6ee1db730b3483adf394ea72f808b6e18cf3cb6454b4d86e04fa8c4327a12"},
{file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:c96836c97b1238e9c9e3fe90844c947d5afbf4f4c92762679acfe19927d81d77"},
{file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:4d86f7aff21ee58f26dcf5ae81a9addbd914115cdebcbb2217e4f0ed8982e146"},
{file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:09b5e6733cbd160dcc09589227187e242a30a49ca5cefa5a7edd3f9d19ed53fd"},
{file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:5777ee0881f9499ed0f71cc82cf873d9a0ca8af166dfa0af8ec4e675b7df48e6"},
{file = "charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:237bdbe6159cff53b4f24f397d43c6336c6b0b42affbe857970cefbb620911c8"},
{file = "charset_normalizer-3.4.1-cp311-cp311-win32.whl", hash = "sha256:8417cb1f36cc0bc7eaba8ccb0e04d55f0ee52df06df3ad55259b9a323555fc8b"},
{file = "charset_normalizer-3.4.1-cp311-cp311-win_amd64.whl", hash = "sha256:d7f50a1f8c450f3925cb367d011448c39239bb3eb4117c36a6d354794de4ce76"},
{file = "charset_normalizer-3.4.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:73d94b58ec7fecbc7366247d3b0b10a21681004153238750bb67bd9012414545"},
{file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dad3e487649f498dd991eeb901125411559b22e8d7ab25d3aeb1af367df5efd7"},
{file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c30197aa96e8eed02200a83fba2657b4c3acd0f0aa4bdc9f6c1af8e8962e0757"},
{file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2369eea1ee4a7610a860d88f268eb39b95cb588acd7235e02fd5a5601773d4fa"},
{file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc2722592d8998c870fa4e290c2eec2c1569b87fe58618e67d38b4665dfa680d"},
{file = "charset_normalizer-3.4.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ffc9202a29ab3920fa812879e95a9e78b2465fd10be7fcbd042899695d75e616"},
{file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:804a4d582ba6e5b747c625bf1255e6b1507465494a40a2130978bda7b932c90b"},
{file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:0f55e69f030f7163dffe9fd0752b32f070566451afe180f99dbeeb81f511ad8d"},
{file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:c4c3e6da02df6fa1410a7680bd3f63d4f710232d3139089536310d027950696a"},
{file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:5df196eb874dae23dcfb968c83d4f8fdccb333330fe1fc278ac5ceeb101003a9"},
{file = "charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:e358e64305fe12299a08e08978f51fc21fac060dcfcddd95453eabe5b93ed0e1"},
{file = "charset_normalizer-3.4.1-cp312-cp312-win32.whl", hash = "sha256:9b23ca7ef998bc739bf6ffc077c2116917eabcc901f88da1b9856b210ef63f35"},
{file = "charset_normalizer-3.4.1-cp312-cp312-win_amd64.whl", hash = "sha256:6ff8a4a60c227ad87030d76e99cd1698345d4491638dfa6673027c48b3cd395f"},
{file = "charset_normalizer-3.4.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:aabfa34badd18f1da5ec1bc2715cadc8dca465868a4e73a0173466b688f29dda"},
{file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22e14b5d70560b8dd51ec22863f370d1e595ac3d024cb8ad7d308b4cd95f8313"},
{file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8436c508b408b82d87dc5f62496973a1805cd46727c34440b0d29d8a2f50a6c9"},
{file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2d074908e1aecee37a7635990b2c6d504cd4766c7bc9fc86d63f9c09af3fa11b"},
{file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:955f8851919303c92343d2f66165294848d57e9bba6cf6e3625485a70a038d11"},
{file = "charset_normalizer-3.4.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:44ecbf16649486d4aebafeaa7ec4c9fed8b88101f4dd612dcaf65d5e815f837f"},
{file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:0924e81d3d5e70f8126529951dac65c1010cdf117bb75eb02dd12339b57749dd"},
{file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:2967f74ad52c3b98de4c3b32e1a44e32975e008a9cd2a8cc8966d6a5218c5cb2"},
{file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:c75cb2a3e389853835e84a2d8fb2b81a10645b503eca9bcb98df6b5a43eb8886"},
{file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:09b26ae6b1abf0d27570633b2b078a2a20419c99d66fb2823173d73f188ce601"},
{file = "charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:fa88b843d6e211393a37219e6a1c1df99d35e8fd90446f1118f4216e307e48cd"},
{file = "charset_normalizer-3.4.1-cp313-cp313-win32.whl", hash = "sha256:eb8178fe3dba6450a3e024e95ac49ed3400e506fd4e9e5c32d30adda88cbd407"},
{file = "charset_normalizer-3.4.1-cp313-cp313-win_amd64.whl", hash = "sha256:b1ac5992a838106edb89654e0aebfc24f5848ae2547d22c2c3f66454daa11971"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f30bf9fd9be89ecb2360c7d94a711f00c09b976258846efe40db3d05828e8089"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:97f68b8d6831127e4787ad15e6757232e14e12060bec17091b85eb1486b91d8d"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7974a0b5ecd505609e3b19742b60cee7aa2aa2fb3151bc917e6e2646d7667dcf"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fc54db6c8593ef7d4b2a331b58653356cf04f67c960f584edb7c3d8c97e8f39e"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:311f30128d7d333eebd7896965bfcfbd0065f1716ec92bd5638d7748eb6f936a"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:7d053096f67cd1241601111b698f5cad775f97ab25d81567d3f59219b5f1adbd"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_i686.whl", hash = "sha256:807f52c1f798eef6cf26beb819eeb8819b1622ddfeef9d0977a8502d4db6d534"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_ppc64le.whl", hash = "sha256:dccbe65bd2f7f7ec22c4ff99ed56faa1e9f785482b9bbd7c717e26fd723a1d1e"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_s390x.whl", hash = "sha256:2fb9bd477fdea8684f78791a6de97a953c51831ee2981f8e4f583ff3b9d9687e"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:01732659ba9b5b873fc117534143e4feefecf3b2078b0a6a2e925271bb6f4cfa"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-win32.whl", hash = "sha256:7a4f97a081603d2050bfaffdefa5b02a9ec823f8348a572e39032caa8404a487"},
{file = "charset_normalizer-3.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:7b1bef6280950ee6c177b326508f86cad7ad4dff12454483b51d8b7d673a2c5d"},
{file = "charset_normalizer-3.4.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:ecddf25bee22fe4fe3737a399d0d177d72bc22be6913acfab364b40bce1ba83c"},
{file = "charset_normalizer-3.4.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8c60ca7339acd497a55b0ea5d506b2a2612afb2826560416f6894e8b5770d4a9"},
{file = "charset_normalizer-3.4.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b7b2d86dd06bfc2ade3312a83a5c364c7ec2e3498f8734282c6c3d4b07b346b8"},
{file = "charset_normalizer-3.4.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dd78cfcda14a1ef52584dbb008f7ac81c1328c0f58184bf9a84c49c605002da6"},
{file = "charset_normalizer-3.4.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6e27f48bcd0957c6d4cb9d6fa6b61d192d0b13d5ef563e5f2ae35feafc0d179c"},
{file = "charset_normalizer-3.4.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:01ad647cdd609225c5350561d084b42ddf732f4eeefe6e678765636791e78b9a"},
{file = "charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:619a609aa74ae43d90ed2e89bdd784765de0a25ca761b93e196d938b8fd1dbbd"},
{file = "charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:89149166622f4db9b4b6a449256291dc87a99ee53151c74cbd82a53c8c2f6ccd"},
{file = "charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:7709f51f5f7c853f0fb938bcd3bc59cdfdc5203635ffd18bf354f6967ea0f824"},
{file = "charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:345b0426edd4e18138d6528aed636de7a9ed169b4aaf9d61a8c19e39d26838ca"},
{file = "charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:0907f11d019260cdc3f94fbdb23ff9125f6b5d1039b76003b5b0ac9d6a6c9d5b"},
{file = "charset_normalizer-3.4.1-cp38-cp38-win32.whl", hash = "sha256:ea0d8d539afa5eb2728aa1932a988a9a7af94f18582ffae4bc10b3fbdad0626e"},
{file = "charset_normalizer-3.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:329ce159e82018d646c7ac45b01a430369d526569ec08516081727a20e9e4af4"},
{file = "charset_normalizer-3.4.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:b97e690a2118911e39b4042088092771b4ae3fc3aa86518f84b8cf6888dbdb41"},
{file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:78baa6d91634dfb69ec52a463534bc0df05dbd546209b79a3880a34487f4b84f"},
{file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1a2bc9f351a75ef49d664206d51f8e5ede9da246602dc2d2726837620ea034b2"},
{file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:75832c08354f595c760a804588b9357d34ec00ba1c940c15e31e96d902093770"},
{file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0af291f4fe114be0280cdd29d533696a77b5b49cfde5467176ecab32353395c4"},
{file = "charset_normalizer-3.4.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0167ddc8ab6508fe81860a57dd472b2ef4060e8d378f0cc555707126830f2537"},
{file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:2a75d49014d118e4198bcee5ee0a6f25856b29b12dbf7cd012791f8a6cc5c496"},
{file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:363e2f92b0f0174b2f8238240a1a30142e3db7b957a5dd5689b0e75fb717cc78"},
{file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:ab36c8eb7e454e34e60eb55ca5d241a5d18b2c6244f6827a30e451c42410b5f7"},
{file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:4c0907b1928a36d5a998d72d64d8eaa7244989f7aaaf947500d3a800c83a3fd6"},
{file = "charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:04432ad9479fa40ec0f387795ddad4437a2b50417c69fa275e212933519ff294"},
{file = "charset_normalizer-3.4.1-cp39-cp39-win32.whl", hash = "sha256:3bed14e9c89dcb10e8f3a29f9ccac4955aebe93c71ae803af79265c9ca5644c5"},
{file = "charset_normalizer-3.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:49402233c892a461407c512a19435d1ce275543138294f7ef013f0b63d5d3765"},
{file = "charset_normalizer-3.4.1-py3-none-any.whl", hash = "sha256:d98b1668f06378c6dbefec3b92299716b931cd4e6061f3c875a71ced1780ab85"},
{file = "charset_normalizer-3.4.1.tar.gz", hash = "sha256:44251f18cd68a75b56585dd00dae26183e102cd5e0f9f1466e6df5da2ed64ea3"},
]
[[package]]
@@ -1837,18 +1824,19 @@ files = [
[[package]]
name = "lyrics-transcriber"
version = "0.18.0"
version = "0.20.0"
description = "Automatically create synchronised lyrics files in ASS and MidiCo LRC formats with word-level timestamps, using Whisper and lyrics from Genius and Spotify"
optional = false
python-versions = ">=3.9"
python-versions = "<3.13,>=3.9"
files = [
{file = "lyrics_transcriber-0.18.0-py3-none-any.whl", hash = "sha256:a7af8a3f14c3fac5219d6515681a4faab1a69a2d3f75786970b12eeb3ca7d8a9"},
{file = "lyrics_transcriber-0.18.0.tar.gz", hash = "sha256:154b475f64e6fa3b304102e0a30170c874d23a2121bf854e81c99b9cad21c22f"},
{file = "lyrics_transcriber-0.20.0-py3-none-any.whl", hash = "sha256:791d1b8b8d729c77632370710be012eef26df606a9be56800b14d465ef6bcf0d"},
{file = "lyrics_transcriber-0.20.0.tar.gz", hash = "sha256:cdca5937efad586bb9ca8a3f304de4eaca0b5f41923605a1e715bf6c92f7a0b4"},
]
[package.dependencies]
Cython = ">=0"
dtw-python = ">=1"
karaoke-lyrics-processor = ">=0.4.1"
llvmlite = ">=0"
lyricsgenius = ">=3"
numba = ">=0.57"
@@ -4595,4 +4583,4 @@ type = ["pytest-mypy"]
[metadata]
lock-version = "2.0"
python-versions = ">=3.10,<3.13"
content-hash = "578e5a9dc8605ca10ad4379a312b95e13bc2b11581156fcc1e38a446e8c4069f"
content-hash = "94de51a3701fd3e1a5218e6ebdea786397896dd27f850e27d6aac0216af13794"
+2 -3
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "karaoke-prep"
version = "0.30.3"
version = "0.34.1"
description = "Prepare for karaoke video creation, by downloading audio and lyrics for a specified song or playlist from youtube and separating audio stems. After syncing, finalise the video with a title screen!"
authors = ["Andrew Beveridge <andrew@beveridge.uk>"]
license = "MIT"
@@ -28,9 +28,8 @@ thefuzz = ">=0.22"
numpy = "^1"
audio-separator = { version = ">=0.21.0", extras = ["cpu"] }
lyrics-converter = ">=0.2.1"
lyrics-transcriber = ">=0.18"
lyrics-transcriber = ">=0.20.0"
kbputils = "^0.0.16"
karaoke-lyrics-processor = ">=0.4.1"
attrs = ">=24.2.0"
cattrs = ">=24.1.2"
toml = ">=0.10"
+17 -65
View File
@@ -1,3 +1,5 @@
#! /usr/bin/env python3
import os
import json
import logging
@@ -23,57 +25,21 @@ with open("data/artist-titles.json", "r", encoding="utf-8") as f:
# Sort by length and get shortest and longest 20
sorted_combinations = sorted(all_combinations, key=total_length)
artist_title_combinations = sorted_combinations[:10] + sorted_combinations[-10:]
artist_title_combinations = sorted_combinations[:20] + sorted_combinations[-20:]
# Define the format dictionary with expanded configurations
formats = [
{
"name": "vocalstar",
"intro_background_image": "/Users/andrew/AB Dropbox/Andrew Beveridge/MediaUnsynced/Karaoke/Tracks-NonPublished/VocalStar/Resources/vocal-star-title-background-black.4k.png",
"end_background_image": "/Users/andrew/AB Dropbox/Andrew Beveridge/MediaUnsynced/Karaoke/Tracks-NonPublished/VocalStar/Resources/vocal-star-end-card-black.4k.png",
"font": "Zurich_Cn_BT_Bold.ttf",
"artist_color": "#FCDF01",
"title_color": "#FCDF01",
"intro_title_region": "370,470,3100,480",
"intro_artist_region": "370,1210,3100,480",
"intro_extra_text": "GET READY TO SING!",
"intro_extra_text_color": "#FFFFFF",
"intro_extra_text_region": "370,1800,3100,280",
"end_title_region": "370,670,3100,480",
"end_artist_region": "370,1410,3100,480",
"end_extra_text": "THANK YOU FOR SINGING!",
"end_extra_text_color": "#FFFFFF",
"end_extra_text_region": "370,1800,3100,280",
"name": "nomadkaraoke",
"style_params_json": "/Users/andrew/AB Dropbox/Andrew Beveridge/MediaUnsynced/Karaoke/NomadBranding/karaoke-prep-styles-nomad.json",
},
{
"name": "nomadkaraoke",
"intro_background_image": "/Users/andrew/AB Dropbox/Andrew Beveridge/MediaUnsynced/Karaoke/NomadBranding/karaoke-title-screen-background-nomad-4k.png",
"end_background_color": "#000000", # Using solid color for end screen
"font": "AvenirNext-Bold.ttf",
"artist_color": "#FFFFFF",
"title_color": "#ffdf6b",
"intro_title_region": "370,950,3100,350",
"intro_artist_region": "370,1350,3100,450",
"intro_extra_text": None, # No extra text on intro
"end_title_region": "370,800,3100,350",
"end_artist_region": "370,1200,3100,450",
"end_extra_text": "Follow us @NomadKaraoke",
"end_extra_text_color": "#ffdf6b",
"end_extra_text_region": "370,1700,3100,280",
"name": "vocalstar",
"style_params_json": "/Users/andrew/AB Dropbox/Andrew Beveridge/MediaUnsynced/Karaoke/Tracks-NonPublished/VocalStar/Resources/karaoke-prep-styles-vocalstar.json",
},
{
"name": "minimal",
"intro_background_color": "#000033",
"end_background_color": "#000033",
"font": "Montserrat-Bold.ttf",
"artist_color": "#FFFFFF",
"title_color": "#ffdf6b",
"intro_title_region": "370,800,3100,400",
"intro_artist_region": "370,1300,3100,400",
"intro_extra_text": None, # No extra text on either screen
"end_title_region": "370,800,3100,400",
"end_artist_region": "370,1300,3100,400",
"end_extra_text": None,
"style_params_json": None,
},
]
@@ -87,34 +53,18 @@ for format in formats:
format_output_dir = os.path.join(base_output_dir, format["name"])
os.makedirs(format_output_dir, exist_ok=True)
style_params = None
if format["style_params_json"]:
with open(format["style_params_json"], "r") as f:
style_params = json.loads(f.read())
# Instantiate KaraokePrep for this format
kprep = KaraokePrep(
log_level=logging.INFO,
log_formatter=log_formatter,
output_dir=format_output_dir,
intro_background_image=format.get("intro_background_image"),
intro_background_color=format.get("intro_background_color", "#000000"),
end_background_image=format.get("end_background_image"),
end_background_color=format.get("end_background_color", "#000000"),
intro_font=format["font"],
end_font=format["font"],
intro_artist_color=format["artist_color"],
intro_title_color=format["title_color"],
end_artist_color=format["artist_color"],
end_title_color=format["title_color"],
intro_title_region=format.get("intro_title_region"),
intro_artist_region=format.get("intro_artist_region"),
intro_extra_text=format.get("intro_extra_text"),
intro_extra_text_color=format.get("intro_extra_text_color"),
intro_extra_text_region=format.get("intro_extra_text_region"),
end_title_region=format.get("end_title_region"),
end_artist_region=format.get("end_artist_region"),
end_extra_text=format.get("end_extra_text"),
end_extra_text_color=format.get("end_extra_text_color"),
end_extra_text_region=format.get("end_extra_text_region"),
intro_video_duration=0,
end_video_duration=0,
render_bounding_boxes=True,
style_params=style_params,
render_bounding_boxes=False,
output_jpg=False,
output_png=True,
)
@@ -128,6 +78,7 @@ for format in formats:
title_image_filepath_noext = os.path.join(format_output_dir, f"{sanitized_artist}_{sanitized_title}_title")
title_video_filepath = os.path.join(format_output_dir, f"{sanitized_artist}_{sanitized_title}_title.mov")
kprep.intro_video_duration = 0
kprep.create_title_video(
artist=artist,
title=title,
@@ -141,6 +92,7 @@ for format in formats:
end_image_filepath_noext = os.path.join(format_output_dir, f"{sanitized_artist}_{sanitized_title}_end")
end_video_filepath = os.path.join(format_output_dir, f"{sanitized_artist}_{sanitized_title}_end.mov")
kprep.end_video_duration = 0
kprep.create_end_video(
artist=artist,
title=title,