before_code
stringlengths
14
465k
reviewer_comment
stringlengths
16
64.5k
after_code
stringlengths
9
467k
diff_context
stringlengths
0
97k
file_path
stringlengths
5
226
comment_line
int32
0
26
language
stringclasses
37 values
quality_score
float32
0.07
1
comment_type
stringclasses
9 values
comment_length
int32
16
64.5k
before_lines
int32
1
17.2k
after_lines
int32
1
12.1k
is_negative
bool
2 classes
pr_title
stringlengths
1
308
pr_number
int32
1
299k
repo_name
stringclasses
533 values
repo_stars
int64
321
419k
repo_language
stringclasses
27 values
reviewer_username
stringlengths
0
39
author_username
stringlengths
2
39
return None batch = part_file_list[i:i + batch_size] txt = os.path.join(worker_dir, f'part{part_idx+1}_chunk_{i:04d}.txt') out = os.path.join(worker_dir, f'part{part_idx+1}_chunk_{i:04d}.{default_audio_proc_format}') ...
Performance consideration: Adding maxtasksperchild=1 to the Pool constructor will cause each worker process to be recycled after completing one task. While this can help with memory leaks and ensures clean state, it adds overhead from process creation/destruction. Consider if this is necessary or if a higher value (e.g...
chunk_list = [] for idx, i in enumerate(range(0, len(part_file_list), batch_size)): if session['cancellation_requested']: msg = 'Cancel requested' print(msg) return None ...
@@ -2202,14 +2207,21 @@ def export_audio(ffmpeg_combined_audio:str, ffmpeg_metadata_file:str, ffmpeg_fin for file in batch: path = Path(session['chapters_dir']) / file f.write(f"file '{path.as_posix()}'\n") - ...
lib/core.py
26
Python
1
performance
500
51
51
false
v26.1.15
1,554
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
return False batch = selected_files[i:i + batch_size] txt = os.path.join(worker_dir, f'chunk_{i:04d}.txt') out = os.path.join(worker_dir, f'chunk_{i:04d}.{default_audio_proc_format}') with open(txt, 'w') as f: for fi...
Potential bug: The code attempts to clear the progress_queue, but if progress_queue is None (when session_id is not found in context.progress_queues), this will raise an AttributeError when calling .empty() on None. Consider adding a None check before attempting to clear the queue.
os.makedirs(worker_dir, exist_ok=True) chunk_list = [] for idx, i in enumerate(range(0, len(selected_files), batch_size)): if session['cancellation_requested']: msg = 'Cancel requested' print(msg) return Fals...
@@ -1922,15 +1928,22 @@ def combine_audio_sentences(session_id:str, file:str, start:int, end:int)->bool: with open(txt, 'w') as f: for file in batch: f.write(f"file '{file.replace(os.sep, '/')}'\n") - chunk_list.append((str(txt), str(out), Fa...
lib/core.py
26
Python
0.643
bug
282
51
51
false
v26.1.15
1,554
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
txt = os.path.join(worker_dir, f'part{part_idx+1}_chunk_{i:04d}.txt') out = os.path.join(worker_dir, f'part{part_idx+1}_chunk_{i:04d}.{default_audio_proc_format}') with open(txt, 'w') as f: for file in batch: ...
Critical bug: The final merge job is added to the async_results pool at line 2224, but the final_list file that it depends on is only created and written at lines 2242-2245, which happens after the pool completes. This means the assemble_audio_chunks_worker will try to read a file that doesn't exist yet, causing the fi...
if session['cancellation_requested']: msg = 'Cancel requested' print(msg) return None batch = part_file_list[i:i + batch_size] txt = os.path.join(worker_dir, f'part...
@@ -2202,14 +2207,21 @@ def export_audio(ffmpeg_combined_audio:str, ffmpeg_metadata_file:str, ffmpeg_fin for file in batch: path = Path(session['chapters_dir']) / file f.write(f"file '{path.as_posix()}'\n") - ...
lib/core.py
26
Python
0.643
bug
410
51
51
false
v26.1.15
1,554
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
out = os.path.join(worker_dir, f'chunk_{i:04d}.{default_audio_proc_format}') with open(txt, 'w') as f: for file in batch: f.write(f"file '{file.replace(os.sep, '/')}'\n") chunk_list.append((str(txt), str(out), False, idx)) ...
Critical bug: The final merge job is added to the async_results pool at line 1946, but the final_list file that it depends on is only created and written at lines 1968-1971, which happens after the pool completes. This means the assemble_audio_chunks_worker will try to read a file that doesn't exist yet, causing the fi...
if session['cancellation_requested']: msg = 'Cancel requested' print(msg) return False batch = selected_files[i:i + batch_size] txt = os.path.join(worker_dir, f'chunk_{i:04d}.txt') out = os.path.j...
@@ -1922,15 +1928,22 @@ def combine_audio_sentences(session_id:str, file:str, start:int, end:int)->bool: with open(txt, 'w') as f: for file in batch: f.write(f"file '{file.replace(os.sep, '/')}'\n") - chunk_list.append((str(txt), str(out), Fa...
lib/core.py
26
Python
0.643
bug
410
51
51
false
v26.1.15
1,554
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
batch = selected_files[i:i + batch_size] txt = os.path.join(worker_dir, f'chunk_{i:04d}.txt') out = os.path.join(worker_dir, f'chunk_{i:04d}.{default_audio_proc_format}') with open(txt, 'w') as f: for file in batch: ...
Performance consideration: Adding maxtasksperchild=1 to the Pool constructor will cause each worker process to be recycled after completing one task. While this can help with memory leaks and ensures clean state, it adds overhead from process creation/destruction. Consider if this is necessary or if a higher value (e.g...
chunk_list = [] for idx, i in enumerate(range(0, len(selected_files), batch_size)): if session['cancellation_requested']: msg = 'Cancel requested' print(msg) return False batch = selected_files[i:i + batc...
@@ -1922,15 +1928,22 @@ def combine_audio_sentences(session_id:str, file:str, start:int, end:int)->bool: with open(txt, 'w') as f: for file in batch: f.write(f"file '{file.replace(os.sep, '/')}'\n") - chunk_list.append((str(txt), str(out), Fa...
lib/core.py
26
Python
1
performance
497
51
51
false
v26.1.15
1,554
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
"output_channel": default_output_channel, "output_split": default_output_split, "output_split_hours": default_output_split_hours, "metadata": { "title": None, "creator": None, "contributor": None, "language"...
Changed from multiprocessing.Queue() to self.manager.Queue() for progress tracking. This is a correct improvement as manager-based queues are properly synchronized across processes spawned by the manager, which is particularly important given the change to "spawn" method on macOS. The previous implementation using a pl...
"output_split_hours": default_output_split_hours, "metadata": { "title": None, "creator": None, "contributor": None, "language": None, "identifier": None, "publisher": None, "date": N...
@@ -202,7 +200,7 @@ def set_session(self, session_id:str)->Any: "playback_time": 0, "playback_volume": 0 }, manager=self.manager) - self.progress_queues[session_id] = multiprocessing.Queue() + self.progress_queues[session_id] = self.manager.Queue()
lib/core.py
26
Python
0.5
suggestion
385
51
51
false
v26.1.15
1,554
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
with open(txt, 'w') as f: for file in chapter_files: if session['cancellation_requested']: msg = 'Cancel requested' print(msg) return None path = os.pat...
Potential bug: The code attempts to clear the progress_queue, but if progress_queue is None (when session_id is not found in context.progress_queues), this will raise an AttributeError when calling .empty() on None. Consider adding a None check before attempting to clear the queue. ```suggestion if prog...
generate_ffmpeg_metadata(part_chapters, str(metadata_file), default_audio_proc_format) final_file = Path(session['audiobooks_dir']) / (f"{session['final_name'].rsplit('.', 1)[0]}_part{part_idx+1}.{session['output_format']}" if needs_split else session['final_name']) ...
@@ -2254,7 +2261,32 @@ def export_audio(ffmpeg_combined_audio:str, ffmpeg_metadata_file:str, ffmpeg_fin return None path = os.path.join(session['chapters_dir'], file).replace("\\", "/") f.write(f"file '{path}'\n") - if not ass...
lib/core.py
26
Python
1
bug
564
51
51
false
v26.1.15
1,554
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
elif typ == 'table': table = payload if table in handled_tables: prev_typ = typ continue handled_tables.add(table) rows = table.find_all('tr') if not rows: ...
Magic number: The divisor has been changed from 2 to 1.5, and in another location from 4 to 3. While this appears to adjust the character limits, the reasoning behind these specific values is unclear. Consider adding a comment explaining why these particular values were chosen and what effect they have on the text proc...
if table in handled_tables: prev_typ = typ continue handled_tables.add(table) rows = table.find_all('tr') if not rows: prev_typ = typ continue ...
@@ -974,7 +972,7 @@ def _num_repl(m): prev_typ = typ msg = f'Flattening as raw text…' print(msg)
lib/core.py
26
Python
0.857
suggestion
645
51
51
false
v26.1.15
1,554
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
DependencyError(e) error = f'extract_custom_model asyncio.exceptions.CancelledError: {e}' print(error) except Exception as e: DependencyError(e) error = f'extract_custom_model Exception: {e}' print(error) if session['is_gui_process'...
The return value logic has been inverted. When a new checksum file is created (file doesn't exist), the function now returns False instead of True. This means "not changed" is returned when the file is first created, which appears incorrect. The function should return True to indicate a change has occurred when creatin...
error = f'extract_custom_model Exception: {e}' print(error) if session['is_gui_process']: if os.path.exists(file_src): os.remove(file_src) return None def hash_proxy_dict(proxy_dict)->str: try: data = dict(proxy_dict) except Except...
@@ -372,14 +367,16 @@ def compare_checksums(src_path:str, checksum_path:str, hash_algorithm:str='sha25 if not os.path.exists(checksum_path): with open(checksum_path, 'w', encoding='utf-8') as f: f.write(new_checksum) - return True, None - with open(checksum_path,...
lib/core.py
26
Python
0.857
bug
390
51
51
false
v25.12.33
1,555
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
os.remove(file_src) return None def hash_proxy_dict(proxy_dict)->str: try: data = dict(proxy_dict) except Exception: data = {} data_str = json.dumps(data, sort_keys=True, default=str) return hashlib.md5(data_str.encode("utf-8")).hexdigest() def compare_check...
The return statement at line 379 is indented inside the with block for writing the file. This means the function will return False before the file write operation completes and the context manager closes the file properly. The return statement should be dedented to be at the same level as the else block.
data = dict(proxy_dict) except Exception: data = {} data_str = json.dumps(data, sort_keys=True, default=str) return hashlib.md5(data_str.encode("utf-8")).hexdigest() def compare_checksums(src_path:str, checksum_path:str, hash_algorithm:str='sha256')->tuple[bool, str|None]: try: ...
@@ -372,14 +367,16 @@ def compare_checksums(src_path:str, checksum_path:str, hash_algorithm:str='sha25 if not os.path.exists(checksum_path): with open(checksum_path, 'w', encoding='utf-8') as f: f.write(new_checksum) - return True, None - with open(checksum_path,...
lib/core.py
26
Python
0.5
suggestion
305
51
51
false
v25.12.33
1,555
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
break with Pool(cpu_count(), maxtasksperchild=1) as pool: async_results = [pool.apply_async(assemble_audio_chunks_worker, args=args) for args in chunk_list] async_results.append(pool.apply_async(assemble_audio_chunks_worker,...
The function signature has been changed to remove the session_id and job_id parameters, but inside the function on line 2246, it creates a progress_bar using gr.Progress() without checking if is_gui_process is True. This will fail when called from non-GUI contexts (e.g., CLI mode) because gr.Progress() won't be availab...
def assemble_audio_chunks_worker(txt_file:str, out_file:str, is_gui_process:bool)->bool: def on_progress(p: float)->None: progress(p / 100.0, desc='Assemble') try: total_duration = 0.0 try: with open(txt_file, 'r') as f: for line in f: i...
@@ -2320,11 +2242,15 @@ def assemble_audio_chunks_worker(txt_file:str, out_file:str, is_gui_process:bool except Exception as e: print(f'assemble_audio_chunks_worker() open file {txt_file} Error: {e}') return False + + progress_bar = gr.Progress(track_tqdm=False)
lib/core.py
26
Python
0.857
bug
558
51
51
false
v25.12.33
1,555
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
msg = 'Cancel requested' print(msg) return None batch = part_file_list[i:i + batch_size] txt = os.path.join(worker_dir, f'part{part_idx+1}_chunk_{i:04d}.txt') out =...
The on_progress callback function references 'progress' which is not defined in scope. Line 2225 calls 'progress(p / 100.0, desc='Assemble')' but 'progress' is never defined. This should likely be 'progress_bar' which is created on line 2246, but there's also a sequencing issue since on_progress is defined before progr...
print(msg) return None path = os.path.join(session['chapters_dir'], file).replace("\\", "/") f.write(f"file '{path}'\n") if is_gui_process: progress_bar = gr.Progress(track_tqdm=Fa...
@@ -2301,7 +2219,11 @@ def export_audio(ffmpeg_combined_audio:str, ffmpeg_metadata_file:str, ffmpeg_fin DependencyError(e) return None -def assemble_audio_chunks_worker(txt_file:str, out_file:str, is_gui_process:bool, session_id:str, job_id:int|None=None)->bool: +def assemble_audio_chunks_worker(txt...
lib/core.py
26
Python
0.5
suggestion
328
51
51
false
v25.12.33
1,555
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
return None return sentences return None except Exception as e: error = f'filter_chapter() error: {e}' DependencyError(error) return None def get_sentences(text:str, session_id:str)->list|None: def split_inclusive(text:str, pattern:re.Pattern[str])->...
The is_latin_only function has a logical flaw. It returns True only when text has Latin characters AND no non-Latin characters. However, the regex pattern '[^\x00-\x7F]' matches any non-ASCII character, which includes accented Latin characters like é, ñ, ü that are common in European languages. This means text with acc...
def get_sentences(text:str, session_id:str)->list|None: def split_inclusive(text:str, pattern:re.Pattern[str])->list[str]: result = [] last_end = 0 for match in pattern.finditer(text): result.append(text[last_end:match.end()].strip()) last_end = match.end() ...
@@ -1094,6 +1087,13 @@ def strip_sml(s:str)->str: def clean_len(s:str)->int: return len(strip_sml(s)) + def is_latin_only(s:str)->bool: + s = strip_sml(s) + s = re.sub(r'[^\w\s]', '', s, flags=re.UNICODE) + has_latin = bool(re.search(r'[A-Za-z]', s)) + has_nonlatin = bool(...
lib/core.py
26
Python
0.857
bug
716
51
51
false
v25.12.33
1,555
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
prev = merge_list[-1] if clean_len(prev) + cur_len <= max_chars: merge_list[-1] = prev.rstrip() + " " + s.lstrip() i += 1 continue # 2) Try forward merge if i + 1 < n: ...
In the cascading forward merge logic, when no forward merge is possible (line 1271 break), the code tries backward merge with merge_list[-1]. If the backward merge succeeds, it sets i = j (line 1277). However, if the backward merge fails, it appends cur and still sets i = j (line 1280). This means elements between i+1 ...
continue cur_len = clean_len(cur) # Cascading forward merge for short rows if cur_len <= merge_max_chars: j = i + 1 while j < n: nxt = last_list[j].strip() if not nxt: j +=...
@@ -1244,31 +1250,39 @@ def join_ideogramms(idg_list:list[str])->str: i = 0 n = len(last_list) while i < n: - s = last_list[i].strip() - if not s: + cur = last_list[i].strip() + if not cur: i += 1 continue - ...
lib/core.py
26
Python
0.5
bug
478
51
51
false
v25.12.33
1,555
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
"TACOTRON2": "tacotron", "YOURTTS": "yourtts" } TTS_VOICE_CONVERSION = { "freevc24": {"path": "voice_conversion_models/multilingual/vctk/freevc24", "samplerate": 24000}, "knnvc": {"path": "voice_conversion_models/multilingual/multi-dataset/knnvc", "samplerate": 16000}, "openvoice_v1": {"pat...
The SML pattern has been updated to use double characters (‡‡ and [[]]) but the regex pattern for matching values appears inconsistent. The pattern uses "[^\]‡]+" which will match characters that are not "]" or "‡" (single dagger), but the actual tokens now use "‡‡" (double daggers). This mismatch could cause the patte...
"TACOTRON2": "tacotron", "YOURTTS": "yourtts" } TTS_VOICE_CONVERSION = { "freevc24": {"path": "voice_conversion_models/multilingual/vctk/freevc24", "samplerate": 24000}, "knnvc": {"path": "voice_conversion_models/multilingual/multi-dataset/knnvc", "samplerate": 16000}, "openvoice_v1": {"pat...
@@ -29,14 +31,13 @@ sml_tag_keys = '|'.join(map(re.escape, TTS_SML.keys())) SML_TAG_PATTERN = re.compile( - rf'(?:‡|\[' - rf')(?P<close>/)?' + rf'(?:\[\[|‡‡)' + rf'(?P<close>/)?' rf'(?P<tag>{sml_tag_keys})' rf'(?:\:(?P<value>[^\]‡]+))?'
lib/conf_models.py
26
Python
0.857
bug
434
51
51
false
v25.12.33
1,555
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
tokens = segment_ideogramms(part) if isinstance(tokens, list): result.extend([t for t in tokens if t.strip()]) else: tokens = tokens.strip() if tokens: result.a...
The filter is_latin_only(s) is applied after join_ideogramms, which filters out results. However, based on the function name and logic, this appears to filter OUT latin-only segments, which seems backwards. For CJK language processing, you'd typically want to keep CJK text and potentially filter out pure Latin text, bu...
s = break_between_alnum_re.sub(' ', s) final_list.append(s) if lang in ['zho', 'jpn', 'kor', 'tha', 'lao', 'mya', 'khm']: result = [] for s in final_list: parts = re.split(default_frontend_sml_pattern, s) for part in parts: ...
@@ -1302,7 +1316,11 @@ def join_ideogramms(idg_list:list[str])->str: tokens = tokens.strip() if tokens: result.append(tokens) - return list(join_ideogramms(result)) + joined = [] + for s in join_ideogramms(re...
lib/core.py
26
Python
0.429
suggestion
393
51
51
false
v25.12.33
1,555
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
default_jetson_url = 'https://www.e-blokos.com/whl/jetson' # TODO: find a definitive place where to upload the jetpack5 torch jetson_torch_version_base = { "jetson60": "2.4.0", "jetson61": "2.5.0" } torch_matrix = { # CUDA "cu118": {"url": default_pytorch_url}, "cu121": {"url": default...
ROCm 6.4 support has been removed from torch_matrix. However, the rocm_version_range still shows max version as (6,3), which is now correct after this removal. But the comment suggests 6.4 was previously supported. If ROCm 6.4 is still a valid/released version, removing support without explanation could break installat...
default_jetson_url = 'https://www.e-blokos.com/whl/jetson' # TODO: find a permanent website where to upload the jetpack torch torch_matrix = { # CUDA "cu118": {"url": default_pytorch_url, "base": "2.7.1"}, "cu121": {"url": default_pytorch_url, "base": "2.5.1"}, "cu124": {"url": default_pytorch_ur...
@@ -90,49 +90,36 @@ default_py_minor = sys.version_info.minor default_pytorch_url = 'https://download.pytorch.org/whl' -default_jetson_url = 'https://www.e-blokos.com/whl/jetson' # TODO: find a definitive place where to upload the jetpack5 torch - -jetson_torch_version_base = { - "jetson60": "2.4.0", - ...
lib/conf.py
26
Python
0.857
suggestion
629
51
51
false
v25.12.33
1,555
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
if r.ready(): results.append(r.get()) async_results.remove(r) if not all(results): error = f'assemble_audio_chunks_worker() One or more chunks failed for part {part_idx+1}....
The '-nostats' flag is included twice in the FFmpeg command (lines 2251 and 2260). This is redundant and should be removed from one of the locations. ```suggestion ```
.split('file ')[1] .strip() .strip("'") .strip('"') ) if os.path.exists(file_path): total_duration += get_audio_duration(file_path) ...
@@ -2334,16 +2260,12 @@ def assemble_audio_chunks_worker(txt_file:str, out_file:str, is_gui_process:bool '-nostats',
lib/core.py
26
Python
0.786
suggestion
168
51
51
false
v25.12.33
1,555
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
os.remove(file_src) return None def hash_proxy_dict(proxy_dict)->str: try: data = dict(proxy_dict) except Exception: data = {} data_str = json.dumps(data, sort_keys=True, default=str) return hashlib.md5(data_str.encode("utf-8")).hexdigest() def compare_check...
The return value logic has been inverted. When checksums match (saved_checksum == new_checksum), the function now returns True, but based on the function name "compare_checksums" and the original logic, this should return False (no change). Conversely, when checksums don't match, it returns False but should return True...
data = dict(proxy_dict) except Exception: data = {} data_str = json.dumps(data, sort_keys=True, default=str) return hashlib.md5(data_str.encode("utf-8")).hexdigest() def compare_checksums(src_path:str, checksum_path:str, hash_algorithm:str='sha256')->tuple[bool, str|None]: try: ...
@@ -372,14 +367,16 @@ def compare_checksums(src_path:str, checksum_path:str, hash_algorithm:str='sha25 if not os.path.exists(checksum_path): with open(checksum_path, 'w', encoding='utf-8') as f: f.write(new_checksum) - return True, None - with open(checksum_path,...
lib/core.py
26
Python
0.5
bug
412
51
51
false
v25.12.33
1,555
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
import os, regex as re from lib.conf import tts_dir, voices_dir loaded_tts = {} xtts_builtin_speakers_list = {} TTS_ENGINES = { "XTTSv2": "xtts", "BARK": "bark", "VITS": "vits", "FAIRSEQ": "fairseq", "TACOTRON2": "tacotron", "YOURTTS": "yourtts" } TTS_VOICE_CONVERSION = { ...
The default_frontend_sml_pattern regex uses single daggers "(‡[^‡]+‡)" in the old code but has been updated to double daggers "(‡‡[^‡]+‡‡)" on line 23. However, the character class "[^‡]+" still only excludes single daggers, not the double-dagger sequence. This should be "[^‡]+" to properly match content between double...
import os, regex as re from lib.conf import tts_dir, voices_dir loaded_tts = {} xtts_builtin_speakers_list = {} TTS_ENGINES = { "XTTSv2": "xtts", "BARK": "bark", "VITS": "vits", "FAIRSEQ": "fairseq", "TACOTRON2": "tacotron", "YOURTTS": "yourtts" } TTS_VOICE_CONVERSION = { ...
@@ -20,6 +20,8 @@ "openvoice_v2": {"path": "voice_conversion_models/multilingual/multi-dataset/openvoice_v2", "samplerate": 22050} } +default_frontend_sml_pattern = re.compile(r'(###|‡‡[^‡]+‡‡)')
lib/conf_models.py
23
Python
0.5
suggestion
405
48
48
false
v25.12.33
1,555
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
result.extend(nagisa.tagging(text).words) elif lang == 'kor': from soynlp.tokenizer import LTokenizer ltokenizer = LTokenizer() result.extend([t for t in ltokenizer.tokenize(text) if t.strip()]) elif lang in ['tha','lao','mya','khm'...
The logic for adding spaces in join_ideogramms has a potential issue. When prev_latin is True and cur_starts_nonlatin is True, a space is added. However, this may not be appropriate for all CJK scripts. For example, between Latin text and Chinese characters, adding a space might be desired, but the condition doesn't ch...
result.extend(nagisa.tagging(text).words) elif lang == 'kor': from soynlp.tokenizer import LTokenizer ltokenizer = LTokenizer() result.extend([t for t in ltokenizer.tokenize(text) if t.strip()]) elif lang in ['tha','lao','mya','khm'...
@@ -1140,14 +1140,20 @@ def segment_ideogramms(text:str)->list[str]: def join_ideogramms(idg_list:list[str])->str: try: buffer = '' + prev_latin = False + prev_nonlatin = False for token in idg_list: - # If adding this token would overflow, fl...
lib/core.py
26
Python
0.643
suggestion
418
51
51
false
v25.12.33
1,555
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
session['custom_model_dir'] = os.path.join(models_dir, '__sessions',f"model-{session['id']}") if session['custom_model'] is not None: if not os.path.exists(session['custom_model_dir']): os.makedirs(session['custom_model_dir'], e...
The condition has been inverted from "if checksum:" to "if not checksum:". Given the bug in compare_checksums where the return values are inverted, this might be an attempt to compensate, but it creates confusion. The logic should be fixed in compare_checksums itself rather than inverting conditions at call sites.
elif session['device'] == devices['XPU']['proc']: session['device'] = session['device'] if devices['XPU']['found'] else devices['CPU']['proc'] if session['device'] == devices['CPU']['proc']: m...
@@ -2633,10 +2556,11 @@ def convert_ebook(args:dict)->tuple: show_alert({"type": "warning", "msg": msg}) print(msg.replace('<br/>','\n')) session['epub_path'] = os.path.join(session['process_dir'], f"__{session['filen...
lib/core.py
26
Python
0.643
bug
315
51
51
false
v25.12.33
1,555
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
if tag == "###": return " ‡pause‡ " if close: return f" ‡/{tag}‡ " if value: return f" ‡{tag}:{value}‡ " return f" ‡{tag}‡ " return SML_TAG_PATTERN.sub(check_sml, text) def sml_token(tag:str, value:str|None=None, close:bool=False)->str: i...
The SML token format has been changed from single daggers (‡) to double daggers (‡‡). However, the patterns need to be carefully verified for consistency. The filter_sml function now uses "‡‡" but the original pattern may still be looking for single daggers in some places, which could cause SML tokens to not be properl...
for i, t in enumerate(buf): if i == 0: out += t else: if re.match(r"^\w+$", buf[i - 1]) and re.match(r"^\w+$", t): out += ' ' + t else: out += t for k, v in protected.items(): out = out.replace(k, v) return out def ...
@@ -1696,28 +1714,29 @@ def romanize(word:str)->str: def filter_sml(text:str)->str: - def check_sml(m): + def check_sml(m:re.Match[str])->str: tag = m.group("tag") close = m.group("close") value = m.group("value") + assert tag in TTS_SML, f"Unknown SML tag: {tag!r}" ...
lib/core.py
26
Python
0.5
style
345
51
51
false
v25.12.33
1,555
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
continue tokens = segment_ideogramms(part) if isinstance(tokens, list): result.extend([t for t in tokens if t.strip()]) else: tokens = tokens.strip() if tokens: ...
Filtering out Latin-only text in CJK text processing may remove legitimate English words, phrases, or sentences that appear in mixed-language content. For example, book titles, names, technical terms, or code snippets in English would be removed from Chinese/Japanese/Korean text. Consider whether this filtering is inte...
s = strip_break_spaces_re.sub(sml_token('break'), s) s = break_between_alnum_re.sub(' ', s) final_list.append(s) if lang in ['zho', 'jpn', 'kor', 'tha', 'lao', 'mya', 'khm']: result = [] for s in final_list: parts = re.split(default_fr...
@@ -1302,7 +1316,11 @@ def join_ideogramms(idg_list:list[str])->str: tokens = tokens.strip() if tokens: result.append(tokens) - return list(join_ideogramms(result)) + joined = [] + for s in join_ideogramms(re...
lib/core.py
26
Python
0.857
suggestion
664
51
51
false
v26.1.16
1,556
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
ltokenizer = LTokenizer() result.extend([t for t in ltokenizer.tokenize(text) if t.strip()]) elif lang in ['tha','lao','mya','khm']: from pythainlp.tokenize import word_tokenize result.extend([t for t in word_tokenize(text, engine='newmm') if t...
The space insertion logic has an asymmetry that could cause issues. When prev_latin is true, a space is added regardless of whether cur_starts_latin or cur_starts_nonlatin. However, when prev_nonlatin is true, a space is only added if cur_starts_latin. This means transitioning from nonlatin to nonlatin characters won't...
ltokenizer = LTokenizer() result.extend([t for t in ltokenizer.tokenize(text) if t.strip()]) elif lang in ['tha','lao','mya','khm']: from pythainlp.tokenize import word_tokenize result.extend([t for t in word_tokenize(text, engine='newmm') if t...
@@ -1140,14 +1140,20 @@ def segment_ideogramms(text:str)->list[str]: def join_ideogramms(idg_list:list[str])->str: try: buffer = '' + prev_latin = False + prev_nonlatin = False for token in idg_list: - # If adding this token would overflow, fl...
lib/core.py
26
Python
0.857
suggestion
1,192
51
51
false
v26.1.16
1,556
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
if r.ready(): results.append(r.get()) async_results.remove(r) if not all(results): error = f'assemble_audio_chunks_worker() One or more chunks failed for part {part_idx+1}....
The -nostats flag is specified twice in the ffmpeg command (at lines 2251 and 2260). The duplicate flag should be removed. ```suggestion ```
.split('file ')[1] .strip() .strip("'") .strip('"') ) if os.path.exists(file_path): total_duration += get_audio_duration(file_path) ...
@@ -2334,16 +2260,12 @@ def assemble_audio_chunks_worker(txt_file:str, out_file:str, is_gui_process:bool '-nostats',
lib/core.py
26
Python
0.786
refactor
141
51
51
false
v26.1.16
1,556
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
os.remove(file_src) return None def hash_proxy_dict(proxy_dict)->str: try: data = dict(proxy_dict) except Exception: data = {} data_str = json.dumps(data, sort_keys=True, default=str) return hashlib.md5(data_str.encode("utf-8")).hexdigest() def compare_check...
The return values of this function have been inverted, which breaks the checksum logic. The function now returns False when the file should be converted (first run or checksum changed) and True when it shouldn't be converted (checksum matches). This is the opposite of what the caller expects at line 2563 where the code...
data = dict(proxy_dict) except Exception: data = {} data_str = json.dumps(data, sort_keys=True, default=str) return hashlib.md5(data_str.encode("utf-8")).hexdigest() def compare_checksums(src_path:str, checksum_path:str, hash_algorithm:str='sha256')->tuple[bool, str|None]: try: ...
@@ -372,14 +367,16 @@ def compare_checksums(src_path:str, checksum_path:str, hash_algorithm:str='sha25 if not os.path.exists(checksum_path): with open(checksum_path, 'w', encoding='utf-8') as f: f.write(new_checksum) - return True, None - with open(checksum_path,...
lib/core.py
26
Python
0.5
suggestion
664
51
51
false
v26.1.16
1,556
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
"TACOTRON2": "tacotron", "YOURTTS": "yourtts" } TTS_VOICE_CONVERSION = { "freevc24": {"path": "voice_conversion_models/multilingual/vctk/freevc24", "samplerate": 24000}, "knnvc": {"path": "voice_conversion_models/multilingual/multi-dataset/knnvc", "samplerate": 16000}, "openvoice_v1": {"pat...
The value capture group in the regex pattern `[^\]‡]+` will match characters that are not `]` or single `‡`, but the new SML format uses double `‡‡` as delimiters. This means the pattern could incorrectly match through a single `‡` character. The pattern should be updated to `[^\]]+` if using `[[...]]` brackets, or nee...
"TACOTRON2": "tacotron", "YOURTTS": "yourtts" } TTS_VOICE_CONVERSION = { "freevc24": {"path": "voice_conversion_models/multilingual/vctk/freevc24", "samplerate": 24000}, "knnvc": {"path": "voice_conversion_models/multilingual/multi-dataset/knnvc", "samplerate": 16000}, "openvoice_v1": {"pat...
@@ -29,14 +31,13 @@ sml_tag_keys = '|'.join(map(re.escape, TTS_SML.keys())) SML_TAG_PATTERN = re.compile( - rf'(?:‡|\[' - rf')(?P<close>/)?' + rf'(?:\[\[|‡‡)' + rf'(?P<close>/)?' rf'(?P<tag>{sml_tag_keys})' rf'(?:\:(?P<value>[^\]‡]+))?'
lib/conf_models.py
26
Python
0.857
bug
465
51
51
false
v26.1.16
1,556
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
if session['is_gui_process']: if os.path.exists(file_src): os.remove(file_src) return None def hash_proxy_dict(proxy_dict)->str: try: data = dict(proxy_dict) except Exception: data = {} data_str = json.dumps(data, sort_keys=True, default=str) ...
The return statement is indented inside the else block where the checksum file is written. This means when checksums differ and the file is updated, the function returns `(False, None)` indicating no change occurred, which is incorrect. The return should be outside the `with` block or the logic should return `(True, No...
data = dict(proxy_dict) except Exception: data = {} data_str = json.dumps(data, sort_keys=True, default=str) return hashlib.md5(data_str.encode("utf-8")).hexdigest() def compare_checksums(src_path:str, checksum_path:str, hash_algorithm:str='sha256')->tuple[bool, str|None]: try: ...
@@ -374,14 +367,16 @@ def compare_checksums(src_path:str, checksum_path:str, hash_algorithm:str='sha25 if not os.path.exists(checksum_path): with open(checksum_path, 'w', encoding='utf-8') as f: f.write(new_checksum) - return True, None - with open(checksum_path,...
lib/core.py
26
Python
0.643
bug
362
51
51
false
v26.1.16
1,557
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
jetson_torch_version_base = { "jetson60": "2.4.0", "jetson61": "2.5.0" } torch_matrix = { # CUDA "cu118": {"url": default_pytorch_url}, "cu121": {"url": default_pytorch_url}, "cu124": {"url": default_pytorch_url}, "cu126": {"url": default_pytorch_url}, "cu128": {"url": de...
The maximum ROCm version range has been reduced from (6,4) to (6,3), but `torch_matrix` still includes 'rocm6.2.4' which falls outside this range. Either the range should be updated to (6,4) or the rocm6.2.4 entry should be removed from the matrix.
torch_matrix = { # CUDA "cu118": {"url": default_pytorch_url, "base": "2.7.1"}, "cu121": {"url": default_pytorch_url, "base": "2.5.1"}, "cu124": {"url": default_pytorch_url, "base": "2.6.0"}, "cu126": {"url": default_pytorch_url, "base": "2.7.1"}, "cu128": {"url": default_pytorch_url, "b...
@@ -90,49 +90,36 @@ default_py_minor = sys.version_info.minor default_pytorch_url = 'https://download.pytorch.org/whl' -default_jetson_url = 'https://www.e-blokos.com/whl/jetson' # TODO: find a definitive place where to upload the jetpack5 torch - -jetson_torch_version_base = { - "jetson60": "2.4.0", - ...
lib/conf.py
26
Python
0.643
suggestion
248
51
51
false
v26.1.16
1,557
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
if session['script_mode'] == NATIVE: is_installed = check_programs('Calibre', 'ebook-convert', '--version') if not is_installed: error = f'check_programs() Calibre failed: {e}' is_installed = check_pr...
The logic is inverted. When `compare_checksums` returns `True` (checksum matches), conversion should be skipped. When it returns `False` (no match/new file), conversion is needed. The condition should be `if checksum:` to skip conversion when checksums match.
elif session['device'] == devices['XPU']['proc']: session['device'] = session['device'] if devices['XPU']['found'] else devices['CPU']['proc'] if session['device'] == devices['CPU']['proc']: m...
@@ -2601,10 +2556,11 @@ def convert_ebook(args:dict)->tuple: show_alert({"type": "warning", "msg": msg}) print(msg.replace('<br/>','\n')) session['epub_path'] = os.path.join(session['process_dir'], f"__{session['filen...
lib/core.py
26
Python
0.643
suggestion
259
51
51
false
v26.1.16
1,557
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
voice_dir=pth_voice_dir, **fine_tuned_params ) self.engine.to(devices['CPU']['proc']) del result msg = f"Saved file: {pth_voice_file}" ...
Debug print statement should be removed before merging to production. This appears to be leftover debugging code that will pollute logs during normal operation. ```suggestion ```
voice_dir=pth_voice_dir, **fine_tuned_params ) self.engine.to(devices['CPU']['proc']) del result msg = f"Saved file: {pth_voice_file}" ...
@@ -132,7 +132,8 @@ def convert(self, sentence_index:int, sentence:str)->bool: self.audio_segments = [] for part in sentence_parts: part = part.strip() - if not part: + print(f'part: ------------{part}----------')
lib/classes/tts_engines/bark.py
26
Python
0.929
bug
179
51
51
false
v25.12.33
1,558
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
voice_dir=pth_voice_dir, **fine_tuned_params ) self.engine.to(devices['CPU']['proc']) del result msg = f"Saved file: {pth_voice_file}" ...
Debug print statement should be removed before merging. This appears to be temporary debugging code that was left in the codebase and will pollute the application logs with unnecessary output. ```suggestion ```
voice_dir=pth_voice_dir, **fine_tuned_params ) self.engine.to(devices['CPU']['proc']) del result msg = f"Saved file: {pth_voice_file}" ...
@@ -132,7 +132,8 @@ def convert(self, sentence_index:int, sentence:str)->bool: self.audio_segments = [] for part in sentence_parts: part = part.strip() - if not part: + print(f'part: ------------{part}----------')
lib/classes/tts_engines/bark.py
26
Python
1
bug
211
51
51
false
v26.1.16
1,559
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
voice_dir=pth_voice_dir, **fine_tuned_params ) self.engine.to(devices['CPU']['proc']) del result msg = f"Saved file: {pth_voice_file}" ...
Debug print statement should be removed before merging to production. This will clutter the logs with debugging output for every text part being processed. ```suggestion ```
voice_dir=pth_voice_dir, **fine_tuned_params ) self.engine.to(devices['CPU']['proc']) del result msg = f"Saved file: {pth_voice_file}" ...
@@ -132,7 +132,8 @@ def convert(self, sentence_index:int, sentence:str)->bool: self.audio_segments = [] for part in sentence_parts: part = part.strip() - if not part: + print(f'part: ------------{part}----------')
lib/classes/tts_engines/bark.py
26
Python
0.929
bug
174
51
51
false
v26.1.16
1,560
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
DependencyError(e) error = f'convert_chapters2audio() error: {e}' print(error) return False def combine_audio_sentences(session_id:str, file:str, start:int, end:int)->bool: try: session = context.get_session(session_id) if session and session.get('id'...
There is a typo in the function name. The function is called 'assemble_audio_chunksr' but it should be 'assemble_audio_chunks_worker' or a similar meaningful name. The trailing 'r' appears to be a typo. ```suggestion result = assemble_audio_chunks_worker(concat_list, chapter_audio_file, is_gui_process) ```
def combine_audio_sentences(session_id:str, file:str, start:int, end:int)->bool: try: session = context.get_session(session_id) if session and session.get('id', False): chapter_audio_file = os.path.join(session['chapters_dir'], file) sentences_dir = session['sentences_dir'] ...
@@ -1943,17 +1939,16 @@ def combine_audio_sentences(session_id:str, file:str, start:int, end:int)->bool: if not selected_files: print('No audio files found in the specified range.') return False - worker_dir = session['sentences_worker_dir'] - os.make...
lib/core.py
26
Python
0.857
suggestion
319
51
51
false
v25.12.33 Legacy
1,569
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
f.write(f"file '{path.as_posix()}'\n") combined_chapters_file = Path(session['process_dir']) / (f"{get_sanitized(session['metadata']['title'])}_part{part_idx+1}.{default_audio_proc_format}" if needs_split else f"{get_sanitized(session['metadata']['title'])}.{default_audio...
There is a typo in the function name. The function is called 'assemble_audio_chunksr' but it should be 'assemble_audio_chunks_worker' or a similar meaningful name. The trailing 'r' appears to be a typo.
if not result: error = f'assemble_audio_chunksr() Final merge failed for part {part_idx+1}.' print(error) return None metadata_file = Path(session['process_dir']) / f'metadata_part{part_idx+1}.txt' ...
@@ -2215,29 +2212,30 @@ def export_audio(ffmpeg_combined_audio:str, ffmpeg_metadata_file:str, ffmpeg_fin f.write(f"file '{path}'\n") if is_gui_process: progress_bar = gr.Progress(track_tqdm=False) - ok = assemble_audio_chunks_worker(concat_li...
lib/core.py
26
Python
0.5
suggestion
202
51
51
false
v25.12.33 Legacy
1,569
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
concat_list = os.path.join(worker_dir, 'all_chapters.txt') merged_tmp = os.path.join(worker_dir, f'all.{default_audio_proc_format}') with open(concat_list, 'w') as f: for file in chapter_files: if session['cancellation_requested...
There is a typo in the function name. The function is called 'assemble_audio_chunksr' but it should be 'assemble_audio_chunks_worker' or a similar meaningful name. The trailing 'r' appears to be a typo.
for file in chapter_files: if session['cancellation_requested']: msg = 'Cancel requested' print(msg) return None path = os.path.join(session['chapters_dir'], file).repl...
@@ -2215,29 +2212,30 @@ def export_audio(ffmpeg_combined_audio:str, ffmpeg_metadata_file:str, ffmpeg_fin f.write(f"file '{path}'\n") if is_gui_process: progress_bar = gr.Progress(track_tqdm=False) - ok = assemble_audio_chunks_worker(concat_li...
lib/core.py
26
Python
0.5
suggestion
202
51
51
false
v25.12.33 Legacy
1,569
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
import torch, subprocess, shutil, json, numpy as np from torch import Tensor from typing import Any, Union from scipy.io import wavfile as wav from scipy.signal import find_peaks from lib.classes.subprocess_pipe import SubprocessPipe def detect_gender(voice_path:str)->str|None: try: samplerate, signal = ...
Inconsistent indentation: tabs are used instead of spaces. Python style guide (PEP 8) recommends using spaces for indentation. This should use 4 spaces per indentation level to be consistent with the rest of the codebase. ```suggestion mediainfo = shutil.which("mediainfo") cmd = [ mediainfo, "--...
for item in data: media = item.get("media", {}) ref = media.get("@ref") audio_duration = None general_duration = None for track in media.get("track", []): track_type = track.get("@type") if track_type == "Audio" and "Duration" in track: audio_duration = float(track["Duration"]) elif tr...
@@ -58,27 +58,74 @@ def trim_audio(audio_data: Union[list[float], Tensor], samplerate: int, silence_ def get_audio_duration(filepath:str)->float: try: - ffprobe_cmd = [ - shutil.which('ffprobe'), - '-v', 'error', - '-show_entries', 'format=duration', - '-of', '...
lib/classes/tts_engines/common/audio.py
26
Python
1
suggestion
1,594
122
51
false
v25.12.33 Legacy
1,569
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
local cmd_extra="" local py_vers="$PYTHON_VERSION" case "$TAG" in cpu) cmd_options="";; cu*) cmd_options="--gpus all" ;; rocm*) cmd_options="--device=/dev/kfd --device=/dev/dri" ;; jetson*) cmd_options="--runtime nvidia --gpus all"; py_vers="3.10" ;; xpu) cmd_options="--device=/dev/dri" ;; mps) cmd_...
The podman-compose check is duplicated on line 740 and 741. This appears to be a copy-paste error where the same condition 'command -v podman-compose >/dev/null 2>&1' is checked twice. ```suggestion if ! podman-compose -f podman-compose.yml config >/dev/null 2>&1; then echo "ERROR: podman-compose.yml is not valid"...
local cmd_options="" local cmd_extra="" local py_vers="$PYTHON_VERSION" case "$TAG" in cpu) cmd_options="";; cu*) cmd_options="--gpus all" ;; rocm*) cmd_options="--device=/dev/kfd --device=/dev/dri" ;; jetson*) cmd_options="--runtime nvidia --gpus all"; py_vers="3.10" ;; xpu) cmd_options="--device=/de...
@@ -736,7 +737,30 @@ function build_docker_image { *) COMPOSE_PROFILES=gpu ;; esac export COMPOSE_PROFILES - if docker compose version >/dev/null 2>&1; then + if command -v podman-compose >/dev/null 2>&1; then + if command -v podman-compose >/dev/null 2>&1; then + if ! podman-compose -f podman-compose...
ebook2audiobook.sh
26
Shell
0.929
refactor
336
51
51
false
v25.12.33 Legacy
1,569
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
os.makedirs(session['custom_model_dir'], exist_ok=True) os.makedirs(session['voice_dir'], exist_ok=True) if is_gui_shared: msg = f' Note: access limit time: {interface_shared_tmp_expire} days' session['audio...
The condition may not work as intended when 'context.get_session()' returns an empty dict (as defined in line 204 of core.py). An empty dict is truthy in Python, but 'session.get('id', False)' will return False, making the condition always True for non-existent sessions that return an empty dict. Consider checking 'if ...
os.makedirs(session['custom_model_dir'], exist_ok=True) os.makedirs(session['voice_dir'], exist_ok=True) if is_gui_shared: msg = f' Note: access limit time: {interface_shared_tmp_expire} days' session['audio...
@@ -1754,7 +1754,7 @@ def change_gr_restore_session(data:DictProxy|None, state:dict, req:gr.Request)-> async def update_gr_save_session(session_id:str, state:dict)->tuple: try: session = context.get_session(session_id) - if not session or not isinsta...
lib/gradio.py
26
Python
0.857
suggestion
445
51
51
false
v25.12.33 Legacy
1,569
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
for idx, (file, dur) in enumerate(zip(chapter_files, durations)): if session['cancellation_requested']: msg = 'Cancel requested' print(msg) return None if cur_part and (cur_duration + dur > ma...
There is a typo in the function name. The function is called 'assemble_audio_chunksr' but it should be 'assemble_audio_chunks_worker' or a similar meaningful name. The trailing 'r' appears to be a typo.
print(msg) return None if cur_part and (cur_duration + dur > max_part_duration): part_files.append(cur_part) part_chapter_indices.append(cur_indices) cur_part = [] ...
@@ -2190,21 +2187,21 @@ def export_audio(ffmpeg_combined_audio:str, ffmpeg_metadata_file:str, ffmpeg_fin return None path = Path(session['chapters_dir']) / file f.write(f"file '{path.as_posix()}'\n") - combined...
lib/core.py
26
Python
0.5
suggestion
202
51
51
false
v25.12.33 Legacy
1,569
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
msg = 'Cancel requested' print(msg) return None if cur_part and (cur_duration + dur > max_part_duration): part_files.append(cur_part) part_chapter_indices.append(cur_indices) ...
There is a typo in the function name. The function is called 'assemble_audio_chunksr' but it should be 'assemble_audio_chunks_worker' or a similar meaningful name. The trailing 'r' appears to be a typo.
if cur_part and (cur_duration + dur > max_part_duration): part_files.append(cur_part) part_chapter_indices.append(cur_indices) cur_part = [] cur_indices = [] cur_duration = 0 ...
@@ -2190,21 +2187,21 @@ def export_audio(ffmpeg_combined_audio:str, ffmpeg_metadata_file:str, ffmpeg_fin return None path = Path(session['chapters_dir']) / file f.write(f"file '{path.as_posix()}'\n") - combined...
lib/core.py
26
Python
0.5
suggestion
202
51
51
false
v25.12.33 Legacy
1,569
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
return None path = Path(session['chapters_dir']) / file f.write(f"file '{path.as_posix()}'\n") combined_chapters_file = Path(session['process_dir']) / (f"{get_sanitized(session['metadata']['title'])}_part{part_id...
There is a typo in the function name. The function is called 'assemble_audio_chunksr' but it should be 'assemble_audio_chunks_worker' or a similar meaningful name. The trailing 'r' appears to be a typo.
merged_audio = Path(session['process_dir']) / (f"{get_sanitized(session['metadata']['title'])}_part{part_idx+1}.{default_audio_proc_format}" if needs_split else f"{get_sanitized(session['metadata']['title'])}.{default_audio_proc_format}") result = assemble_audio_chunksr(str(conca...
@@ -2215,29 +2212,30 @@ def export_audio(ffmpeg_combined_audio:str, ffmpeg_metadata_file:str, ffmpeg_fin f.write(f"file '{path}'\n") if is_gui_process: progress_bar = gr.Progress(track_tqdm=False) - ok = assemble_audio_chunks_worker(concat_li...
lib/core.py
26
Python
0.5
suggestion
202
51
51
false
v25.12.33 Legacy
1,569
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
def assemble_audio_chunks_worker(txt_file:str, out_file:str, is_gui_process:bool)->bool: def on_progress(p: float)->None: progress_bar(p / 100.0, desc='Assemble') try: total_duration = 0.0 try: with open(txt_file, 'r') as f: for line in f: ...
There is a typo in the function name. The function is called 'assemble_audio_chunksr' but it should be 'assemble_audio_chunks_worker' or a similar meaningful name. The trailing 'r' appears to be a typo.
def on_progress(p: float)->None: progress_bar(p / 100.0, desc='Assemble') try: total_duration = 0.0 filepaths = [] try: with open(txt_file, 'r') as f: for line in f: if line.strip().startswith('file'): file_...
@@ -2250,9 +2248,14 @@ def on_progress(p: float)->None: .strip('"') ) if os.path.exists(file_path): - total_duration += get_audio_duration(file_path) + filepaths.append(file_path) + ...
lib/core.py
26
Python
0.5
suggestion
202
51
51
false
v25.12.33 Legacy
1,569
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
'-nostats', out_file, ] proc_pipe = SubprocessPipe( cmd=cmd, is_gui_process=is_gui_process, total_duration=total_duration, msg='Assemble', on_progress=on_progress ) if proc_pipe: msg = f'Compl...
There is a typo in the function name. The function is called 'assemble_audio_chunksr' but it should be 'assemble_audio_chunks_worker' or a similar meaningful name. The trailing 'r' appears to be a typo.
'-map_metadata', '-1', '-threads', '0', '-progress', 'pipe:2', '-nostats', out_file, ] proc_pipe = SubprocessPipe( cmd=cmd, is_gui_process=is_gui_process, total_duration=total_duration, msg='Assem...
@@ -2291,7 +2294,7 @@ def on_progress(p: float)->None: DependencyError(e) return False except Exception as e: - error = f'assemble_audio_chunks_worker() Error: Failed to process {txt_file} → {out_file}: {e}' + error = f'assemble_audio_chunksr() Error: Failed to process {txt_file} → ...
lib/core.py
26
Python
0.5
suggestion
202
51
51
false
v25.12.33 Legacy
1,569
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
os.makedirs(session['custom_model_dir'], exist_ok=True) os.makedirs(session['voice_dir'], exist_ok=True) if is_gui_shared: msg = f' Note: access limit time: {interface_shared_tmp_expire} days' session['audio...
The condition can be simplified. The expression `if not session or (session and not session.get('id', False))` is logically equivalent to `if not session or not session.get('id', False)` because if session is falsy, the first part already evaluates to True. The redundant check makes the code less readable. ```suggestio...
os.makedirs(session['custom_model_dir'], exist_ok=True) os.makedirs(session['voice_dir'], exist_ok=True) if is_gui_shared: msg = f' Note: access limit time: {interface_shared_tmp_expire} days' session['audio...
@@ -1754,7 +1754,7 @@ def change_gr_restore_session(data:DictProxy|None, state:dict, req:gr.Request)-> async def update_gr_save_session(session_id:str, state:dict)->tuple: try: session = context.get_session(session_id) - if not session or not isinsta...
lib/gradio.py
26
Python
0.857
suggestion
393
51
51
false
v26.1.21
1,571
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
return None path = os.path.join(session['chapters_dir'], file).replace("\\", "/") f.write(f"file '{path}'\n") if is_gui_process: progress_bar = gr.Progress(track_tqdm=False) ok = assemble_audi...
Type mismatch in function call. The merged_audio variable is a Path object (from line 2218), but export_audio expects a string parameter (as defined on line 2041). This call should be export_audio(str(merged_audio), metadata_file, final_file) to match the pattern used on line 2214 and to match the function signature.
final_file = Path(session['audiobooks_dir']) / (f"{session['final_name'].rsplit('.', 1)[0]}_part{part_idx+1}.{session['output_format']}" if needs_split else session['final_name']) if export_audio(str(merged_audio), str(metadata_file), str(final_file)): exp...
@@ -2215,29 +2226,30 @@ def export_audio(ffmpeg_combined_audio:str, ffmpeg_metadata_file:str, ffmpeg_fin f.write(f"file '{path}'\n") if is_gui_process: progress_bar = gr.Progress(track_tqdm=False) - ok = assemble_audio_chunks_worker(concat_li...
lib/core.py
26
Python
0.643
suggestion
318
51
51
false
v26.1.21
1,571
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
exported_files.append(str(final_file)) else: concat_list = os.path.join(worker_dir, 'all_chapters.txt') merged_tmp = os.path.join(worker_dir, f'all.{default_audio_proc_format}') with open(concat_list, 'w') as f: for ...
Type mismatch in function call. The merged_audio variable is a Path object (from line 2218), but assemble_audio_chunks expects a string parameter for out_file (as defined on line 2245). This call should be assemble_audio_chunks(concat_list, str(merged_audio), is_gui_process) to match the pattern used on line 2205 and t...
merged_audio = Path(session['process_dir']) / f"{get_sanitized(session['metadata']['title'])}_part{part_idx+1}.{default_audio_proc_format}" result = assemble_audio_chunks(str(concat_list), str(merged_audio), is_gui_process) if not result: ...
@@ -2215,29 +2226,30 @@ def export_audio(ffmpeg_combined_audio:str, ffmpeg_metadata_file:str, ffmpeg_fin f.write(f"file '{path}'\n") if is_gui_process: progress_bar = gr.Progress(track_tqdm=False) - ok = assemble_audio_chunks_worker(concat_li...
lib/core.py
26
Python
1
suggestion
460
51
51
false
v26.1.21
1,571
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
local cmd_extra="" local py_vers="$PYTHON_VERSION" case "$TAG" in cpu) cmd_options="";; cu*) cmd_options="--gpus all" ;; rocm*) cmd_options="--device=/dev/kfd --device=/dev/dri" ;; jetson*) cmd_options="--runtime nvidia --gpus all"; py_vers="3.10" ;; xpu) cmd_options="--device=/dev/dri" ;; mps) cmd_...
There is a redundant check for podman-compose. Line 740 and line 741 both check if podman-compose exists using the exact same condition. The inner check on line 741 should be removed as it's unnecessary. ```suggestion if ! podman-compose -f podman-compose.yml config >/dev/null 2>&1; then echo "ERROR: podman-compos...
local cmd_options="" local cmd_extra="" local py_vers="$PYTHON_VERSION" case "$TAG" in cpu) cmd_options="";; cu*) cmd_options="--gpus all" ;; rocm*) cmd_options="--device=/dev/kfd --device=/dev/dri" ;; jetson*) cmd_options="--runtime nvidia --gpus all"; py_vers="3.10" ;; xpu) cmd_options="--device=/de...
@@ -736,7 +737,30 @@ function build_docker_image { *) COMPOSE_PROFILES=gpu ;; esac export COMPOSE_PROFILES - if docker compose version >/dev/null 2>&1; then + if command -v podman-compose >/dev/null 2>&1; then + if command -v podman-compose >/dev/null 2>&1; then + if ! podman-compose -f podman-compose...
ebook2audiobook.sh
26
Shell
1
suggestion
355
51
51
false
v26.1.21
1,571
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
return self.detect_arch_tag() @cached_property def check_hardware(self)->tuple: return self.detect_device() def check_device_info(self, mode:str)->str: name, tag, msg = self.check_hardware arch = self.check_arch pyvenv = sys.version_info[:2] if mode == NATIV...
In BUILD_DOCKER mode, a .device_info.json file is written to the current directory, and in FULL_DOCKER mode it's read from the current directory. However, there's no guarantee that the working directory will be the same in both modes, or that the file will be accessible. Consider using an absolute path or ensuring the ...
return self.detect_arch_tag() @cached_property def check_hardware(self)->tuple: return self.detect_device() def check_device_info(self, mode:str)->str: name, tag, msg = self.check_hardware() arch = self.check_arch() pyvenv = list(sys.version_info[:2]) os_env...
@@ -20,16 +20,27 @@ def check_hardware(self)->tuple: return self.detect_device() def check_device_info(self, mode:str)->str: - name, tag, msg = self.check_hardware - arch = self.check_arch - pyvenv = sys.version_info[:2] + name, tag, msg = self.check_hardware() + arch ...
lib/classes/device_installer.py
26
Python
0.5
suggestion
361
51
51
false
v26.1.21
1,571
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
import torch, subprocess, shutil, json, numpy as np from torch import Tensor from typing import Any, Union from scipy.io import wavfile as wav from scipy.signal import find_peaks from lib.classes.subprocess_pipe import SubprocessPipe def detect_gender(voice_path:str)->str|None: try: samplerate, signal = ...
Missing import for os module. Line 119 uses os.path.basename but os is not imported in this file. This will cause a NameError at runtime when get_audiolist_duration is called. Add "import os" to the imports at the top of the file.
media = item.get("media", {}) ref = media.get("@ref") audio_duration = None general_duration = None for track in media.get("track", []): track_type = track.get("@type") if track_type == "Audio" and "Duration" in track: ...
@@ -58,27 +58,74 @@ def trim_audio(audio_data: Union[list[float], Tensor], samplerate: int, silence_ def get_audio_duration(filepath:str)->float: try: - ffprobe_cmd = [ - shutil.which('ffprobe'), - '-v', 'error', - '-show_entries', 'format=duration', - '-of', '...
lib/classes/tts_engines/common/audio.py
26
Python
0.643
suggestion
230
122
51
false
v26.1.21
1,571
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
shutil.which('ffprobe'), '-v', 'error', '-show_entries', 'format=duration', '-of', 'json', filepath ] result = subprocess.run(ffprobe_cmd, capture_output=True, text=True) try: return float(json.loads(result.stdout)['format']...
DependencyError is called but not imported or defined in this file. Line 82 uses DependencyError but it's not available in the current scope. This will cause a NameError at runtime if get_audio_duration encounters a subprocess error.
shutil.which('mediainfo'), '--Output=JSON', filepath ] result = subprocess.run(cmd, capture_output=True, text=True, check=True) data = json.loads(result.stdout) audio_duration = None general_duration = None for track in data.get('media'...
@@ -58,27 +58,74 @@ def trim_audio(audio_data: Union[list[float], Tensor], samplerate: int, silence_ def get_audio_duration(filepath:str)->float: try: - ffprobe_cmd = [ - shutil.which('ffprobe'), - '-v', 'error', - '-show_entries', 'format=duration', - '-of', '...
lib/classes/tts_engines/common/audio.py
26
Python
0.643
suggestion
233
51
51
false
v26.1.21
1,571
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
if [[ "$SCRIPT_MODE" == "$BUILD_DOCKER" ]]; then if [[ "$DOCKER_DEVICE_STR" == "" ]]; then check_docker || exit 1 device_info_str="$(check_device_info "${SCRIPT_MODE}")" if [[ "$device_info_str" == "" ]]; then echo "check_device_info() error: result is empty" exit 1 fi export TAG=${DEVICE_TAG:...
Using `chmod 777 "$TMPDIR"` makes the application's temp/config directory world-writable, allowing any local user on the system to create, modify, or delete files in that directory (including Calibre config and Python temp files) and interfere with this script's operation. An attacker on the same host could plant malic...
if [[ -n "${arguments[help]+exists}" && ${arguments[help]} == true ]]; then python "$SCRIPT_DIR/app.py" "${ARGS[@]}" else if [[ "$SCRIPT_MODE" == "$BUILD_DOCKER" ]]; then if [[ "$DOCKER_DEVICE_STR" == "" ]]; then check_docker || exit 1 device_info_str="$(check_device_info "${SCRIPT_MODE}")" if [[ "$device...
@@ -830,6 +834,7 @@ else check_sitecustomized || exit 1 fi elif [[ "$SCRIPT_MODE" == "$NATIVE" ]]; then + chmod 777 "$TMPDIR"
ebook2audiobook.sh
26
Shell
0.857
security
761
51
51
false
v26.1.21
1,571
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
if last < len(sentence): tail = sentence[last:] if tail: parts.append(tail) return parts def _convert_sml(self, sml:str)->tuple[bool, str]: m = SML_TAG_PATTERN.fullmatch(sml) if not m: error = '_convert_sml SML_TAG_PATTERN error: m...
After adding the error handling for _set_voice(), the code should return early to avoid executing the subsequent lines (446-452) which are meant to handle the opening voice tag, not the closing tag. The assertion on line 446 expects a value, which closing tags don't have. Add 'return True, ""' after the error check on ...
if last < len(sentence): tail = sentence[last:] if tail: parts.append(tail) return parts def _convert_sml(self, sml:str)->tuple[bool, str]: m = SML_TAG_PATTERN.fullmatch(sml) if not m: error = '_convert_sml SML_TAG_PATTERN error: m...
@@ -440,7 +440,9 @@ def _convert_sml(self, sml:str)->tuple[bool, str]: ) elif tag == 'voice': if close: - return self._set_voice(), '' + bool = self._set_voice() + if not bool: + return False, '_convert_sml() _set_voice()...
lib/classes/tts_engines/common/utils.py
26
Python
1
suggestion
489
51
51
false
v26.1.26
1,578
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
return engine else: error = 'load_engine() failed!' raise ValueError(error) except Exception as e: error = f'load_engine() error: {e}' raise ValueError(error) def convert(self, sentence_index:int, sentence:str)->bool: ...
Using 'bool' as a variable name shadows Python's built-in 'bool' type, which can cause confusion and potential issues. Consider renaming this variable to something more descriptive like 'success', 'result', or 'is_valid'.
return engine else: error = 'load_engine() failed!' raise ValueError(error) except Exception as e: error = f'load_engine() error: {e}' raise ValueError(error) def convert(self, sentence_index:int, sentence:str)->bool: ...
@@ -67,7 +67,7 @@ def convert(self, sentence_index:int, sentence:str)->bool: continue if SML_TAG_PATTERN.fullmatch(part): bool, error = self._convert_sml(part) - if bool is False: + if not bool:
lib/classes/tts_engines/yourtts.py
26
Python
0.643
suggestion
221
51
51
false
v26.1.26
1,578
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
checkpoint_path = hf_hub_download(repo_id=hf_repo, filename=f"{hf_sub}{self.models[self.session['fine_tuned']]['files'][1]}", cache_dir=self.cache_dir) vocab_path = hf_hub_download(repo_id=hf_repo, filename=f"{hf_sub}{self.models[self.session['fine_tuned']]['files'][2]}", cache_d...
Using 'bool' as a variable name shadows Python's built-in 'bool' type, which can cause confusion and potential issues. Consider renaming this variable to something more descriptive like 'success', 'result', or 'is_valid'.
checkpoint_path = hf_hub_download(repo_id=hf_repo, filename=f"{hf_sub}{self.models[self.session['fine_tuned']]['files'][1]}", cache_dir=self.cache_dir) vocab_path = hf_hub_download(repo_id=hf_repo, filename=f"{hf_sub}{self.models[self.session['fine_tuned']]['files'][2]}", cache_d...
@@ -75,7 +75,7 @@ def convert(self, sentence_index:int, sentence:str)->bool: continue if SML_TAG_PATTERN.fullmatch(part): bool, error = self._convert_sml(part) - if bool is False: + if not bool:
lib/classes/tts_engines/xtts.py
26
Python
0.643
suggestion
221
51
51
false
v26.1.26
1,578
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
if engine and engine is not None: msg = f'TTS {self.tts_key} Loaded!' return engine else: error = 'load_engine() failed!' raise ValueError(error) except Exception as e: error = f'load_engine() error: {e}' ...
Using 'bool' as a variable name shadows Python's built-in 'bool' type, which can cause confusion and potential issues. Consider renaming this variable to something more descriptive like 'success', 'result', or 'is_valid'.
if engine and engine is not None: msg = f'TTS {self.tts_key} Loaded!' return engine else: error = 'load_engine() failed!' raise ValueError(error) except Exception as e: error = f'load_engine() error: {e}' ...
@@ -76,7 +76,7 @@ def convert(self, sentence_index:int, sentence:str)->bool: continue if SML_TAG_PATTERN.fullmatch(part): bool, error = self._convert_sml(part) - if bool is False: + if not bool:
lib/classes/tts_engines/vits.py
26
Python
0.643
suggestion
221
51
51
false
v26.1.26
1,578
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
error = 'load_engine() failed!' raise ValueError(error) except Exception as e: error = f'load_engine() error: {e}' raise ValueError(error) def convert(self, sentence_index:int, sentence:str)->bool: try: if self.engine: ...
Using 'bool' as a variable name shadows Python's built-in 'bool' type, which can cause confusion and potential issues. Consider renaming this variable to something more descriptive like 'success', 'result', or 'is_valid'.
error = 'load_engine() failed!' raise ValueError(error) except Exception as e: error = f'load_engine() error: {e}' raise ValueError(error) def convert(self, sentence_index:int, sentence:str)->bool: try: if self.engine: ...
@@ -97,7 +97,7 @@ def convert(self, sentence_index:int, sentence:str)->bool: continue if SML_TAG_PATTERN.fullmatch(part): bool, error = self._convert_sml(part) - if bool is False: + if not bool:
lib/classes/tts_engines/tacotron.py
26
Python
0.643
suggestion
221
51
51
false
v26.1.26
1,578
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
msg = f'TTS {self.tts_key} Loaded!' return engine else: error = 'load_engine() failed!' raise ValueError(error) except Exception as e: error = f'load_engine() error: {e}' raise ValueError(error) def convert(...
Using 'bool' as a variable name shadows Python's built-in 'bool' type, which can cause confusion and potential issues. Consider renaming this variable to something more descriptive like 'success', 'result', or 'is_valid'.
msg = f'TTS {self.tts_key} Loaded!' return engine else: error = 'load_engine() failed!' raise ValueError(error) except Exception as e: error = f'load_engine() error: {e}' raise ValueError(error) def convert(...
@@ -69,7 +69,7 @@ def convert(self, sentence_index:int, sentence:str)->bool: continue if SML_TAG_PATTERN.fullmatch(part): bool, error = self._convert_sml(part) - if bool is False: + if not bool:
lib/classes/tts_engines/fairseq.py
26
Python
0.643
suggestion
221
51
51
false
v26.1.26
1,578
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
print(msg) return True else: return True except Exception as e: error = f'_check_bark_npz() error: {e}' print(error) return False """ def convert(self, sentence_index:int, sentence:str)->bool: ...
Using 'bool' as a variable name shadows Python's built-in 'bool' type, which can cause confusion and potential issues. Consider renaming this variable to something more descriptive like 'success', 'result', or 'is_valid'.
print(msg) return True else: return True except Exception as e: error = f'_check_bark_npz() error: {e}' print(error) return False """ def convert(self, sentence_index:int, sentence:str)->bool: ...
@@ -138,7 +138,7 @@ def convert(self, sentence_index:int, sentence:str)->bool: continue if SML_TAG_PATTERN.fullmatch(part): bool, error = self._convert_sml(part) - if bool is False: + if not bool:
lib/classes/tts_engines/bark.py
26
Python
0.643
suggestion
221
51
51
false
v26.1.26
1,578
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
last = end if last < len(sentence): tail = sentence[last:] if tail: parts.append(tail) return parts def _convert_sml(self, sml:str)->tuple[bool, str]: m = SML_TAG_PATTERN.fullmatch(sml) if not m: error = '_convert_sml S...
Using 'bool' as a variable name shadows Python's built-in 'bool' type, which can cause confusion and potential issues. Consider renaming this variable to something more descriptive like 'success', 'result', or 'is_valid'. ```suggestion success = self._set_voice() if not success: ```
last = end if last < len(sentence): tail = sentence[last:] if tail: parts.append(tail) return parts def _convert_sml(self, sml:str)->tuple[bool, str]: m = SML_TAG_PATTERN.fullmatch(sml) if not m: error = '_convert_sml S...
@@ -440,7 +440,9 @@ def _convert_sml(self, sml:str)->tuple[bool, str]: ) elif tag == 'voice': if close: - return self._set_voice(), '' + bool = self._set_voice() + if not bool:
lib/classes/tts_engines/common/utils.py
26
Python
1
suggestion
315
51
51
false
v26.1.26
1,578
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
if last < len(sentence): tail = sentence[last:] if tail: parts.append(tail) return parts def _convert_sml(self, sml:str)->tuple[bool, str]: m = SML_TAG_PATTERN.fullmatch(sml) if not m: error = '_convert_sml SML_TAG_PATTERN error: m...
Removing this assertion creates a critical bug. When `close` is True and `res` is True, the code continues to line 446 where `os.path.abspath(value)` is called. However, `value` can be None for closing voice tags (e.g., `</voice>`), which will cause `os.path.abspath(None)` to raise a TypeError. The assertion was prote...
if last < len(sentence): tail = sentence[last:] if tail: parts.append(tail) return parts def _convert_sml(self, sml:str)->tuple[bool, str]: m = SML_TAG_PATTERN.fullmatch(sml) if not m: error = '_convert_sml SML_TAG_PATTERN error: m...
@@ -440,10 +440,9 @@ def _convert_sml(self, sml:str)->tuple[bool, str]: ) elif tag == 'voice': if close: - bool = self._set_voice() - if not bool: + res = self._set_voice() + if not res: return False, '_c...
lib/classes/tts_engines/common/utils.py
26
Python
1
bug
641
51
51
false
v26.1.26
1,579
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
def _convert_sml(self, sml:str)->tuple[bool, str]: m = SML_TAG_PATTERN.fullmatch(sml) if not m: error = '_convert_sml SML_TAG_PATTERN error: m is empty' return False, error tag = m.group('tag') close = bool(m.group('close')) value = m.group('value') ...
Missing value validation for voice tag. The original code had an assertion that checked if value is not None when opening a voice tag. This validation was removed in this PR, but the subsequent code at line 451 assumes value is not None when calling os.path.abspath(value). If value is None, this will cause a TypeError....
def _convert_sml(self, sml:str)->tuple[bool, str]: m = SML_TAG_PATTERN.fullmatch(sml) if not m: error = '_convert_sml SML_TAG_PATTERN error: m is empty' return False, error tag = m.group('tag') close = bool(m.group('close')) value = m.group('value') ...
@@ -434,14 +434,20 @@ def _convert_sml(self, sml:str)->tuple[bool, str]: assert tag in TTS_SML, f'Unknown SML tag: {tag!r}' if tag == 'break': silence_time = float(int(np.random.uniform(0.3, 0.6) * 100) / 100) + self.audio_segments.append(torch.zeros(1, int(self.params['sampler...
lib/classes/tts_engines/common/utils.py
26
Python
1
suggestion
618
51
51
false
v26.1.26
1,581
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
def disable_on_voice_upload()->tuple: return ( *([gr.update(interactive=False) for _ in range(8)]), gr.update(visible=False), gr.update(visible=False) ) def enable_on_voice_upload(session_id:...
The refactoring has changed the function's behavior when a session doesn't exist. In the original code, when session was None or didn't have 'id', the function would return 8 empty gr.update() calls without setting interactive=True. In the new code, the final return statement sets interactive=True for all 8 components ...
def disable_on_voice_upload()->tuple: return ( gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=Fal...
@@ -680,31 +680,29 @@ def enable_components(session_id:str)->tuple: def disable_on_voice_upload()->tuple: return ( - *([gr.update(interactive=False) for _ in range(8)]), - gr.update(visible=False), - gr.update(visib...
lib/gradio.py
26
Python
0.643
refactor
574
51
51
false
v26.1.26
1,583
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
gr_confirm_deletion_yes_btn = gr.Button(elem_id='gr_confirm_deletion_yes_btn', elem_classes=['hide-elem'], value='', variant='secondary', visible=True, scale=0, size='sm', min_width=0) gr_confirm_deletion_no_btn = gr.Button(elem_id='gr_confirm_deletion_no_btn', elem_classes=['hide-elem'], value=...
The change from using list comprehension with unpacking (*[gr.update(interactive=False) for _ in range(8)]) to 8 explicit gr.update(interactive=False) calls reduces maintainability. If the number of components changes in the future, all these lines would need to be manually updated. Consider keeping the list comprehens...
gr_confirm_deletion_yes_btn = gr.Button(elem_id='gr_confirm_deletion_yes_btn', elem_classes=['hide-elem'], value='', variant='secondary', visible=True, scale=0, size='sm', min_width=0) gr_confirm_deletion_no_btn = gr.Button(elem_id='gr_confirm_deletion_no_btn', elem_classes=['hide-elem'], value=...
@@ -680,31 +680,29 @@ def enable_components(session_id:str)->tuple: def disable_on_voice_upload()->tuple: return ( - *([gr.update(interactive=False) for _ in range(8)]), - gr.update(visible=False), - gr.update(visib...
lib/gradio.py
26
Python
0.5
suggestion
427
51
51
false
v26.1.26
1,583
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
outputs = tuple([gr.update() for _ in range(12)]) return outputs def disable_on_voice_upload()->tuple: return ( *([gr.update(interactive=False) for _ in range(8)]), gr.update(visible=False), ...
The change from list comprehension to explicit gr.update() calls reduces maintainability. If the number of components changes, these lines would need manual updates. The pattern is repeated in multiple places (lines 696-697, 702-703). Consider using list comprehensions or tuple multiplication for better maintainability...
outputs = tuple([gr.update() for _ in range(12)]) return outputs def disable_on_voice_upload()->tuple: return ( gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive...
@@ -680,31 +680,29 @@ def enable_components(session_id:str)->tuple: def disable_on_voice_upload()->tuple: return ( - *([gr.update(interactive=False) for _ in range(8)]), - gr.update(visible=False), - gr.update(visib...
lib/gradio.py
26
Python
0.5
suggestion
321
51
51
false
v26.1.26
1,583
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
return ( *([gr.update() for _ in range(8)]), gr.update(visible=visible), gr.update(visible=visible) ) return ( *([gr.update(interactive=True) fo...
The change from list comprehension to explicit gr.update() calls reduces maintainability. The pattern is repeated in lines 716, 718, and 719. If the number of components changes, all these lines would need manual updates. Consider using list comprehensions or a helper function for better maintainability.
if session.get('event') == 'confirm_blocks': return ( gr.update(), gr.update(), gr.update(), gr.update(), gr.update(), gr.update(), gr.update(), gr.update(), gr.update(visible=visible), ...
@@ -715,12 +713,10 @@ def enable_on_custom_upload(session_id:str)->tuple: session = context.get_session(session_id) if session and session.get('id', False): if session['event'] == 'confirm_blocks': - outputs = tuple([gr.update() for _ in rang...
lib/gradio.py
26
Python
0.5
refactor
305
51
51
false
v26.1.26
1,583
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
return outputs def enable_components(session_id:str)->tuple: session = context.get_session(session_id) if session and session.get('id', False): if session['event'] == 'confirm_blocks': outputs = tuple([g...
Type inconsistency in the visible variable assignment. The variable is initialized as a string 'hidden' on line 691, but then on line 693 it can be assigned either the boolean True or the string 'hidden'. This mixing of boolean and string types is inconsistent with other similar patterns in the codebase. For example, l...
return outputs def enable_components(session_id:str)->tuple: session = context.get_session(session_id) if session and session.get('id', False): if session['event'] == 'confirm_blocks': outputs = tuple([g...
@@ -680,31 +680,29 @@ def enable_components(session_id:str)->tuple: def disable_on_voice_upload()->tuple: return ( - *([gr.update(interactive=False) for _ in range(8)]), - gr.update(visible=False), - gr.update(visib...
lib/gradio.py
26
Python
1
suggestion
629
51
51
false
v26.1.26
1,583
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
def refresh_interface(session_id:str)->tuple: session = context.get_session(session_id) if session and session.get('id', False): if session['event'] == 'confirm_blocks': outputs = tuple([gr.update() for _ in range(9)]) ...
Inconsistent type used for the visible parameter. The code is mixing boolean values (True) with string values ('hidden') for the visible parameter. Throughout the codebase, gr.update() consistently uses boolean False for the visible parameter (see lines 965, 969, 978, 1053, 1057, 1070, 1074, 1076, 1080, 1093, 1106), no...
except Exception as e: error = f'restore_audiobook_player(): {e}' alert_exception(error, None) outputs = tuple([gr.update() for _ in range(3)]) return outputs def refresh_interface(session_id:str)->tuple: ...
@@ -882,7 +887,7 @@ def change_gr_audiobook_list(selected:str|None, session_id:str)->dict: session = context.get_session(session_id) if session and session.get('id', False): session['audiobook'] = selected - group_visible = True i...
lib/gradio.py
26
Python
0.643
suggestion
672
51
51
false
v26.1.26
1,584
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
gr.update(value=session['language']), update_gr_voice_list(session_id), update_gr_tts_engine_list(session_id), update_gr_custom_model_list(session_id), update_gr_fine_tuned_list(se...
Inconsistent type used for the visible parameter. The code is mixing boolean values (True) with string values ('hidden') for the visible parameter. Looking at line 693, the pattern is `visible = True if condition else 'hidden'`, but then this value is used in gr.update(visible=visible). However, throughout the codebase...
return ( gr.update(value=session['ebook']), gr.update(value=session['ebook_mode']), gr.update(value=bool(session['chapters_preview'])), gr.update(value=session['device']), ...
@@ -855,7 +860,7 @@ def restore_interface(session_id:str, req:gr.Request)->tuple: def restore_audiobook_player(audiobook:str|None)->tuple: try: - visible = True if audiobook is not None else False + visible = True if audiobook is not None else 'hidde...
lib/gradio.py
26
Python
0.786
suggestion
782
51
51
false
v26.1.26
1,584
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
gr_state_update = gr.State(value={'hash': None}) gr_restore_session = gr.JSON(elem_id='gr_restore_session', visible='hidden') gr_save_session = gr.JSON(elem_id='gr_save_session', visible='hidden') def disable_components()->tuple: outputs = tuple([gr.upda...
The visible parameter should use boolean False instead of the string 'hidden'. Throughout the codebase, gr.update() calls use visible=True or visible=False for controlling visibility (see lines 1024-1025, 1046, 1050, 1063, 1067, 1069, 1073, 1082, 1086, 1099, etc.). The string 'hidden' is only used during component init...
gr_state_update = gr.State(value={'hash': None}) gr_restore_session = gr.JSON(elem_id='gr_restore_session', visible='hidden') gr_save_session = gr.JSON(elem_id='gr_save_session', visible='hidden') def disable_components()->tuple: outputs = tuple([gr.upda...
@@ -682,46 +682,45 @@ def disable_on_voice_upload()->tuple: return ( gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(in...
lib/gradio.py
26
Python
0.5
suggestion
367
51
51
false
v26.1.27
1,585
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
return outputs def enable_components(session_id:str)->tuple: session = context.get_session(session_id) if session and session.get('id', False): if session['event'] == 'confirm_blocks': outputs = tuple([g...
The visible variable should be a boolean, not a mix of boolean and string. This line should be: visible = session['voice'] is not None (which evaluates to True or False). Mixing True and 'hidden' as possible values for the same variable is inconsistent with the rest of the codebase where visible is always a boolean (se...
return outputs def enable_components(session_id:str)->tuple: session = context.get_session(session_id) if session and session.get('id', False): if session['event'] == 'confirm_blocks': outputs = tuple([g...
@@ -682,46 +682,45 @@ def disable_on_voice_upload()->tuple: return ( gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(in...
lib/gradio.py
26
Python
0.857
suggestion
434
51
51
false
v26.1.27
1,585
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(), ...
The visible parameter should use boolean False instead of the string 'hidden'. This is inconsistent with the rest of the codebase where gr.update() calls use visible=True or visible=False for controlling visibility.
gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(visible='h...
@@ -682,46 +682,45 @@ def disable_on_voice_upload()->tuple: return ( gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(in...
lib/gradio.py
26
Python
0.5
suggestion
215
51
51
false
v26.1.27
1,585
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
base_f = os.path.basename(f).lower() if base_f in required_files_lc: out_path = os.path.join(model_path, base_f) with zip_ref.open(f) as src, open(out_path, 'wb') as dst: shutil.copyfi...
Spelling error: 'occured' should be 'occurred' (with double 'r'). ```suggestion error = f'An error occurred when unzip {file_src}' ```
base_f = os.path.basename(f).lower() if base_f in required_files_lc: out_path = os.path.join(model_path, base_f) with zip_ref.open(f) as src, open(out_path, 'wb') as dst: shutil.copyfi...
@@ -319,19 +319,23 @@ def extract_custom_model(file_src:str, session_id, required_files:list)->str|Non msg = f'Extracted files to {model_path}. Normalizing ref.wav…' print(msg) voice_ref = os.path.join(model_path, 'ref.wav') - voice_output = os.path.join...
lib/core.py
26
Python
0.929
suggestion
150
51
51
false
v26.1.27
1,585
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
base_f = os.path.basename(f).lower() if base_f in required_files_lc: out_path = os.path.join(model_path, base_f) with zip_ref.open(f) as src, open(out_path, 'wb') as dst: shutil.copyfi...
Spelling error: "occured" should be "occurred". ```suggestion error = f'An error occurred when unzip {file_src}' ```
base_f = os.path.basename(f).lower() if base_f in required_files_lc: out_path = os.path.join(model_path, base_f) with zip_ref.open(f) as src, open(out_path, 'wb') as dst: shutil.copyfi...
@@ -319,19 +319,23 @@ def extract_custom_model(file_src:str, session_id, required_files:list)->str|Non msg = f'Extracted files to {model_path}. Normalizing ref.wav…' print(msg) voice_ref = os.path.join(model_path, 'ref.wav') - voice_output = os.path.join...
lib/core.py
26
Python
0.929
suggestion
132
51
51
false
v26.1.27
1,586
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
base_f = os.path.basename(f).lower() if base_f in required_files_lc: out_path = os.path.join(model_path, base_f) with zip_ref.open(f) as src, open(out_path, 'wb') as dst: shutil.copyfi...
Missing space between "occurred" and "when". The error message should read "An error occurred when unzip" not "An error occurredwhen unzip". ```suggestion error = f'An error occurred when unzip {file_src}' ```
base_f = os.path.basename(f).lower() if base_f in required_files_lc: out_path = os.path.join(model_path, base_f) with zip_ref.open(f) as src, open(out_path, 'wb') as dst: shutil.copyfi...
@@ -334,7 +334,7 @@ def extract_custom_model(file_src:str, session_id, required_files:list)->str|Non error = f'extract_custom_model() VoiceExtractor.extract_voice() error! {msg}' print(error) else: - error = f'An error occured when unzip {file_src}' ...
lib/core.py
26
Python
1
suggestion
225
51
51
false
README changes
1,587
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
if os.path.exists(voice_ref): os.remove(voice_ref) return model_path else: error = f'extract_custom_model() VoiceExtractor.extract_voice() error! {msg}' print(error) else: ...
Setting session['custom_model'] to None outside the session validity check will cause an error if session is None or doesn't have an 'id'. This line should be inside the if block that starts at line 298, or should be conditionally executed only when session is valid. ```suggestion session['custom_model'] = None...
status, msg = extractor.extract_voice() if status: session['voice'] = final_voice_file if os.path.exists(file_src): os.remove(file_src) if os.path.exists(voice_ref): os.remove(voic...
@@ -347,6 +352,7 @@ def extract_custom_model(file_src:str, session_id, required_files:list)->str|Non if session['is_gui_process']: if os.path.exists(file_src): os.remove(file_src) + session['custom_model'] = None
lib/core.py
26
Python
1
suggestion
324
51
51
false
v26.1.27
1,588
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
visible = True if session['voice'] is not None else 'hidden' convert_btn_enabled = True if session['ebook'] is not None else False if session.get('event') == 'confirm_blocks': return outputs return ( ...
Inconsistent use of string 'hidden' instead of boolean False for visibility control. While the codebase does use both patterns, within the same function on line 708, False is not used but 'hidden' is consistently used. However, looking at line 717, convert_btn_enabled uses a boolean True/False pattern. The change from ...
visible = True if session['voice'] is not None else 'hidden' convert_btn_enabled = True if session['ebook'] is not None else False if session.get('event') == 'confirm_blocks': return outputs return ( ...
@@ -715,7 +715,7 @@ def enable_on_custom_upload(session_id:str)->tuple: if session['event'] == 'confirm_blocks': return outputs convert_btn_enabled = True if session['ebook'] is not None else False - custom_del_btn_visible = True if s...
lib/gradio.py
26
Python
0.643
suggestion
529
51
51
false
v26.1.27
1,588
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
required_empty_files = [f for f in required_files if f in empty_files] if missing_files: msg = f'Missing required files: {missing_files}' print(msg) if required_empty_files: msg = f'Required files with 0 KB: {required_empty_files}' print(msg) ...
The progress_bar is created unconditionally on line 304, but it's only used when session['is_gui_process'] is true (line 352). This differs from the pattern used elsewhere in the codebase where gr.Progress() is conditionally created based on is_gui_process check (see lib/classes/voice_extractor.py:33-34, lib/core.py:18...
required_empty_files = [f for f in required_files if f in empty_files] if missing_files: msg = f'Missing required files: {missing_files}' print(msg) if required_empty_files: msg = f'Required files with 0 KB: {required_empty_files}' print(msg) ...
@@ -293,12 +293,15 @@ def analyze_uploaded_file(zip_path:str, required_files:list[str])->bool: print(error) return False -def extract_custom_model(file_src:str, session_id, required_files:list)->str|None: +def extract_custom_model(session_id)->str|None: session = context.get_session(session_id)...
lib/core.py
26
Python
0.5
bug
483
51
51
false
v26.1.27
1,588
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
status, msg = extractor.extract_voice() if status: session['voice'] = final_voice_file if os.path.exists(file_src): os.remove(file_src) if os.path.exists(voice_ref): os.remove(voic...
This line is incorrectly placed outside the `if session and session.get('id', False):` block (line 298). When the session is None or doesn't have an 'id', attempting to set `session['custom_model']` will raise a TypeError or AttributeError. This line should be indented to be inside the if block, or it should include a ...
final_voice_file = os.path.join(model_path, f'{voice_name}.wav') extractor = VoiceExtractor(session, voice_ref, voice_name, final_voice_file) status, msg = extractor.extract_voice() if status: session['voice'] = final_voice_file ...
@@ -347,6 +352,7 @@ def extract_custom_model(file_src:str, session_id, required_files:list)->str|Non if session['is_gui_process']: if os.path.exists(file_src): os.remove(file_src) + session['custom_model'] = None
lib/core.py
26
Python
0.786
bug
386
51
51
false
v26.1.27
1,590
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
required_empty_files = [f for f in required_files if f in empty_files] if missing_files: msg = f'Missing required files: {missing_files}' print(msg) if required_empty_files: msg = f'Required files with 0 KB: {required_empty_files}' print(msg) ...
The progress_bar is created unconditionally but may be called in non-GUI contexts (e.g., from convert_ebook when is_gui_process is False). Creating gr.Progress in non-GUI contexts could potentially cause issues. Consider wrapping the progress_bar creation in a conditional check: `if session.get('is_gui_process', False)...
required_empty_files = [f for f in required_files if f in empty_files] if missing_files: msg = f'Missing required files: {missing_files}' print(msg) if required_empty_files: msg = f'Required files with 0 KB: {required_empty_files}' print(msg) ...
@@ -293,12 +293,15 @@ def analyze_uploaded_file(zip_path:str, required_files:list[str])->bool: print(error) return False -def extract_custom_model(file_src:str, session_id, required_files:list)->str|None: +def extract_custom_model(session_id)->str|None: session = context.get_session(session_id)...
lib/core.py
26
Python
0.643
suggestion
400
51
51
false
v26.1.27
1,590
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
def extract_custom_model(session_id)->str|None: session = context.get_session(session_id) if session and session.get('id', False): file_src = session['custom_model'] required_files = default_engine_settings[session['tts_engine']]['files'] model_path = None model_name = re.sub('.z...
The progress_bar is called unconditionally but should only be used in GUI contexts. Since the progress_bar may not be properly initialized in non-GUI mode (see line 304), this call could fail. Consider making this conditional: `if session.get('is_gui_process', False) and progress_bar: progress_bar((t.n + 1) / files_len...
def extract_custom_model(session_id)->str|None: session = context.get_session(session_id) if session and session.get('id', False): file_src = session['custom_model'] required_files = default_engine_settings[session['tts_engine']]['files'] model_path = None model_name = re.sub('.z...
@@ -307,16 +310,18 @@ def extract_custom_model(file_src:str, session_id, required_files:list)->str|Non model_path = os.path.join(session['custom_model_dir'], tts_dir, model_name) os.makedirs(model_path, exist_ok=True) required_files_lc = set(x.lower() for x in required...
lib/core.py
26
Python
0.643
bug
335
51
51
false
v26.1.27
1,590
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
path = os.path.join(session['chapters_dir'], file).replace("\\", "/") f.write(f"file '{path}'\n") if is_gui_process: progress_bar = gr.Progress(track_tqdm=False) ok = assemble_audio_chunks(concat_list, merged_audio, is_g...
Syntax error: missing underscore in variable name. Should be 'is_gui_process' instead of 'is gui_process'. This will cause a NameError when this function is called with is_gui_process=True. ```suggestion if is_gui_process: ```
print(msg) return None path = os.path.join(session['chapters_dir'], file).replace("\\", "/") f.write(f"file '{path}'\n") if is_gui_process: progress_bar = gr.Progress(track_tqdm=Fa...
@@ -2284,7 +2286,8 @@ def export_audio(ffmpeg_combined_audio:str, ffmpeg_metadata_file:str, ffmpeg_fin def assemble_audio_chunks(txt_file:str, out_file:str, is_gui_process:bool)->bool: def on_progress(p:float)->None: - progress_bar(p / 100.0, desc='Assemble') + if is gui_process:
lib/core.py
26
Python
1
suggestion
234
51
51
false
v26.1.27
1,591
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
with zip_ref.open(f) as src, open(out_path, 'wb') as dst: shutil.copyfileobj(src, dst) progress_bar((t.n + 1) / files_length, desc=msg) t.update(1) if model_path is not None: msg = f'N...
Extra whitespace inserted in error message. The message now has multiple spaces before 'when', which appears to be unintentional formatting. ```suggestion error = f'An error occurred when unzip {file_src}' ```
out_path = os.path.join(model_path, base_f) with zip_ref.open(f) as src, open(out_path, 'wb') as dst: shutil.copyfileobj(src, dst) t.update(1) if session['is_gui_process']: ...
@@ -339,7 +341,7 @@ def extract_custom_model(session_id)->str|None: error = f'extract_custom_model() VoiceExtractor.extract_voice() error! {msg}' print(error) else: - error = f'An error occurred when unzip {file_src}' + error = f'An er...
lib/core.py
26
Python
0.929
suggestion
225
51
51
false
v26.1.27
1,591
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
"pt_speaker_9": "Speaker 9", "ru_speaker_0": "Speaker 0", "ru_speaker_1": "Speaker 1", "ru_speaker_2": "Speaker 2", "ru_speaker_3": "Speaker 3", "ru_speaker_4": "Speaker 4", "ru_speaker_5": "Speaker 5", "ru_speaker_6": "Speaker 6", "ru_speaker_7": "Speaker 7", "ru_spea...
The files configuration for VITS has been incorrectly changed to contain Tortoise TTS model files (autoregressive.pth, diffusion_decoder.pth, vocoder.pth, clvp2.pth) instead of the original VITS model files (config.json, model_file.pth, language_ids.json). This will break VITS functionality. Please revert this line to ...
"pt_speaker_6": "Speaker 6", "pt_speaker_7": "Speaker 7", "pt_speaker_8": "Speaker 8", "pt_speaker_9": "Speaker 9", "ru_speaker_0": "Speaker 0", "ru_speaker_1": "Speaker 1", "ru_speaker_2": "Speaker 2", "ru_speaker_3": "Speaker 3", "ru_speaker_4": "Speaker 4", "ru_spea...
@@ -148,10 +149,17 @@ }, "rating": {"VRAM": 6, "CPU": 1, "RAM": 6, "Realism": 5} }, + TTS_ENGINES['TORTOISE']: { + "languages": {"eng": "en"}, + "samplerate": 24000, + "files": ['config.json', 'model_file.pth', 'language_ids.json'], + "voices": {}, + ...
lib/conf_models.py
26
Python
0.857
bug
449
43
51
false
v26.1.27
1,594
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
error = f'{pkg_name} (installed {installed_version}) < required {req_v}.' print(error) missing_packages.append(package) elif '<=' in spec_str: if (imajo...
Logic error: The variables clean_pkg and pkg_name are computed once before the loop (lines 761-762) using the last value of 'package' from the previous for loop that iterates over packages (line 663). These variables should be computed inside the loop that iterates over missing_packages (line 768), so that each package...
error = f'{pkg_name} (installed {installed_version}) < required {req_v}.' print(error) missing_packages.append(package) elif '<=' in spec_str: if (imajo...
@@ -758,14 +758,19 @@ def install_python_packages(self)->bool: print(error) missing_packages.append(package) if missing_packages: + clean_pkg = re.sub(r'\[.*?\]', '', package) + pkg_name = re.split(r'[<>...
lib/classes/device_installer.py
26
Python
0.643
suggestion
422
51
51
false
v26.1.27
1,594
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
"pt_speaker_9": "Speaker 9", "ru_speaker_0": "Speaker 0", "ru_speaker_1": "Speaker 1", "ru_speaker_2": "Speaker 2", "ru_speaker_3": "Speaker 3", "ru_speaker_4": "Speaker 4", "ru_speaker_5": "Speaker 5", "ru_speaker_6": "Speaker 6", "ru_speaker_7": "Speaker 7", "ru_spea...
There is a trailing space after 'autoregressive.pth ' in the files array. This should be 'autoregressive.pth' without the trailing space to avoid potential file matching issues.
"pt_speaker_6": "Speaker 6", "pt_speaker_7": "Speaker 7", "pt_speaker_8": "Speaker 8", "pt_speaker_9": "Speaker 9", "ru_speaker_0": "Speaker 0", "ru_speaker_1": "Speaker 1", "ru_speaker_2": "Speaker 2", "ru_speaker_3": "Speaker 3", "ru_speaker_4": "Speaker 4", "ru_spea...
@@ -148,10 +149,17 @@ }, "rating": {"VRAM": 6, "CPU": 1, "RAM": 6, "Realism": 5} }, + TTS_ENGINES['TORTOISE']: { + "languages": {"eng": "en"}, + "samplerate": 24000, + "files": ['config.json', 'model_file.pth', 'language_ids.json'], + "voices": {}, + ...
lib/conf_models.py
26
Python
0.429
suggestion
177
43
51
false
v26.1.27
1,594
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
print(error) missing_packages.append(package) elif '<' in spec_str: if (imajor > rmajor) or (imajor == rmajor and iminor >= rminor): error = f'{pkg_name...
When no_deps is an empty string, passing it to subprocess.check_call will add an empty string as a command argument, which may cause unexpected behavior. Consider using a conditional list construction instead, such as: subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir'] + ([no_...
print(error) missing_packages.append(package) elif '<' in spec_str: if (imajor > rmajor) or (imajor == rmajor and iminor >= rminor): error = f'{pkg_name...
@@ -758,14 +758,19 @@ def install_python_packages(self)->bool: print(error) missing_packages.append(package) if missing_packages: + clean_pkg = re.sub(r'\[.*?\]', '', package) + pkg_name = re.split(r'[<>...
lib/classes/device_installer.py
26
Python
0.857
performance
677
51
51
false
v26.1.27
1,594
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
"pl_speaker_4": "Speaker 4", "pl_speaker_5": "Speaker 5", "pl_speaker_6": "Speaker 6", "pl_speaker_7": "Speaker 7", "pl_speaker_8": "Speaker 8", "pl_speaker_9": "Speaker 9", "pt_speaker_0": "Speaker 0", "pt_speaker_1": "Speaker 1", "pt_speaker_2": "Speaker 2", "pt_spea...
The Tortoise engine’s required `files` list looks like the generic Coqui single-checkpoint layout (`config.json`, `model_file.pth`, `language_ids.json`), but the Tortoise v2 model typically uses the multi-file artifacts (`autoregressive.pth`, `diffusion_decoder.pth`, `vocoder.pth`, `clvp2.pth`). This appears to be swap...
"pl_speaker_1": "Speaker 1", "pl_speaker_2": "Speaker 2", "pl_speaker_3": "Speaker 3", "pl_speaker_4": "Speaker 4", "pl_speaker_5": "Speaker 5", "pl_speaker_6": "Speaker 6", "pl_speaker_7": "Speaker 7", "pl_speaker_8": "Speaker 8", "pl_speaker_9": "Speaker 9", "pt_spea...
@@ -148,10 +149,17 @@ }, "rating": {"VRAM": 6, "CPU": 1, "RAM": 6, "Realism": 5} }, + TTS_ENGINES['TORTOISE']: { + "languages": {"eng": "en"}, + "samplerate": 24000, + "files": ['config.json', 'model_file.pth', 'language_ids.json'], + "voices": {}, + ...
lib/conf_models.py
26
Python
0.643
refactor
523
48
51
false
v26.1.27
1,595
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
"ru_speaker_2": "Speaker 2", "ru_speaker_3": "Speaker 3", "ru_speaker_4": "Speaker 4", "ru_speaker_5": "Speaker 5", "ru_speaker_6": "Speaker 6", "ru_speaker_7": "Speaker 7", "ru_speaker_8": "Speaker 8", "ru_speaker_9": "Speaker 9", "tr_speaker_0": "Speaker 0", "tr_spea...
`default_engine_settings['vits']['files']` was changed to Tortoise-specific artifact names and includes a trailing space in `'autoregressive.pth '`. This will break custom-model ZIP validation/extraction for VITS (and any code expecting the previous VITS required files). Restore the original VITS required files and rem...
"pt_speaker_9": "Speaker 9", "ru_speaker_0": "Speaker 0", "ru_speaker_1": "Speaker 1", "ru_speaker_2": "Speaker 2", "ru_speaker_3": "Speaker 3", "ru_speaker_4": "Speaker 4", "ru_speaker_5": "Speaker 5", "ru_speaker_6": "Speaker 6", "ru_speaker_7": "Speaker 7", "ru_spea...
@@ -148,10 +149,17 @@ }, "rating": {"VRAM": 6, "CPU": 1, "RAM": 6, "Realism": 5} }, + TTS_ENGINES['TORTOISE']: { + "languages": {"eng": "en"}, + "samplerate": 24000, + "files": ['config.json', 'model_file.pth', 'language_ids.json'], + "voices": {}, + ...
lib/conf_models.py
26
Python
0.643
bug
348
42
50
false
v26.1.27
1,595
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
print(error) missing_packages.append(package) elif '<=' in spec_str: if (imajor > rmajor) or (imajor == rmajor and iminor > rminor): error = f'{pkg_name...
`clean_pkg` / `pkg_name` are computed from `package` outside the `for package in missing_packages` loop, so they end up using the *last* value from the earlier `for package in packages` loop. Move package-name parsing into the install loop (or recompute per `missing_packages` entry) so flags like `--no-deps` are decide...
print(error) missing_packages.append(package) elif '<=' in spec_str: if (imajor > rmajor) or (imajor == rmajor and iminor > rminor): error = f'{pkg_name...
@@ -758,14 +758,19 @@ def install_python_packages(self)->bool: print(error) missing_packages.append(package) if missing_packages: + clean_pkg = re.sub(r'\[.*?\]', '', package) + pkg_name = re.split(r'[<>...
lib/classes/device_installer.py
26
Python
0.643
suggestion
344
51
51
false
v26.1.27
1,595
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
print(error) missing_packages.append(package) elif '<' in spec_str: if (imajor > rmajor) or (imajor == rmajor and iminor >= rminor): error = f'{pkg_name...
`subprocess.check_call([... no_deps, package])` passes an empty-string argument when `no_deps == ''`, which can cause pip to error. Also, the current `pkg_name` parsing won’t detect `demucs @ git+...` (it will include the URL), so the `--no-deps` branch won’t trigger anyway. Build the pip args list conditionally (only ...
print(error) missing_packages.append(package) elif '<' in spec_str: if (imajor > rmajor) or (imajor == rmajor and iminor >= rminor): error = f'{pkg_name...
@@ -758,14 +758,19 @@ def install_python_packages(self)->bool: print(error) missing_packages.append(package) if missing_packages: + clean_pkg = re.sub(r'\[.*?\]', '', package) + pkg_name = re.split(r'[<>...
lib/classes/device_installer.py
26
Python
0.786
suggestion
441
51
51
false
v26.1.27
1,595
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
missing_packages.append(package) elif '<' in spec_str: if (imajor > rmajor) or (imajor == rmajor and iminor >= rminor): error = f'{pkg_name} (installed {installed_version}) >= restricted {...
The refactored command construction properly builds the pip install command as a list, which is the correct approach for subprocess calls. However, there's a critical bug: `pkg_name` on line 771 references the last value from the outer loop (line 663) rather than being extracted from the current `package` in the instal...
missing_packages.append(package) elif '<' in spec_str: if (imajor > rmajor) or (imajor == rmajor and iminor >= rminor): error = f'{pkg_name} (installed {installed_version}) >= restricted {...
@@ -767,10 +767,11 @@ def install_python_packages(self)->bool: with tqdm(total = len(packages), desc = 'Installation 0.00%', bar_format = '{desc}: {n_fmt}/{total_fmt} ', unit = 'step') as t: for package in tqdm(missing_packages, desc = 'Installing', unit = 'pkg'): ...
lib/classes/device_installer.py
26
Python
0.786
bug
657
51
51
false
v26.1.27
1,596
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
self.params['samplerate'] = self.models[self.session['fine_tuned']]['samplerate'][sub] model_path = self.models[self.session['fine_tuned']]['repo'].replace("[lang_iso1]", iso_dir).replace("[xxx]", sub) self.tts_key = model_path ...
The variable `speaker_argument` is initialized as an empty list `[]`, but it should be initialized as an empty dictionary `{}`. When the conditions on lines 72-77 are not met, `speaker_argument` will remain as an empty list. Later when it's unpacked with `**speaker_argument` (lines 106, 116, 179, 188), this will cause ...
self.params['samplerate'] = self.models[self.session['fine_tuned']]['samplerate'][sub] model_path = self.models[self.session['fine_tuned']]['repo'].replace("[lang_iso1]", iso_dir).replace("[xxx]", sub) self.tts_key = model_path ...
@@ -68,6 +68,7 @@ def convert(self, sentence_index:int, sentence:str)->bool: sentence_parts = self._split_sentence_on_sml(sentence) if not self._set_voice(): return False + speaker_argument = []
lib/classes/tts_engines/vits.py
26
Python
1
suggestion
629
51
51
false
v26.1.28
1,600
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir', torch_pkg, torchaudio_pkg]) else: subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--no-cache-d...
The glob.glob function is being used here, but the glob module is not imported in this file. You need to add 'import glob' or 'from glob import glob' at the top of the file to avoid a NameError at runtime.
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir', torch_pkg, torchaudio_pkg]) else: subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--no-cache-d...
@@ -889,6 +889,27 @@ def install_device_packages(self, device_info_str:str)->int: error = f'Error while installing torch package: {e}' print(error) return 1 + if device_info['os'] == 'li...
lib/classes/device_installer.py
26
Python
0.643
suggestion
205
29
50
false
v26.2.1
1,612
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
# NOTE!!NOTE!!!NOTE!!NOTE!!!NOTE!!NOTE!!!NOTE!!NOTE!!! # THE WORD "CHAPTER" IN THE CODE DOES NOT MEAN # IT'S THE REAL CHAPTER OF THE EBOOK SINCE NO STANDARDS # ARE DEFINING A CHAPTER ON .EPUB FORMAT. THE WORD "BLOCK" # IS USED TO PRINT IT OUT TO THE TERMINAL, AND "CHAPTER" TO THE CODE # WHICH IS LESS GENERIC FOR THE DE...
The newly added `Tuple` import from `typing` is not used anywhere in this module; consider removing it to avoid unused imports and keep the import list minimal. ```suggestion from typing import Any, TypeAlias, Generator, Callable, Iterable, Dict ```
# NOTE!!NOTE!!!NOTE!!NOTE!!!NOTE!!NOTE!!!NOTE!!NOTE!!! # THE WORD "CHAPTER" IN THE CODE DOES NOT MEAN # IT'S THE REAL CHAPTER OF THE EBOOK SINCE NO STANDARDS # ARE DEFINING A CHAPTER ON .EPUB FORMAT. THE WORD "BLOCK" # IS USED TO PRINT IT OUT TO THE TERMINAL, AND "CHAPTER" TO THE CODE # WHICH IS LESS GENERIC FOR THE DE...
@@ -10,7 +10,7 @@ import traceback, socket, unicodedata, urllib.request, uuid, zipfile, fitz, multiprocessing import ebooklib, gradio as gr, psutil, regex as re, requests, stanza, importlib, queue -from typing import Any, TypeAlias, Generator, Callable, Iterable, Dict +from typing import Any, TypeAlias, Generator, ...
lib/core.py
13
Python
1
suggestion
249
38
38
false
v26.2.1
1,615
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
# NOTE!!NOTE!!!NOTE!!NOTE!!!NOTE!!NOTE!!!NOTE!!NOTE!!! # THE WORD "CHAPTER" IN THE CODE DOES NOT MEAN # IT'S THE REAL CHAPTER OF THE EBOOK SINCE NO STANDARDS # ARE DEFINING A CHAPTER ON .EPUB FORMAT. THE WORD "BLOCK" # IS USED TO PRINT IT OUT TO THE TERMINAL, AND "CHAPTER" TO THE CODE # WHICH IS LESS GENERIC FOR THE DE...
Import of 'TypeAlias' is not used. Import of 'Callable' is not used. Import of 'Iterable' is not used. Import of 'Tuple' is not used. ```suggestion from typing import Any, Generator, Dict ```
# NOTE!!NOTE!!!NOTE!!NOTE!!!NOTE!!NOTE!!!NOTE!!NOTE!!! # THE WORD "CHAPTER" IN THE CODE DOES NOT MEAN # IT'S THE REAL CHAPTER OF THE EBOOK SINCE NO STANDARDS # ARE DEFINING A CHAPTER ON .EPUB FORMAT. THE WORD "BLOCK" # IS USED TO PRINT IT OUT TO THE TERMINAL, AND "CHAPTER" TO THE CODE # WHICH IS LESS GENERIC FOR THE DE...
@@ -10,7 +10,7 @@ import traceback, socket, unicodedata, urllib.request, uuid, zipfile, fitz, multiprocessing import ebooklib, gradio as gr, psutil, regex as re, requests, stanza, importlib, queue -from typing import Any, TypeAlias, Generator, Callable, Iterable, Dict +from typing import Any, TypeAlias, Generator, ...
lib/core.py
13
Python
0.929
suggestion
191
38
38
false
v26.2.1
1,615
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
except Exception as e: pass if session['metadata']['language'] != session['language']: error = f"WARNING!!! lan...
Here the error message reports `get_blocks() failed! {session['chapters']}`, but the failure is about block extraction, and `session['blocks']` is the relevant state for debugging. To make diagnostics clearer, it would be better to reference `session['blocks']` (or otherwise surface the problematic blocks) rather than ...
if lang_dict: session['metadata']['language'] = lang_dict.pt3 except Exception as e: pass ...
@@ -2695,16 +2697,16 @@ def convert_ebook(args:dict)->tuple: if is_lang_in_tts_engine: session['cover'] = get_cover(epubBook, session_id) if session['cover']: - ...
lib/core.py
26
Python
1
bug
484
51
51
false
v26.2.5b1
1,618
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
os.environ['SUNO_USE_SMALL_MODELS'] = "True" msg_extra += f"<br/>Switching BARK to SMALL models" else: os.environ['SUNO_OFFLOAD_CPU'] = "False" ...
When `checksum` is true, `session['chapters']` is populated from `json_chapters` here but later in `finalize_audiobook()` the chapters list is always rebuilt from `session['blocks']` and then saved back to the same JSON file. As a result, the loaded JSON chapters are effectively never used for the audio generation path...
os.environ['SUNO_OFFLOAD_CPU'] = "True" os.environ['SUNO_USE_SMALL_MODELS'] = "True" msg_extra += f"<br/>Switching BARK to SMALL models" else: ...
@@ -2656,13 +2657,14 @@ def convert_ebook(args:dict)->tuple: checksum_path = os.path.join(session['process_dir'], 'checksum') checksum, error = compare_checksums(session['ebook'], checksum_path) if error is None: - ...
lib/core.py
26
Python
0.857
performance
914
51
51
false
v26.2.5b1
1,618
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
out = bytearray() for ch in s: b = ch.encode('utf-8') if len(out) + len(b) > budget: break out.extend(b) return out.decode('utf-8') + ellipsis def sanitize_meta_chapter_title(title:str, max_bytes:int=140)->str: # avoid None and embedded NULs which some muxers acciden...
The loop variable 'key' is defined but never used. The function accepts a 'dir' parameter which is already the specific directory to clean. This loop should be removed as it serves no purpose - the function is already called separately for each directory (chapters_dir and sentences_dir) at lines 2749-2750. ```suggestio...
if len(raw) <= max_bytes: return s if len(e) >= max_bytes: # return as many bytes of the ellipsis as fit return e[:max_bytes].decode('utf-8', errors='ignore') budget = max_bytes - len(e) out = bytearray() for ch in s: b = ch.encode('utf-8') if len(out) + len(b...
@@ -2399,11 +2405,11 @@ def sanitize_meta_chapter_title(title:str, max_bytes:int=140)->str: return ellipsize_utf8_bytes(title, max_bytes=max_bytes, ellipsis='…') def delete_proc_audio_files(dir:str)->None: - for key in ("chapters_dir", "sentences_dir"): - base = Path(dir) - for file in base.glob(f"[0-9]*.{def...
lib/core.py
26
Python
0.857
suggestion
449
51
51
false
v26.2.19
1,632
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL