karaoke-gen 0.71.42__py3-none-any.whl → 0.75.16__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- karaoke_gen/__init__.py +32 -1
- karaoke_gen/audio_fetcher.py +476 -56
- karaoke_gen/audio_processor.py +11 -3
- karaoke_gen/instrumental_review/server.py +154 -860
- karaoke_gen/instrumental_review/static/index.html +1506 -0
- karaoke_gen/karaoke_finalise/karaoke_finalise.py +62 -1
- karaoke_gen/karaoke_gen.py +114 -1
- karaoke_gen/lyrics_processor.py +81 -4
- karaoke_gen/utils/bulk_cli.py +3 -0
- karaoke_gen/utils/cli_args.py +4 -2
- karaoke_gen/utils/gen_cli.py +196 -5
- karaoke_gen/utils/remote_cli.py +523 -34
- {karaoke_gen-0.71.42.dist-info → karaoke_gen-0.75.16.dist-info}/METADATA +4 -1
- {karaoke_gen-0.71.42.dist-info → karaoke_gen-0.75.16.dist-info}/RECORD +31 -25
- lyrics_transcriber/frontend/package.json +1 -1
- lyrics_transcriber/frontend/src/components/Header.tsx +38 -12
- lyrics_transcriber/frontend/src/components/LyricsAnalyzer.tsx +17 -3
- lyrics_transcriber/frontend/src/components/LyricsSynchronizer/SyncControls.tsx +185 -0
- lyrics_transcriber/frontend/src/components/LyricsSynchronizer/TimelineCanvas.tsx +704 -0
- lyrics_transcriber/frontend/src/components/LyricsSynchronizer/UpcomingWordsBar.tsx +80 -0
- lyrics_transcriber/frontend/src/components/LyricsSynchronizer/index.tsx +905 -0
- lyrics_transcriber/frontend/src/components/ModeSelectionModal.tsx +127 -0
- lyrics_transcriber/frontend/src/components/ReplaceAllLyricsModal.tsx +190 -542
- lyrics_transcriber/frontend/tsconfig.tsbuildinfo +1 -1
- lyrics_transcriber/frontend/web_assets/assets/{index-DdJTDWH3.js → index-COYImAcx.js} +1722 -489
- lyrics_transcriber/frontend/web_assets/assets/index-COYImAcx.js.map +1 -0
- lyrics_transcriber/frontend/web_assets/index.html +1 -1
- lyrics_transcriber/review/server.py +5 -5
- lyrics_transcriber/frontend/web_assets/assets/index-DdJTDWH3.js.map +0 -1
- {karaoke_gen-0.71.42.dist-info → karaoke_gen-0.75.16.dist-info}/WHEEL +0 -0
- {karaoke_gen-0.71.42.dist-info → karaoke_gen-0.75.16.dist-info}/entry_points.txt +0 -0
- {karaoke_gen-0.71.42.dist-info → karaoke_gen-0.75.16.dist-info}/licenses/LICENSE +0 -0
|
@@ -47,6 +47,7 @@ class KaraokeFinalise:
|
|
|
47
47
|
user_youtube_credentials=None, # Add support for pre-stored credentials
|
|
48
48
|
server_side_mode=False, # New parameter for server-side deployment
|
|
49
49
|
selected_instrumental_file=None, # Add support for pre-selected instrumental file
|
|
50
|
+
countdown_padding_seconds=None, # Padding applied to vocals; instrumental must match
|
|
50
51
|
):
|
|
51
52
|
self.log_level = log_level
|
|
52
53
|
self.log_formatter = log_formatter
|
|
@@ -54,6 +55,9 @@ class KaraokeFinalise:
|
|
|
54
55
|
if logger is None:
|
|
55
56
|
self.logger = logging.getLogger(__name__)
|
|
56
57
|
self.logger.setLevel(log_level)
|
|
58
|
+
# Prevent log propagation to root logger to avoid duplicate logs
|
|
59
|
+
# when external packages (like lyrics_converter) configure root logger handlers
|
|
60
|
+
self.logger.propagate = False
|
|
57
61
|
|
|
58
62
|
self.log_handler = logging.StreamHandler()
|
|
59
63
|
|
|
@@ -105,6 +109,7 @@ class KaraokeFinalise:
|
|
|
105
109
|
self.user_youtube_credentials = user_youtube_credentials
|
|
106
110
|
self.server_side_mode = server_side_mode
|
|
107
111
|
self.selected_instrumental_file = selected_instrumental_file
|
|
112
|
+
self.countdown_padding_seconds = countdown_padding_seconds
|
|
108
113
|
|
|
109
114
|
self.suffixes = {
|
|
110
115
|
"title_mov": " (Title).mov",
|
|
@@ -421,6 +426,15 @@ class KaraokeFinalise:
|
|
|
421
426
|
# Check if any videos were found
|
|
422
427
|
if "items" in response and len(response["items"]) > 0:
|
|
423
428
|
for item in response["items"]:
|
|
429
|
+
# YouTube search API sometimes returns results from other channels even with channelId filter
|
|
430
|
+
# Verify the video actually belongs to our channel
|
|
431
|
+
result_channel_id = item["snippet"]["channelId"]
|
|
432
|
+
if result_channel_id != channel_id:
|
|
433
|
+
self.logger.debug(
|
|
434
|
+
f"Skipping video from different channel: {item['snippet']['title']} (channel: {result_channel_id})"
|
|
435
|
+
)
|
|
436
|
+
continue
|
|
437
|
+
|
|
424
438
|
found_title = item["snippet"]["title"]
|
|
425
439
|
|
|
426
440
|
# In server-side mode, require an exact match to avoid false positives.
|
|
@@ -720,6 +734,32 @@ class KaraokeFinalise:
|
|
|
720
734
|
artist, title = base_name.split(" - ", 1)
|
|
721
735
|
return base_name, artist, title
|
|
722
736
|
|
|
737
|
+
def _pad_audio_file(self, input_audio, output_audio, padding_seconds):
|
|
738
|
+
"""
|
|
739
|
+
Pad an audio file by prepending silence at the beginning.
|
|
740
|
+
|
|
741
|
+
Uses the same ffmpeg approach as LyricsTranscriber's CountdownProcessor
|
|
742
|
+
to ensure consistent padding behavior.
|
|
743
|
+
|
|
744
|
+
Args:
|
|
745
|
+
input_audio: Path to input audio file
|
|
746
|
+
output_audio: Path for the padded output file
|
|
747
|
+
padding_seconds: Amount of silence to prepend (in seconds)
|
|
748
|
+
"""
|
|
749
|
+
self.logger.info(f"Padding audio file with {padding_seconds}s of silence")
|
|
750
|
+
|
|
751
|
+
# Use ffmpeg to prepend silence - this matches the approach in audio_processor.py
|
|
752
|
+
# adelay filter adds delay in milliseconds
|
|
753
|
+
delay_ms = int(padding_seconds * 1000)
|
|
754
|
+
|
|
755
|
+
ffmpeg_command = (
|
|
756
|
+
f'{self.ffmpeg_base_command} -i "{input_audio}" '
|
|
757
|
+
f'-af "adelay={delay_ms}|{delay_ms}" '
|
|
758
|
+
f'"{output_audio}"'
|
|
759
|
+
)
|
|
760
|
+
|
|
761
|
+
self.execute_command(ffmpeg_command, f"Padding audio with {padding_seconds}s silence")
|
|
762
|
+
|
|
723
763
|
def execute_command(self, command, description):
|
|
724
764
|
"""Execute a shell command and log the output. For general commands (rclone, etc.)"""
|
|
725
765
|
self.logger.info(f"{description}")
|
|
@@ -764,11 +804,32 @@ class KaraokeFinalise:
|
|
|
764
804
|
|
|
765
805
|
def remux_with_instrumental(self, with_vocals_file, instrumental_audio, output_file):
|
|
766
806
|
"""Remux the video with instrumental audio to create karaoke version"""
|
|
807
|
+
# Safety net: If countdown padding was applied to vocals, ensure instrumental is padded too
|
|
808
|
+
actual_instrumental = instrumental_audio
|
|
809
|
+
if self.countdown_padding_seconds and self.countdown_padding_seconds > 0:
|
|
810
|
+
# Check if the instrumental file is already padded (has "(Padded)" in name)
|
|
811
|
+
if "(Padded)" not in instrumental_audio:
|
|
812
|
+
self.logger.warning(
|
|
813
|
+
f"Countdown padding ({self.countdown_padding_seconds}s) was applied to vocals, "
|
|
814
|
+
f"but instrumental doesn't appear to be padded. Creating padded version..."
|
|
815
|
+
)
|
|
816
|
+
# Create a padded version of the instrumental
|
|
817
|
+
base, ext = os.path.splitext(instrumental_audio)
|
|
818
|
+
padded_instrumental = f"{base} (Padded){ext}"
|
|
819
|
+
|
|
820
|
+
if not os.path.exists(padded_instrumental):
|
|
821
|
+
self._pad_audio_file(instrumental_audio, padded_instrumental, self.countdown_padding_seconds)
|
|
822
|
+
self.logger.info(f"Created padded instrumental: {padded_instrumental}")
|
|
823
|
+
|
|
824
|
+
actual_instrumental = padded_instrumental
|
|
825
|
+
else:
|
|
826
|
+
self.logger.info(f"Using already-padded instrumental: {instrumental_audio}")
|
|
827
|
+
|
|
767
828
|
# This operation is primarily I/O bound (remuxing), so hardware acceleration doesn't provide significant benefit
|
|
768
829
|
# Keep the existing approach but use the new execute method
|
|
769
830
|
ffmpeg_command = (
|
|
770
831
|
f'{self.ffmpeg_base_command} -an -i "{with_vocals_file}" '
|
|
771
|
-
f'-vn -i "{
|
|
832
|
+
f'-vn -i "{actual_instrumental}" -c:v copy -c:a pcm_s16le "{output_file}"'
|
|
772
833
|
)
|
|
773
834
|
self.execute_command(ffmpeg_command, "Remuxing video with instrumental audio")
|
|
774
835
|
|
karaoke_gen/karaoke_gen.py
CHANGED
|
@@ -29,7 +29,7 @@ from .audio_processor import AudioProcessor
|
|
|
29
29
|
from .lyrics_processor import LyricsProcessor
|
|
30
30
|
from .video_generator import VideoGenerator
|
|
31
31
|
from .video_background_processor import VideoBackgroundProcessor
|
|
32
|
-
from .audio_fetcher import create_audio_fetcher, AudioFetcherError, NoResultsError
|
|
32
|
+
from .audio_fetcher import create_audio_fetcher, AudioFetcherError, NoResultsError, UserCancelledError
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
class KaraokePrep:
|
|
@@ -84,6 +84,9 @@ class KaraokePrep:
|
|
|
84
84
|
if logger is None:
|
|
85
85
|
self.logger = logging.getLogger(__name__)
|
|
86
86
|
self.logger.setLevel(log_level)
|
|
87
|
+
# Prevent log propagation to root logger to avoid duplicate logs
|
|
88
|
+
# when external packages (like lyrics_converter) configure root logger handlers
|
|
89
|
+
self.logger.propagate = False
|
|
87
90
|
|
|
88
91
|
self.log_handler = logging.StreamHandler()
|
|
89
92
|
|
|
@@ -256,6 +259,101 @@ class KaraokePrep:
|
|
|
256
259
|
self.artist = metadata_result["artist"]
|
|
257
260
|
self.title = metadata_result["title"]
|
|
258
261
|
|
|
262
|
+
def _scan_directory_for_instrumentals(self, track_output_dir, artist_title):
|
|
263
|
+
"""
|
|
264
|
+
Scan the directory for existing instrumental files and build a separated_audio structure.
|
|
265
|
+
|
|
266
|
+
This is used when transcription was skipped (existing files found) but we need to
|
|
267
|
+
pad instrumentals due to countdown padding.
|
|
268
|
+
|
|
269
|
+
Args:
|
|
270
|
+
track_output_dir: The track output directory to scan
|
|
271
|
+
artist_title: The "{artist} - {title}" string for matching files
|
|
272
|
+
|
|
273
|
+
Returns:
|
|
274
|
+
Dictionary with separated_audio structure containing found instrumental paths
|
|
275
|
+
"""
|
|
276
|
+
self.logger.info(f"Scanning directory for existing instrumentals: {track_output_dir}")
|
|
277
|
+
|
|
278
|
+
separated_audio = {
|
|
279
|
+
"clean_instrumental": {},
|
|
280
|
+
"backing_vocals": {},
|
|
281
|
+
"other_stems": {},
|
|
282
|
+
"combined_instrumentals": {},
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
# Search patterns for instrumental files
|
|
286
|
+
# Files are named like: "{artist} - {title} (Instrumental {model}).flac"
|
|
287
|
+
# Or with backing vocals: "{artist} - {title} (Instrumental +BV {model}).flac"
|
|
288
|
+
|
|
289
|
+
# Look for files in the track output directory
|
|
290
|
+
search_dir = track_output_dir
|
|
291
|
+
|
|
292
|
+
# Find all instrumental files (not padded ones - we want the originals)
|
|
293
|
+
instrumental_pattern = os.path.join(search_dir, f"{artist_title} (Instrumental*.flac")
|
|
294
|
+
instrumental_files = glob.glob(instrumental_pattern)
|
|
295
|
+
|
|
296
|
+
# Also check for wav files
|
|
297
|
+
instrumental_pattern_wav = os.path.join(search_dir, f"{artist_title} (Instrumental*.wav")
|
|
298
|
+
instrumental_files.extend(glob.glob(instrumental_pattern_wav))
|
|
299
|
+
|
|
300
|
+
self.logger.debug(f"Found {len(instrumental_files)} instrumental files")
|
|
301
|
+
|
|
302
|
+
for filepath in instrumental_files:
|
|
303
|
+
filename = os.path.basename(filepath)
|
|
304
|
+
|
|
305
|
+
# Skip already padded files
|
|
306
|
+
if "(Padded)" in filename:
|
|
307
|
+
self.logger.debug(f"Skipping already padded file: {filename}")
|
|
308
|
+
continue
|
|
309
|
+
|
|
310
|
+
# Determine if it's a combined instrumental (+BV) or clean instrumental
|
|
311
|
+
if "+BV" in filename or "+bv" in filename.lower():
|
|
312
|
+
# Combined instrumental with backing vocals
|
|
313
|
+
# Extract model name from filename
|
|
314
|
+
# Pattern: "(Instrumental +BV {model}).flac"
|
|
315
|
+
model_match = re.search(r'\(Instrumental \+BV ([^)]+)\)', filename)
|
|
316
|
+
if model_match:
|
|
317
|
+
model_name = model_match.group(1).strip()
|
|
318
|
+
separated_audio["combined_instrumentals"][model_name] = filepath
|
|
319
|
+
self.logger.info(f"Found combined instrumental: {filename}")
|
|
320
|
+
else:
|
|
321
|
+
# Clean instrumental (no backing vocals)
|
|
322
|
+
# Pattern: "(Instrumental {model}).flac"
|
|
323
|
+
model_match = re.search(r'\(Instrumental ([^)]+)\)', filename)
|
|
324
|
+
if model_match:
|
|
325
|
+
# Use as clean instrumental if we don't have one yet
|
|
326
|
+
if not separated_audio["clean_instrumental"].get("instrumental"):
|
|
327
|
+
separated_audio["clean_instrumental"]["instrumental"] = filepath
|
|
328
|
+
self.logger.info(f"Found clean instrumental: {filename}")
|
|
329
|
+
else:
|
|
330
|
+
# Additional clean instrumentals go to combined_instrumentals for padding
|
|
331
|
+
model_name = model_match.group(1).strip()
|
|
332
|
+
separated_audio["combined_instrumentals"][model_name] = filepath
|
|
333
|
+
self.logger.info(f"Found additional instrumental: {filename}")
|
|
334
|
+
|
|
335
|
+
# Also look for backing vocals files
|
|
336
|
+
backing_vocals_pattern = os.path.join(search_dir, f"{artist_title} (Backing Vocals*.flac")
|
|
337
|
+
backing_vocals_files = glob.glob(backing_vocals_pattern)
|
|
338
|
+
backing_vocals_pattern_wav = os.path.join(search_dir, f"{artist_title} (Backing Vocals*.wav")
|
|
339
|
+
backing_vocals_files.extend(glob.glob(backing_vocals_pattern_wav))
|
|
340
|
+
|
|
341
|
+
for filepath in backing_vocals_files:
|
|
342
|
+
filename = os.path.basename(filepath)
|
|
343
|
+
model_match = re.search(r'\(Backing Vocals ([^)]+)\)', filename)
|
|
344
|
+
if model_match:
|
|
345
|
+
model_name = model_match.group(1).strip()
|
|
346
|
+
if model_name not in separated_audio["backing_vocals"]:
|
|
347
|
+
separated_audio["backing_vocals"][model_name] = {"backing_vocals": filepath}
|
|
348
|
+
self.logger.info(f"Found backing vocals: {filename}")
|
|
349
|
+
|
|
350
|
+
# Log summary
|
|
351
|
+
clean_count = 1 if separated_audio["clean_instrumental"].get("instrumental") else 0
|
|
352
|
+
combined_count = len(separated_audio["combined_instrumentals"])
|
|
353
|
+
self.logger.info(f"Directory scan complete: {clean_count} clean instrumental, {combined_count} combined instrumentals")
|
|
354
|
+
|
|
355
|
+
return separated_audio
|
|
356
|
+
|
|
259
357
|
async def prep_single_track(self):
|
|
260
358
|
# Add signal handler at the start
|
|
261
359
|
loop = asyncio.get_running_loop()
|
|
@@ -419,6 +517,9 @@ class KaraokePrep:
|
|
|
419
517
|
# No still image for audio-only downloads
|
|
420
518
|
processed_track["input_still_image"] = None
|
|
421
519
|
|
|
520
|
+
except UserCancelledError:
|
|
521
|
+
# User cancelled - propagate up to CLI for graceful exit
|
|
522
|
+
raise
|
|
422
523
|
except NoResultsError as e:
|
|
423
524
|
self.logger.error(f"No audio found: {e}")
|
|
424
525
|
return None
|
|
@@ -761,6 +862,18 @@ class KaraokePrep:
|
|
|
761
862
|
f"Applying {padding_seconds}s padding to all instrumental files to sync with vocal countdown"
|
|
762
863
|
)
|
|
763
864
|
|
|
865
|
+
# If separated_audio is empty (e.g., transcription was skipped but existing files have countdown),
|
|
866
|
+
# scan the directory for existing instrumental files
|
|
867
|
+
has_instrumentals = (
|
|
868
|
+
processed_track["separated_audio"].get("clean_instrumental", {}).get("instrumental") or
|
|
869
|
+
processed_track["separated_audio"].get("combined_instrumentals")
|
|
870
|
+
)
|
|
871
|
+
if not has_instrumentals:
|
|
872
|
+
self.logger.info("No instrumentals in separated_audio, scanning directory for existing files...")
|
|
873
|
+
processed_track["separated_audio"] = self._scan_directory_for_instrumentals(
|
|
874
|
+
track_output_dir, artist_title
|
|
875
|
+
)
|
|
876
|
+
|
|
764
877
|
# Apply padding using AudioProcessor
|
|
765
878
|
padded_separation_result = self.audio_processor.apply_countdown_padding_to_instrumentals(
|
|
766
879
|
separation_result=processed_track["separated_audio"],
|
karaoke_gen/lyrics_processor.py
CHANGED
|
@@ -11,6 +11,9 @@ from .utils import sanitize_filename
|
|
|
11
11
|
|
|
12
12
|
# Placeholder class or functions for lyrics processing
|
|
13
13
|
class LyricsProcessor:
|
|
14
|
+
# Standard countdown padding duration used by LyricsTranscriber
|
|
15
|
+
COUNTDOWN_PADDING_SECONDS = 3.0
|
|
16
|
+
|
|
14
17
|
def __init__(
|
|
15
18
|
self, logger, style_params_json, lyrics_file, skip_transcription, skip_transcription_review, render_video, subtitle_offset_ms
|
|
16
19
|
):
|
|
@@ -22,6 +25,60 @@ class LyricsProcessor:
|
|
|
22
25
|
self.render_video = render_video
|
|
23
26
|
self.subtitle_offset_ms = subtitle_offset_ms
|
|
24
27
|
|
|
28
|
+
def _detect_countdown_padding_from_lrc(self, lrc_filepath):
|
|
29
|
+
"""
|
|
30
|
+
Detect if countdown padding was applied by checking the first lyric timestamp in the LRC file.
|
|
31
|
+
|
|
32
|
+
LRC format timestamps look like: [mm:ss.xx] or [mm:ss.xxx]
|
|
33
|
+
If the first lyric timestamp is >= 3.0 seconds, countdown padding was likely applied.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
lrc_filepath: Path to the LRC file
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
Tuple of (countdown_padding_added: bool, countdown_padding_seconds: float)
|
|
40
|
+
"""
|
|
41
|
+
try:
|
|
42
|
+
with open(lrc_filepath, 'r', encoding='utf-8') as f:
|
|
43
|
+
content = f.read()
|
|
44
|
+
|
|
45
|
+
# Find all timestamp patterns in the LRC file
|
|
46
|
+
# LRC timestamps: [mm:ss.xx] or [mm:ss.xxx]
|
|
47
|
+
timestamp_pattern = r'\[(\d{1,2}):(\d{2})\.(\d{2,3})\]'
|
|
48
|
+
matches = re.findall(timestamp_pattern, content)
|
|
49
|
+
|
|
50
|
+
if not matches:
|
|
51
|
+
self.logger.debug("No timestamps found in LRC file")
|
|
52
|
+
return (False, 0.0)
|
|
53
|
+
|
|
54
|
+
# Find the first non-metadata timestamp (metadata like [ar:Artist] doesn't have decimal)
|
|
55
|
+
# We already filtered for decimal timestamps in our pattern
|
|
56
|
+
first_timestamp = matches[0]
|
|
57
|
+
minutes = int(first_timestamp[0])
|
|
58
|
+
seconds = int(first_timestamp[1])
|
|
59
|
+
# Handle both .xx and .xxx formats
|
|
60
|
+
centiseconds = first_timestamp[2]
|
|
61
|
+
if len(centiseconds) == 2:
|
|
62
|
+
milliseconds = int(centiseconds) * 10
|
|
63
|
+
else:
|
|
64
|
+
milliseconds = int(centiseconds)
|
|
65
|
+
|
|
66
|
+
first_lyric_time = minutes * 60 + seconds + milliseconds / 1000.0
|
|
67
|
+
|
|
68
|
+
self.logger.debug(f"First lyric timestamp in LRC: {first_lyric_time:.3f}s")
|
|
69
|
+
|
|
70
|
+
# If first lyric is at or after 3 seconds, countdown padding was applied
|
|
71
|
+
# Use a small buffer (2.5s) to account for songs that naturally start a bit late
|
|
72
|
+
if first_lyric_time >= 2.5:
|
|
73
|
+
self.logger.info(f"Detected countdown padding from LRC: first lyric at {first_lyric_time:.2f}s")
|
|
74
|
+
return (True, self.COUNTDOWN_PADDING_SECONDS)
|
|
75
|
+
|
|
76
|
+
return (False, 0.0)
|
|
77
|
+
|
|
78
|
+
except Exception as e:
|
|
79
|
+
self.logger.warning(f"Failed to detect countdown padding from LRC file: {e}")
|
|
80
|
+
return (False, 0.0)
|
|
81
|
+
|
|
25
82
|
def find_best_split_point(self, line):
|
|
26
83
|
"""
|
|
27
84
|
Find the best split point in a line based on the specified criteria.
|
|
@@ -138,23 +195,43 @@ class LyricsProcessor:
|
|
|
138
195
|
lyrics_video_path = os.path.join(lyrics_dir, f"{sanitized_artist} - {sanitized_title} (With Vocals).mkv")
|
|
139
196
|
lyrics_lrc_path = os.path.join(lyrics_dir, f"{sanitized_artist} - {sanitized_title} (Karaoke).lrc")
|
|
140
197
|
|
|
141
|
-
# If files exist in parent directory, return early
|
|
198
|
+
# If files exist in parent directory, return early (but detect countdown padding first)
|
|
142
199
|
if os.path.exists(parent_video_path) and os.path.exists(parent_lrc_path):
|
|
143
|
-
self.logger.info(
|
|
200
|
+
self.logger.info("Found existing video and LRC files in parent directory, skipping transcription")
|
|
201
|
+
|
|
202
|
+
# Detect countdown padding from existing LRC file
|
|
203
|
+
countdown_padding_added, countdown_padding_seconds = self._detect_countdown_padding_from_lrc(parent_lrc_path)
|
|
204
|
+
|
|
205
|
+
if countdown_padding_added:
|
|
206
|
+
self.logger.info(f"Existing files have countdown padding: {countdown_padding_seconds}s")
|
|
207
|
+
|
|
144
208
|
return {
|
|
145
209
|
"lrc_filepath": parent_lrc_path,
|
|
146
210
|
"ass_filepath": parent_video_path,
|
|
211
|
+
"countdown_padding_added": countdown_padding_added,
|
|
212
|
+
"countdown_padding_seconds": countdown_padding_seconds,
|
|
213
|
+
"padded_audio_filepath": None, # Original padded audio may not exist
|
|
147
214
|
}
|
|
148
215
|
|
|
149
|
-
# If files exist in lyrics directory, copy to parent and return
|
|
216
|
+
# If files exist in lyrics directory, copy to parent and return (but detect countdown padding first)
|
|
150
217
|
if os.path.exists(lyrics_video_path) and os.path.exists(lyrics_lrc_path):
|
|
151
|
-
self.logger.info(
|
|
218
|
+
self.logger.info("Found existing video and LRC files in lyrics directory, copying to parent")
|
|
152
219
|
os.makedirs(track_output_dir, exist_ok=True)
|
|
153
220
|
shutil.copy2(lyrics_video_path, parent_video_path)
|
|
154
221
|
shutil.copy2(lyrics_lrc_path, parent_lrc_path)
|
|
222
|
+
|
|
223
|
+
# Detect countdown padding from existing LRC file
|
|
224
|
+
countdown_padding_added, countdown_padding_seconds = self._detect_countdown_padding_from_lrc(parent_lrc_path)
|
|
225
|
+
|
|
226
|
+
if countdown_padding_added:
|
|
227
|
+
self.logger.info(f"Existing files have countdown padding: {countdown_padding_seconds}s")
|
|
228
|
+
|
|
155
229
|
return {
|
|
156
230
|
"lrc_filepath": parent_lrc_path,
|
|
157
231
|
"ass_filepath": parent_video_path,
|
|
232
|
+
"countdown_padding_added": countdown_padding_added,
|
|
233
|
+
"countdown_padding_seconds": countdown_padding_seconds,
|
|
234
|
+
"padded_audio_filepath": None, # Original padded audio may not exist
|
|
158
235
|
}
|
|
159
236
|
|
|
160
237
|
# Create lyrics directory if it doesn't exist
|
karaoke_gen/utils/bulk_cli.py
CHANGED
|
@@ -19,6 +19,9 @@ from karaoke_gen.karaoke_finalise import KaraokeFinalise
|
|
|
19
19
|
# Global logger
|
|
20
20
|
logger = logging.getLogger(__name__)
|
|
21
21
|
logger.setLevel(logging.INFO) # Set initial log level
|
|
22
|
+
# Prevent log propagation to root logger to avoid duplicate logs
|
|
23
|
+
# when external packages (like lyrics_converter) configure root logger handlers
|
|
24
|
+
logger.propagate = False
|
|
22
25
|
|
|
23
26
|
|
|
24
27
|
async def process_track_prep(row, args, logger, log_formatter):
|
karaoke_gen/utils/cli_args.py
CHANGED
|
@@ -352,8 +352,10 @@ def create_parser(prog: str = "karaoke-gen") -> argparse.ArgumentParser:
|
|
|
352
352
|
)
|
|
353
353
|
remote_group.add_argument(
|
|
354
354
|
"--review-ui-url",
|
|
355
|
-
default=os.environ.get('REVIEW_UI_URL', 'https://lyrics.nomadkaraoke.com'),
|
|
356
|
-
help="Lyrics review UI URL
|
|
355
|
+
default=os.environ.get('REVIEW_UI_URL', os.environ.get('LYRICS_REVIEW_UI_URL', 'https://lyrics.nomadkaraoke.com')),
|
|
356
|
+
help="Lyrics review UI URL. Default: 'https://lyrics.nomadkaraoke.com'. "
|
|
357
|
+
"Use 'http://localhost:5173' for Vite dev server during development. "
|
|
358
|
+
"(env: REVIEW_UI_URL or LYRICS_REVIEW_UI_URL)",
|
|
357
359
|
)
|
|
358
360
|
remote_group.add_argument(
|
|
359
361
|
"--poll-interval",
|