before_code
stringlengths
30
149k
reviewer_comment
stringlengths
16
20.6k
after_code
stringlengths
30
163k
diff_context
stringlengths
0
22.4k
file_path
stringlengths
6
155
comment_line
int64
0
26
language
stringclasses
19 values
quality_score
float64
0.07
1
comment_type
stringclasses
9 values
comment_length
int64
16
20.6k
before_lines
int64
2
4.61k
after_lines
int64
2
4.4k
is_negative
bool
2 classes
pr_title
stringlengths
7
140
pr_number
int64
18
61.2k
repo_name
stringclasses
29 values
repo_stars
int64
321
56k
repo_language
stringclasses
14 values
reviewer_username
stringclasses
378 values
author_username
stringclasses
739 values
user
stringlengths
361
200k
assistant
stringlengths
16
20.6k
system
stringclasses
1 value
conda update -n base -c conda-forge conda -y conda update --all -y conda clean --index-cache -y conda clean --packages --tarballs -y conda create --prefix "$SCRIPT_DIR/$PYTHON_ENV" python=$PYTHON_VERSION -y || return 1 source "$CONDA_ENV" || return 1 conda activate "$SCRIPT_DIR/$PYTHON_ENV" || return 1 ...
The output redirection uses '>nul' which is Windows syntax. On Unix-like systems (bash), the correct redirection should be '>/dev/null' or '2>&1' for stderr. The '>nul' redirection will create a file named 'nul' in the current directory instead of suppressing output.
conda update -n base -c conda-forge conda -y conda update --all -y conda clean --index-cache -y conda clean --packages --tarballs -y conda create --prefix "$SCRIPT_DIR/$PYTHON_ENV" python=$PYTHON_VERSION -y || return 1 source "$CONDA_ENV" || return 1 conda activate "$SCRIPT_DIR/$PYTHON_ENV" || return 1 ...
@@ -626,7 +626,7 @@ function check_docker { function install_python_packages { echo "[ebook2audiobook] Installing dependencies..." python3 -m pip cache purge > /dev/null 2>&1 - python3 -m pip install --upgrade pip pip setuptools wheel >nul 2>&1 + python3 -m pip install --upgrade pip setuptools wheel >nul 2>&1
ebook2audiobook.sh
26
Shell
0.643
suggestion
267
51
51
false
v25.12.18
1,356
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Shell File: ebook2audiobook.sh PR Title: v25.12.18 BEFORE CODE: conda update -n base -c conda-forge conda -y conda update --all -y conda clean --index-cache -y conda clean --packages --tarballs -y conda create --prefix "$SCRIPT_DIR/$PYTHON_ENV" python=$PYTHON_VER...
The output redirection uses '>nul' which is Windows syntax. On Unix-like systems (bash), the correct redirection should be '>/dev/null' or '2>&1' for stderr. The '>nul' redirection will create a file named 'nul' in the current directory instead of suppressing output.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
class BackgroundDetector: def __init__(self, wav_file:str): self.wav_file = wav_file device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model = Model.from_pretrained( default_voice_detection_model, cache_dir=tts_dir ) self.pipeline ...
The `_get_pipeline()` method lacks a docstring explaining its purpose and lazy initialization behavior. This is important for maintainability, especially since this is a non-trivial pattern that defers expensive model loading.
def __init__(self, wav_file: str): self.wav_file = wav_file self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu") self.total_duration = librosa.get_duration(path=self.wav_file) self._pipeline = None def _get_pipeline(self): if self._pipeline is not None: return self._pipeline mo...
@@ -9,34 +8,49 @@ class BackgroundDetector: - def __init__(self, wav_file:str): - self.wav_file = wav_file - device = torch.device("cuda" if torch.cuda.is_available() else "cpu") - model = Model.from_pretrained( - default_voice_detection_model, - cache_dir=tts_dir - ...
lib/classes/background_detector.py
26
Python
0.571
performance
226
33
47
false
v25.12.18
1,358
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/background_detector.py PR Title: v25.12.18 BEFORE CODE: class BackgroundDetector: def __init__(self, wav_file:str): self.wav_file = wav_file device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model = ...
The `_get_pipeline()` method lacks a docstring explaining its purpose and lazy initialization behavior. This is important for maintainability, especially since this is a non-trivial pattern that defers expensive model loading.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
class BackgroundDetector: def __init__(self, wav_file:str): self.wav_file = wav_file device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model = Model.from_pretrained( default_voice_detection_model, cache_dir=tts_dir ) self.pipeline ...
The lazy initialization in `_get_pipeline()` is not thread-safe. If multiple threads call `detect()` simultaneously on the same instance, the pipeline could be initialized multiple times, potentially causing race conditions. Consider using a lock or ensuring single-threaded usage is documented.
def __init__(self, wav_file: str): self.wav_file = wav_file self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu") self.total_duration = librosa.get_duration(path=self.wav_file) self._pipeline = None def _get_pipeline(self): if self._pipeline is not None: return self._pipeline mo...
@@ -9,34 +8,49 @@ class BackgroundDetector: - def __init__(self, wav_file:str): - self.wav_file = wav_file - device = torch.device("cuda" if torch.cuda.is_available() else "cpu") - model = Model.from_pretrained( - default_voice_detection_model, - cache_dir=tts_dir - ...
lib/classes/background_detector.py
26
Python
0.786
bug
295
33
47
false
v25.12.18
1,358
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/background_detector.py PR Title: v25.12.18 BEFORE CODE: class BackgroundDetector: def __init__(self, wav_file:str): self.wav_file = wav_file device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model = ...
The lazy initialization in `_get_pipeline()` is not thread-safe. If multiple threads call `detect()` simultaneously on the same instance, the pipeline could be initialized multiple times, potentially causing race conditions. Consider using a lock or ensuring single-threaded usage is documented.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import librosa from pyannote.audio import Model from pyannote.audio.pipelines import VoiceActivityDetection from lib.conf import tts_dir from lib.models import default_voice_detection_model class BackgroundDetector: def __init__(self, wav_file: str): self.wav_file = wav_file self.device = torch.device("cuda" if...
The docstring claims the pipeline is "safe for multithreading and multiprocessing" but this is misleading. The caching mechanism with threading.Lock only addresses thread safety during pipeline initialization, not during concurrent inference calls. Additionally, the global module-level cache will not work correctly acr...
import librosa import threading from pyannote.audio import Model from pyannote.audio.pipelines import VoiceActivityDetection from lib.conf import tts_dir from lib.models import default_voice_detection_model _PIPELINE_CACHE = {} _PIPELINE_LOCK = threading.Lock() class BackgroundDetector: def __init__(self, wav_fi...
@@ -1,38 +1,57 @@ import torch import librosa +import threading from pyannote.audio import Model from pyannote.audio.pipelines import VoiceActivityDetection from lib.conf import tts_dir from lib.models import default_voice_detection_model + +_PIPELINE_CACHE = {} +_PIPELINE_LOCK = threading.Lock() + + class B...
lib/classes/background_detector.py
26
Python
0.643
performance
583
51
51
false
v25.12.18
1,359
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/background_detector.py PR Title: v25.12.18 BEFORE CODE: import librosa from pyannote.audio import Model from pyannote.audio.pipelines import VoiceActivityDetection from lib.conf import tts_dir from lib.models import default_voice_detection_model ...
The docstring claims the pipeline is "safe for multithreading and multiprocessing" but this is misleading. The caching mechanism with threading.Lock only addresses thread safety during pipeline initialization, not during concurrent inference calls. Additionally, the global module-level cache will not work correctly acr...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
from pyannote.audio import Model from pyannote.audio.pipelines import VoiceActivityDetection from lib.conf import tts_dir from lib.models import default_voice_detection_model class BackgroundDetector: def __init__(self, wav_file: str): self.wav_file = wav_file self.device = torch.device("cuda" if torch.cuda.is_a...
The cache key uses only device type (e.g., "cuda" or "cpu"), which doesn't account for multiple GPUs. If instances are created with different CUDA devices (e.g., cuda:0, cuda:1), they will all receive the same cached pipeline, potentially causing device mismatch errors. The key should incorporate the full device identi...
from pyannote.audio import Model from pyannote.audio.pipelines import VoiceActivityDetection from lib.conf import tts_dir from lib.models import default_voice_detection_model _PIPELINE_CACHE = {} _PIPELINE_LOCK = threading.Lock() class BackgroundDetector: def __init__(self, wav_file: str): self.wav_file = wav_...
@@ -1,38 +1,57 @@ import torch import librosa +import threading from pyannote.audio import Model from pyannote.audio.pipelines import VoiceActivityDetection from lib.conf import tts_dir from lib.models import default_voice_detection_model + +_PIPELINE_CACHE = {} +_PIPELINE_LOCK = threading.Lock() + + class B...
lib/classes/background_detector.py
26
Python
1
performance
633
51
51
false
v25.12.18
1,359
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/background_detector.py PR Title: v25.12.18 BEFORE CODE: from pyannote.audio import Model from pyannote.audio.pipelines import VoiceActivityDetection from lib.conf import tts_dir from lib.models import default_voice_detection_model class Background...
The cache key uses only device type (e.g., "cuda" or "cpu"), which doesn't account for multiple GPUs. If instances are created with different CUDA devices (e.g., cuda:0, cuda:1), they will all receive the same cached pipeline, potentially causing device mismatch errors. The key should incorporate the full device identi...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import torch import librosa import threading from pyannote.audio import Model from pyannote.audio.pipelines import VoiceActivityDetection from lib.conf import tts_dir from lib.models import default_voice_detection_model _PIPELINE_CACHE = {} _PIPELINE_LOCK = threading.Lock() class BackgroundDetector: def __init__...
The removal of the docstring from `_get_pipeline` eliminates important documentation about thread safety and caching behavior. This method implements a double-checked locking pattern for pipeline caching, and the docstring explaining this pattern should be retained to help future maintainers understand why this approac...
import torch import librosa import threading from pyannote.audio import Model from pyannote.audio.pipelines import VoiceActivityDetection from lib.conf import tts_dir from lib.models import default_voice_detection_model _PIPELINE_CACHE = {} _PIPELINE_LOCK = threading.Lock() class BackgroundDetector: def __init__(...
@@ -20,55 +19,37 @@ def __init__(self, wav_file: str): self.total_duration = librosa.get_duration(path=self.wav_file) def _get_pipeline(self) -> VoiceActivityDetection:
lib/classes/background_detector.py
21
Python
1
performance
1,227
46
46
false
v25.12.18
1,360
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/background_detector.py PR Title: v25.12.18 BEFORE CODE: import torch import librosa import threading from pyannote.audio import Model from pyannote.audio.pipelines import VoiceActivityDetection from lib.conf import tts_dir from lib.models import d...
The removal of the docstring from `_get_pipeline` eliminates important documentation about thread safety and caching behavior. This method implements a double-checked locking pattern for pipeline caching, and the docstring explaining this pattern should be retained to help future maintainers understand why this approac...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import subprocess, re, sys, gradio as gr class SubprocessPipe: def __init__(self, cmd:str, is_gui_process:bool, total_duration:float, msg:str='Processing'): self.cmd = cmd self.is_gui_process = is_gui_process self.total_duration = total_duration self.msg = msg self.process =...
The 'tqdm' module is imported but never used directly in the code. The code only parses tqdm output from subprocess stdout using regex. Consider removing this unused import. ```suggestion import os, subprocess, re, sys, gradio as gr ```
import os, subprocess, re, sys, tqdm, gradio as gr class SubprocessPipe: def __init__(self, cmd:str, is_gui_process:bool, total_duration:float, msg:str='Processing'): self.cmd = cmd self.is_gui_process = is_gui_process self.total_duration = total_duration self.msg = msg self...
@@ -1,4 +1,4 @@ -import subprocess, re, sys, gradio as gr +import os, subprocess, re, sys, tqdm, gradio as gr
lib/classes/subprocess_pipe.py
1
Python
0.857
suggestion
236
26
26
false
v25.12.19
1,363
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/subprocess_pipe.py PR Title: v25.12.19 BEFORE CODE: import subprocess, re, sys, gradio as gr class SubprocessPipe: def __init__(self, cmd:str, is_gui_process:bool, total_duration:float, msg:str='Processing'): self.cmd = cmd sel...
The 'tqdm' module is imported but never used directly in the code. The code only parses tqdm output from subprocess stdout using regex. Consider removing this unused import. ```suggestion import os, subprocess, re, sys, gradio as gr ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
msg = 'Background noise or music detected. Proceeding voice extraction...' else: msg = 'No background noise or music detected. Skipping separation...' return True,status,msg except Exception as e: error = f'_detect_background() error: {e}' ...
The error message when proc_pipe returns False is unclear. It should indicate why the subprocess failed rather than just stating the file path. Consider adding context like 'Demucs subprocess failed for file: {self.wav_file}'. ```suggestion error = f"_demucs_voice() error: Demucs subprocess failed f...
msg = 'Background noise or music detected. Proceeding voice extraction...' else: msg = 'No background noise or music detected. Skipping separation...' return True,status,msg except Exception as e: error = f'_detect_background() error: {e}' ...
@@ -96,26 +96,25 @@ def _demucs_voice(self)->tuple[bool, str]: self.wav_file ] try: - process = subprocess.run(cmd, check = True) - self.voice_track = os.path.join(self.demucs_dir, self.voice_track) - msg = 'Voice track isolation su...
lib/classes/voice_extractor.py
26
Python
1
bug
349
51
51
false
v25.12.19
1,363
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: msg = 'Background noise or music detected. Proceeding voice extraction...' else: msg = 'No background noise or music detected. Skipping separation...' ...
The error message when proc_pipe returns False is unclear. It should indicate why the subprocess failed rather than just stating the file path. Consider adding context like 'Demucs subprocess failed for file: {self.wav_file}'. ```suggestion error = f"_demucs_voice() error: Demucs subprocess failed f...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
try: if device_info_str: device_info = json.loads(device_info_str) if device_info: print(f'---> Hardware detected: {device_info}') torch_version = self.get_package_version('torch') if torch_version: ...
The conda install command uses '-d' flag which should be '-c' for specifying a channel. The correct flag for channel selection is '-c' or '--channel', not '-d'. ```suggestion subprocess.check_call(['conda', 'install', '-c', 'conda-forge', 'scikit-learn', '-y']) ```
print(f'---> Hardware detected: {device_info}') torch_version = self.get_package_version('torch') if torch_version: if device_info['tag'] not in ['cpu', 'unknown', 'unsupported']: m = re.search(r'\+(.+)$', to...
@@ -736,7 +732,7 @@ def install_device_packages(self, device_info_str:str)->int: subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir', torch_pkg]) subprocess.check_call([sys.executable, '-m', 'pip',...
lib/classes/device_installer.py
26
Python
0.857
suggestion
306
51
51
false
v25.12.19
1,363
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/device_installer.py PR Title: v25.12.19 BEFORE CODE: try: if device_info_str: device_info = json.loads(device_info_str) if device_info: print(f'---> Hardware detected: {device_...
The conda install command uses '-d' flag which should be '-c' for specifying a channel. The correct flag for channel selection is '-c' or '--channel', not '-d'. ```suggestion subprocess.check_call(['conda', 'install', '-c', 'conda-forge', 'scikit-learn', '-y']) ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if key in _PIPELINE_CACHE: return _PIPELINE_CACHE[key] with _PIPELINE_LOCK: if key in _PIPELINE_CACHE: return _PIPELINE_CACHE[key] model = Model.from_pretrained( default_voice_detection_model, cache_dir=tts_dir ) pipeline = VoiceActivityDetection(segmentation=model) pipeline.instantiat...
The 'onset' and 'offset' parameters were removed from the pipeline instantiation without explanation. If these parameters are no longer needed, this change is fine, but if they were providing important thresholds for voice activity detection, their removal could affect detection accuracy. ```suggestion pipe...
Return a cached voice activity detection pipeline for the current device. This method uses a per-device cache backed by a global dictionary (`_PIPELINE_CACHE`) and protects lazy initialization with a global lock (`_PIPELINE_LOCK`). The implementation follows a double-checked locking ...
@@ -13,44 +13,57 @@ class BackgroundDetector: - def __init__(self, wav_file: str): - self.wav_file = wav_file - self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu") - self.total_duration = librosa.get_duration(path=self.wav_file) + def __init__(self, wav_file: str): + self.wav_fi...
lib/classes/background_detector.py
26
Python
0.857
suggestion
403
34
47
false
v25.12.19
1,363
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/background_detector.py PR Title: v25.12.19 BEFORE CODE: if key in _PIPELINE_CACHE: return _PIPELINE_CACHE[key] with _PIPELINE_LOCK: if key in _PIPELINE_CACHE: return _PIPELINE_CACHE[key] model = Model.from_pretrained( default_v...
The 'onset' and 'offset' parameters were removed from the pipeline instantiation without explanation. If these parameters are no longer needed, this change is fine, but if they were providing important thresholds for voice activity detection, their removal could affect detection accuracy. ```suggestion pipe...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
try: if device_info_str: device_info = json.loads(device_info_str) if device_info: print(f'---> Hardware detected: {device_info}') torch_version = self.get_package_version('torch') if torch_version: ...
The conda install command has an invalid flag. The `-d` flag is not a valid conda option. This should likely be `-c` to specify the channel. The correct command should be: `conda install -c conda-forge scikit-learn -y` ```suggestion subprocess.check_call(['conda', 'install', '-c'...
print(f'---> Hardware detected: {device_info}') torch_version = self.get_package_version('torch') if torch_version: if device_info['tag'] not in ['cpu', 'unknown', 'unsupported']: m = re.search(r'\+(.+)$', to...
@@ -736,7 +732,7 @@ def install_device_packages(self, device_info_str:str)->int: subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir', torch_pkg]) subprocess.check_call([sys.executable, '-m', 'pip',...
lib/classes/device_installer.py
26
Python
0.857
suggestion
363
51
51
false
v25.12.19
1,364
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/device_installer.py PR Title: v25.12.19 BEFORE CODE: try: if device_info_str: device_info = json.loads(device_info_str) if device_info: print(f'---> Hardware detected: {device_...
The conda install command has an invalid flag. The `-d` flag is not a valid conda option. This should likely be `-c` to specify the channel. The correct command should be: `conda install -c conda-forge scikit-learn -y` ```suggestion subprocess.check_call(['conda', 'install', '-c'...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
msg = 'Background noise or music detected. Proceeding voice extraction...' else: msg = 'No background noise or music detected. Skipping separation...' return True,status,msg except Exception as e: error = f'_detect_background() error: {e}' ...
The condition `if proc_pipe:` will always evaluate to True because `proc_pipe` is an object instance, not the boolean result of the subprocess execution. The `SubprocessPipe.__init__` method calls `_run_process()` internally but doesn't store or expose its return value. You need to either store the result of `_run_proc...
msg = 'Background noise or music detected. Proceeding voice extraction...' else: msg = 'No background noise or music detected. Skipping separation...' return True,status,msg except Exception as e: error = f'_detect_background() error: {e}' ...
@@ -96,26 +96,25 @@ def _demucs_voice(self)->tuple[bool, str]: self.wav_file ] try: - process = subprocess.run(cmd, check = True) - self.voice_track = os.path.join(self.demucs_dir, self.voice_track) - msg = 'Voice track isolation su...
lib/classes/voice_extractor.py
26
Python
0.857
suggestion
876
51
51
false
v25.12.19
1,364
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: msg = 'Background noise or music detected. Proceeding voice extraction...' else: msg = 'No background noise or music detected. Skipping separation...' ...
The condition `if proc_pipe:` will always evaluate to True because `proc_pipe` is an object instance, not the boolean result of the subprocess execution. The `SubprocessPipe.__init__` method calls `_run_process()` internally but doesn't store or expose its return value. You need to either store the result of `_run_proc...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
raise ValueError(error) return False,False,error def _demucs_voice(self)->tuple[bool, str]: try: cmd = [ "demucs", "--verbose", "--two-stems=vocals", "--out", self.output_dir, self.wav_file ...
The exception is caught and an error message is set, but the exception is not re-raised and execution continues to the next except block. This means `subprocess.CalledProcessError` will never be properly handled. Either remove this except block if it's no longer needed, or ensure the error is properly returned or raise...
raise ValueError(error) return False,False,error def _demucs_voice(self)->tuple[bool, str]: try: cmd = [ "demucs", "--verbose", "--two-stems=vocals", "--out", self.output_dir, self.wav_file ...
@@ -96,26 +96,25 @@ def _demucs_voice(self)->tuple[bool, str]: self.wav_file ] try: - process = subprocess.run(cmd, check = True) - self.voice_track = os.path.join(self.demucs_dir, self.voice_track) - msg = 'Voice track isolation su...
lib/classes/voice_extractor.py
26
Python
0.786
refactor
322
51
51
false
v25.12.19
1,364
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: raise ValueError(error) return False,False,error def _demucs_voice(self)->tuple[bool, str]: try: cmd = [ "demucs", ...
The exception is caught and an error message is set, but the exception is not re-raised and execution continues to the next except block. This means `subprocess.CalledProcessError` will never be properly handled. Either remove this except block if it's no longer needed, or ensure the error is properly returned or raise...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
try: cmd = [ "demucs", "--verbose", "--two-stems=vocals", "--out", self.output_dir, self.wav_file ] try: process = subprocess.run(cmd, check = True) self.voice_trac...
The exception is caught and an error message is set, but the exception is not re-raised and execution continues to the outer except block. This means this generic exception handler will never properly handle exceptions. Either remove this except block if it's no longer needed, or ensure the error is properly returned o...
try: cmd = [ "demucs", "--verbose", "--two-stems=vocals", "--out", self.output_dir, self.wav_file ] try: proc_pipe = SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process...
@@ -96,26 +96,25 @@ def _demucs_voice(self)->tuple[bool, str]: self.wav_file ] try: - process = subprocess.run(cmd, check = True) - self.voice_track = os.path.join(self.demucs_dir, self.voice_track) - msg = 'Voice track isolation su...
lib/classes/voice_extractor.py
26
Python
0.643
refactor
329
51
51
false
v25.12.19
1,364
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: try: cmd = [ "demucs", "--verbose", "--two-stems=vocals", "--out", self.output_dir, self.wav_fil...
The exception is caught and an error message is set, but the exception is not re-raised and execution continues to the outer except block. This means this generic exception handler will never properly handle exceptions. Either remove this except block if it's no longer needed, or ensure the error is properly returned o...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
import subprocess, re, sys, gradio as gr class SubprocessPipe: def __init__(self, cmd:str, is_gui_process:bool, total_duration:float, msg:str='Processing'): self.cmd = cmd self.is_gui_process = is_gui_process self.total_duration = total_duration self.msg = msg self.process =...
The `tqdm` module is imported but never used in the code. The code only parses tqdm output via regex patterns, but doesn't actually use the tqdm library itself. Consider removing this unused import. ```suggestion import os, subprocess, re, sys, gradio as gr ```
import os, subprocess, re, sys, tqdm, gradio as gr class SubprocessPipe: def __init__(self, cmd:str, is_gui_process:bool, total_duration:float, msg:str='Processing'): self.cmd = cmd self.is_gui_process = is_gui_process self.total_duration = total_duration self.msg = msg self...
@@ -1,4 +1,4 @@ -import subprocess, re, sys, gradio as gr +import os, subprocess, re, sys, tqdm, gradio as gr
lib/classes/subprocess_pipe.py
1
Python
0.857
suggestion
261
26
26
false
v25.12.19
1,364
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/subprocess_pipe.py PR Title: v25.12.19 BEFORE CODE: import subprocess, re, sys, gradio as gr class SubprocessPipe: def __init__(self, cmd:str, is_gui_process:bool, total_duration:float, msg:str='Processing'): self.cmd = cmd sel...
The `tqdm` module is imported but never used in the code. The code only parses tqdm output via regex patterns, but doesn't actually use the tqdm library itself. Consider removing this unused import. ```suggestion import os, subprocess, re, sys, gradio as gr ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if key in _PIPELINE_CACHE: return _PIPELINE_CACHE[key] with _PIPELINE_LOCK: if key in _PIPELINE_CACHE: return _PIPELINE_CACHE[key] model = Model.from_pretrained( default_voice_detection_model, cache_dir=tts_dir ) pipeline = VoiceActivityDetection(segmentation=model) pipeline.instantiat...
The `onset` and `offset` parameters have been removed from the pipeline configuration. These parameters control the threshold for voice activity detection onset and offset. Removing them may significantly change the behavior of voice activity detection. If this change is intentional, ensure that the default values used...
Return a cached voice activity detection pipeline for the current device. This method uses a per-device cache backed by a global dictionary (`_PIPELINE_CACHE`) and protects lazy initialization with a global lock (`_PIPELINE_LOCK`). The implementation follows a double-checked locking ...
@@ -13,44 +13,57 @@ class BackgroundDetector: - def __init__(self, wav_file: str): - self.wav_file = wav_file - self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu") - self.total_duration = librosa.get_duration(path=self.wav_file) + def __init__(self, wav_file: str): + self.wav_fi...
lib/classes/background_detector.py
26
Python
0.857
suggestion
529
34
47
false
v25.12.19
1,364
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/background_detector.py PR Title: v25.12.19 BEFORE CODE: if key in _PIPELINE_CACHE: return _PIPELINE_CACHE[key] with _PIPELINE_LOCK: if key in _PIPELINE_CACHE: return _PIPELINE_CACHE[key] model = Model.from_pretrained( default_v...
The `onset` and `offset` parameters have been removed from the pipeline configuration. These parameters control the threshold for voice activity detection onset and offset. Removing them may significantly change the behavior of voice activity detection. If this change is intentional, ensure that the default values used...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
def _demucs_voice(self)->tuple[bool, str]: try: cmd = [ "demucs", "--verbose", "--two-stems=vocals", "--out", self.output_dir, self.wav_file ] try: process = subprocess.run(cm...
The exception is caught and an error message is set, but the exception is not re-raised and execution continues to the next except block. This means `FileNotFoundError` will never be properly handled. Either remove this except block if it's no longer needed, or ensure the error is properly returned or raised. ```sugges...
def _demucs_voice(self)->tuple[bool, str]: try: cmd = [ "demucs", "--verbose", "--two-stems=vocals", "--out", self.output_dir, self.wav_file ] try: proc_pipe = SubprocessPipe(...
@@ -96,26 +96,25 @@ def _demucs_voice(self)->tuple[bool, str]: self.wav_file ] try: - process = subprocess.run(cmd, check = True) - self.voice_track = os.path.join(self.demucs_dir, self.voice_track) - msg = 'Voice track isolation su...
lib/classes/voice_extractor.py
26
Python
1
refactor
515
51
51
false
v25.12.19
1,364
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: def _demucs_voice(self)->tuple[bool, str]: try: cmd = [ "demucs", "--verbose", "--two-stems=vocals", "--out...
The exception is caught and an error message is set, but the exception is not re-raised and execution continues to the next except block. This means `FileNotFoundError` will never be properly handled. Either remove this except block if it's no longer needed, or ensure the error is properly returned or raised. ```sugges...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
try: if device_info_str: device_info = json.loads(device_info_str) if device_info: print(f'---> Hardware detected: {device_info}') torch_version = self.get_package_version('torch') if torch_version: ...
There are two consecutive spaces before the '-y' flag in the command list: `'scikit-learn', '-y'`. While this won't cause a functional issue since these are separate list elements, it's inconsistent with typical code formatting. Consider using single space for consistency. ```suggestion ...
print(f'---> Hardware detected: {device_info}') torch_version = self.get_package_version('torch') if torch_version: if device_info['tag'] not in ['cpu', 'unknown', 'unsupported']: m = re.search(r'\+(.+)$', to...
@@ -736,7 +732,7 @@ def install_device_packages(self, device_info_str:str)->int: subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir', torch_pkg]) subprocess.check_call([sys.executable, '-m', 'pip',...
lib/classes/device_installer.py
26
Python
0.857
suggestion
419
51
51
false
v25.12.19
1,364
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/device_installer.py PR Title: v25.12.19 BEFORE CODE: try: if device_info_str: device_info = json.loads(device_info_str) if device_info: print(f'---> Hardware detected: {device_...
There are two consecutive spaces before the '-y' flag in the command list: `'scikit-learn', '-y'`. While this won't cause a functional issue since these are separate list elements, it's inconsistent with typical code formatting. Consider using single space for consistency. ```suggestion ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
self.voice_file = voice_file self.voice_name = voice_name self.voice_track = 'vocals.wav' self.samplerate = models[session['tts_engine']][session['fine_tuned']]['samplerate'] self.output_dir = self.session['voice_dir'] self.demucs_dir = os.path.join(self.output_dir,'htdem...
The return value from SubprocessPipe is no longer being checked. According to the SubprocessPipe implementation, the _run_process method returns False when the process fails or is stopped, and True only when the process completes successfully with returncode 0. Without checking this return value, the code will proceed ...
self.voice_file = voice_file self.voice_name = voice_name self.voice_track = 'vocals.wav' self.samplerate = models[session['tts_engine']][session['fine_tuned']]['samplerate'] self.output_dir = self.session['voice_dir'] self.demucs_dir = os.path.join(self.output_dir,'htdem...
@@ -46,17 +46,13 @@ def _convert2wav(self)->tuple[bool, str]: shutil.which('ffmpeg'), '-hide_banner', '-nostats', '-i', self.voice_file, '-ac', '1', '-y', self.wav_file ] - proc_pipe = SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_d...
lib/classes/voice_extractor.py
26
Python
0.929
bug
954
51
51
false
v25.12.19
1,365
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: self.voice_file = voice_file self.voice_name = voice_name self.voice_track = 'vocals.wav' self.samplerate = models[session['tts_engine']][session['fine_tuned']]['sa...
The return value from SubprocessPipe is no longer being checked. According to the SubprocessPipe implementation, the _run_process method returns False when the process fails or is stopped, and True only when the process completes successfully with returncode 0. Without checking this return value, the code will proceed ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
raise ValueError(error) return False, error def _detect_background(self)->tuple[bool,bool,str]: try: msg = 'Detecting any background noise or music...' print(msg) detector = BackgroundDetector(wav_file = self.wav_file) status,report = dete...
The return value from SubprocessPipe is no longer being checked. The _run_process method in SubprocessPipe returns False when the process fails and True when it succeeds. Without this check, the code assumes the demucs command always succeeds and immediately proceeds to construct the voice_track path and return success...
try: msg = 'Detecting any background noise or music...' print(msg) detector = BackgroundDetector(wav_file = self.wav_file) status,report = detector.detect(vad_ratio_thresh = 0.15) print(report) if status: msg = 'Background n...
@@ -95,27 +91,23 @@ def _demucs_voice(self)->tuple[bool, str]: "--out", self.output_dir, self.wav_file ] - try: - proc_pipe = SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_duration=self._get_audio_duration(self.wav_file)...
lib/classes/voice_extractor.py
26
Python
1
bug
871
51
51
false
v25.12.19
1,365
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: raise ValueError(error) return False, error def _detect_background(self)->tuple[bool,bool,str]: try: msg = 'Detecting any background noise or music...'...
The return value from SubprocessPipe is no longer being checked. The _run_process method in SubprocessPipe returns False when the process fails and True when it succeeds. Without this check, the code assumes the demucs command always succeeds and immediately proceeds to construct the voice_track path and return success...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
DependencyError(e) return 0 except Exception as e: error = f"get_audio_duration() Error: Failed to process {filepath}: {e}" print(error) return 0 def normalize_audio(self, src_file:str=None, proc_file:str=None, dst_file:str=None)->tuple[bool, str]...
The return value from SubprocessPipe is no longer being checked. The SubprocessPipe._run_process method returns False on failure and True on success. Without checking this return value, the code will proceed to check file existence even if ffmpeg failed, potentially producing misleading error messages. The original log...
error = '' try: src_file = src_file or self.voice_track proc_file = proc_file or self.proc_voice_file dst_file = dst_file or self.final_voice_file cmd = [shutil.which('ffmpeg'), '-hide_banner', '-nostats', '-i', src_file] filter_complex = ( ...
@@ -241,20 +233,16 @@ def normalize_audio(self, src_file:str=None, proc_file:str=None, dst_file:str=No '-y', proc_file ] try: - proc_pipe = SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_duration=self._get_audio_duration(src_file), msg=...
lib/classes/voice_extractor.py
26
Python
0.929
bug
835
51
51
false
v25.12.19
1,365
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: DependencyError(e) return 0 except Exception as e: error = f"get_audio_duration() Error: Failed to process {filepath}: {e}" print(error) ...
The return value from SubprocessPipe is no longer being checked. The SubprocessPipe._run_process method returns False on failure and True on success. Without checking this return value, the code will proceed to check file existence even if ffmpeg failed, potentially producing misleading error messages. The original log...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
print(f'---> Hardware detected: {device_info}') torch_version = self.get_package_version('torch') if torch_version: if device_info['tag'] not in ['cpu', 'unknown', 'unsupported']: m = re.search(r'\+(.+)$', to...
The version check logic applies numpy constraint for torch versions <= 2.2.2. Consider adding a comment explaining why this constraint is necessary (likely due to compatibility issues between newer numpy versions and older torch versions) to help future maintainers understand this requirement. ```suggestion ...
print(f'---> Hardware detected: {device_info}') torch_version = self.get_package_version('torch') if torch_version: if device_info['tag'] not in ['cpu', 'unknown', 'unsupported']: m = re.search(r'\+(.+)$', to...
@@ -732,7 +732,9 @@ def install_device_packages(self, device_info_str:str)->int: subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir', torch_pkg]) subprocess.check_call([sys.executable, '-m', 'pip',...
lib/classes/device_installer.py
26
Python
0.857
bug
673
51
51
false
v25.12.19
1,366
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/device_installer.py PR Title: v25.12.19 BEFORE CODE: print(f'---> Hardware detected: {device_info}') torch_version = self.get_package_version('torch') if torch_version: ...
The version check logic applies numpy constraint for torch versions <= 2.2.2. Consider adding a comment explaining why this constraint is necessary (likely due to compatibility issues between newer numpy versions and older torch versions) to help future maintainers understand this requirement. ```suggestion ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
proc_file = proc_file or self.proc_voice_file dst_file = dst_file or self.final_voice_file cmd = [shutil.which('ffmpeg'), '-hide_banner', '-nostats', '-i', src_file] filter_complex = ( 'agate=threshold=-25dB:ratio=1.4:attack=10:release=250,' ...
The error message attempts to decode stderr, but if SubprocessPipe doesn't raise CalledProcessError (since it returns a boolean instead of raising exceptions), this catch block may never be reached. Additionally, the variable 'e' might not have a stderr attribute if SubprocessPipe behaves differently than expected. Con...
'equalizer=f=150:t=q:w=2:g=1,' 'equalizer=f=250:t=q:w=2:g=-3,' 'equalizer=f=3000:t=q:w=2:g=2,' 'equalizer=f=5500:t=q:w=2:g=-4,' 'equalizer=f=9000:t=q:w=2:g=-2,' 'highpass=f=63[audio]' ) cmd += [ ...
@@ -241,20 +233,16 @@ def normalize_audio(self, src_file:str=None, proc_file:str=None, dst_file:str=No '-y', proc_file ] try: - proc_pipe = SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_duration=self._get_audio_duration(src_file), msg=...
lib/classes/voice_extractor.py
26
Python
1
suggestion
749
51
51
false
v25.12.19
1,366
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: proc_file = proc_file or self.proc_voice_file dst_file = dst_file or self.final_voice_file cmd = [shutil.which('ffmpeg'), '-hide_banner', '-nostats', '-i', src_...
The error message attempts to decode stderr, but if SubprocessPipe doesn't raise CalledProcessError (since it returns a boolean instead of raising exceptions), this catch block may never be reached. Additionally, the variable 'e' might not have a stderr attribute if SubprocessPipe behaves differently than expected. Con...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
self.proc_voice_file = os.path.join(self.session['voice_dir'], f'{self.voice_name}_proc.wav') self.final_voice_file = os.path.join(self.session['voice_dir'], f'{self.voice_name}.wav') self.silence_threshold = -60 def _validate_format(self)->tuple[bool,str]: file_extension = os.path....
The refactored code no longer checks the return value of SubprocessPipe. If SubprocessPipe fails and returns False (or raises an exception), the code will continue to check if the file exists. However, based on SubprocessPipe's implementation, it doesn't raise exceptions on failure - it returns a boolean. The code shou...
self.proc_voice_file = os.path.join(self.session['voice_dir'], f'{self.voice_name}_proc.wav') self.final_voice_file = os.path.join(self.session['voice_dir'], f'{self.voice_name}.wav') self.silence_threshold = -60 def _validate_format(self)->tuple[bool,str]: file_extension = os.path....
@@ -46,17 +46,13 @@ def _convert2wav(self)->tuple[bool, str]: shutil.which('ffmpeg'), '-hide_banner', '-nostats', '-i', self.voice_file, '-ac', '1', '-y', self.wav_file ] - proc_pipe = SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_d...
lib/classes/voice_extractor.py
26
Python
0.643
bug
454
51
51
false
v25.12.19
1,366
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: self.proc_voice_file = os.path.join(self.session['voice_dir'], f'{self.voice_name}_proc.wav') self.final_voice_file = os.path.join(self.session['voice_dir'], f'{self.voice_name}.wa...
The refactored code no longer checks the return value of SubprocessPipe. If SubprocessPipe fails and returns False (or raises an exception), the code will continue to check if the file exists. However, based on SubprocessPipe's implementation, it doesn't raise exceptions on failure - it returns a boolean. The code shou...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
def _detect_background(self)->tuple[bool,bool,str]: try: msg = 'Detecting any background noise or music...' print(msg) detector = BackgroundDetector(wav_file = self.wav_file) status,report = detector.detect(vad_ratio_thresh = 0.15) print(report) ...
The refactored code no longer checks the return value of SubprocessPipe. If SubprocessPipe fails and returns False, the code will continue to set self.voice_track and return success. Based on SubprocessPipe's implementation, it returns a boolean to indicate success/failure but doesn't raise exceptions. The code should ...
detector = BackgroundDetector(wav_file = self.wav_file) status,report = detector.detect(vad_ratio_thresh = 0.15) print(report) if status: msg = 'Background noise or music detected. Proceeding voice extraction...' else: msg = 'No...
@@ -95,27 +91,23 @@ def _demucs_voice(self)->tuple[bool, str]: "--out", self.output_dir, self.wav_file ] - try: - proc_pipe = SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_duration=self._get_audio_duration(self.wav_file)...
lib/classes/voice_extractor.py
26
Python
0.643
bug
378
51
51
false
v25.12.19
1,366
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: def _detect_background(self)->tuple[bool,bool,str]: try: msg = 'Detecting any background noise or music...' print(msg) detector = BackgroundDetector...
The refactored code no longer checks the return value of SubprocessPipe. If SubprocessPipe fails and returns False, the code will continue to set self.voice_track and return success. Based on SubprocessPipe's implementation, it returns a boolean to indicate success/failure but doesn't raise exceptions. The code should ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
try: src_file = src_file or self.voice_track proc_file = proc_file or self.proc_voice_file dst_file = dst_file or self.final_voice_file cmd = [shutil.which('ffmpeg'), '-hide_banner', '-nostats', '-i', src_file] filter_complex = ( 'agate...
The refactored code no longer checks the return value of SubprocessPipe. If SubprocessPipe fails and returns False, the code will continue to check if the file exists. Based on SubprocessPipe's implementation, it returns a boolean to indicate success/failure but doesn't raise exceptions. The code should check the retur...
'acompressor=threshold=-20dB:ratio=2:attack=80:release=200:makeup=1dB,' 'loudnorm=I=-14:TP=-3:LRA=7:linear=true,' 'equalizer=f=150:t=q:w=2:g=1,' 'equalizer=f=250:t=q:w=2:g=-3,' 'equalizer=f=3000:t=q:w=2:g=2,' 'equalizer=f=55...
@@ -241,20 +233,16 @@ def normalize_audio(self, src_file:str=None, proc_file:str=None, dst_file:str=No '-y', proc_file ] try: - proc_pipe = SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_duration=self._get_audio_duration(src_file), msg=...
lib/classes/voice_extractor.py
26
Python
0.643
bug
370
51
51
false
v25.12.19
1,366
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: try: src_file = src_file or self.voice_track proc_file = proc_file or self.proc_voice_file dst_file = dst_file or self.final_voice_file cmd ...
The refactored code no longer checks the return value of SubprocessPipe. If SubprocessPipe fails and returns False, the code will continue to check if the file exists. Based on SubprocessPipe's implementation, it returns a boolean to indicate success/failure but doesn't raise exceptions. The code should check the retur...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
def _validate_format(self)->tuple[bool,str]: file_extension = os.path.splitext(self.voice_file)[1].lower() if file_extension in voice_formats: msg = 'Input file is valid' return True,msg error = f'Unsupported file format: {file_extension}. Supported formats are: {", ...
Error message is incomplete and provides no actionable information. Consider including details about what went wrong, such as process exit code or stderr output if available from the SubprocessPipe object. ```suggestion # SubprocessPipe indicates a failure; include any available diagnostics. ...
def _validate_format(self)->tuple[bool,str]: file_extension = os.path.splitext(self.voice_file)[1].lower() if file_extension in voice_formats: msg = 'Input file is valid' return True,msg error = f'Unsupported file format: {file_extension}. Supported formats are: {", ...
@@ -46,13 +46,17 @@ def _convert2wav(self)->tuple[bool, str]: shutil.which('ffmpeg'), '-hide_banner', '-nostats', '-i', self.voice_file, '-ac', '1', '-y', self.wav_file ] - SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_duration=self...
lib/classes/voice_extractor.py
26
Python
1
bug
1,199
51
51
false
v25.12.19
1,367
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: def _validate_format(self)->tuple[bool,str]: file_extension = os.path.splitext(self.voice_file)[1].lower() if file_extension in voice_formats: msg = 'Input file is...
Error message is incomplete and provides no actionable information. Consider including details about what went wrong, such as process exit code or stderr output if available from the SubprocessPipe object. ```suggestion # SubprocessPipe indicates a failure; include any available diagnostics. ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
msg = 'No background noise or music detected. Skipping separation...' return True,status,msg except Exception as e: error = f'_detect_background() error: {e}' raise ValueError(error) return False,False,error def _demucs_voice(self)->tuple[bool...
Error message is incomplete and provides no actionable information. Consider including details about what went wrong, such as process exit code or stderr output if available from the SubprocessPipe object. ```suggestion details_parts = [] returncode = getattr(proc, "returncode", None) ...
print(report) if status: msg = 'Background noise or music detected. Proceeding voice extraction...' else: msg = 'No background noise or music detected. Skipping separation...' return True,status,msg except Exception as e: ...
@@ -91,10 +95,13 @@ def _demucs_voice(self)->tuple[bool, str]: "--out", self.output_dir, self.wav_file ] - SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_duration=self._get_audio_duration(self.wav_file), msg='Denoising') - se...
lib/classes/voice_extractor.py
26
Python
1
bug
917
51
51
false
v25.12.19
1,367
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: msg = 'No background noise or music detected. Skipping separation...' return True,status,msg except Exception as e: error = f'_detect_background() e...
Error message is incomplete and provides no actionable information. Consider including details about what went wrong, such as process exit code or stderr output if available from the SubprocessPipe object. ```suggestion details_parts = [] returncode = getattr(proc, "returncode", None) ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
cmd += [ '-filter_complex', filter_complex, '-map', '[audio]', '-ar', f'{default_audio_proc_samplerate}', '-y', proc_file ] try: SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_du...
Error message is incomplete and provides no actionable information. Consider including details about what went wrong, such as process exit code or stderr output if available from the SubprocessPipe object.
'equalizer=f=250:t=q:w=2:g=-3,' 'equalizer=f=3000:t=q:w=2:g=2,' 'equalizer=f=5500:t=q:w=2:g=-4,' 'equalizer=f=9000:t=q:w=2:g=-2,' 'highpass=f=63[audio]' ) cmd += [ '-filter_complex', filter_complex, ...
@@ -233,23 +239,34 @@ def normalize_audio(self, src_file:str=None, proc_file:str=None, dst_file:str=No '-y', proc_file ] try: - SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_duration=self._get_audio_duration(src_file), msg='Normalize')...
lib/classes/voice_extractor.py
26
Python
0.643
bug
205
51
51
false
v25.12.19
1,367
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: cmd += [ '-filter_complex', filter_complex, '-map', '[audio]', '-ar', f'{default_audio_proc_samplerate}', '-y', proc_fil...
Error message is incomplete and provides no actionable information. Consider including details about what went wrong, such as process exit code or stderr output if available from the SubprocessPipe object.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
Exec=$SCRIPT_DIR/ebook2audiobook.sh Icon=$ICON_PATH Terminal=true Categories=Utility; EOF chmod +x "$MENU_ENTRY" mkdir -p "$HOME/Desktop" 2>&1 > /dev/null cp "$MENU_ENTRY" "$DESKTOP_SHORTCUT" chmod +x "$DESKTOP_SHORTCUT" if command -v update-desktop-database >/dev/null 2>&1; then update-desktop-database ~/.local...
The logic appears inverted. The function `has_no_display` returns 0 (success/true) when a display IS present, so `! has_no_display` will be true when there's NO display, which contradicts the intended behavior of checking for desktop app viability. Consider changing to `|| has_no_display` without the negation.
open_desktop_app return 0 fi mkdir -p "$HOME/.local/share/applications" cat > "$MENU_ENTRY" <<EOF [Desktop Entry] Type=Application Name=ebook2audiobook Exec=$SCRIPT_DIR/ebook2audiobook.sh Icon=$ICON_PATH Terminal=true Categories=Utility; EOF chmod +x "$MENU_ENTRY" mkdir -p "$HOME/Desktop" 2>&1 > /dev/null cp ...
@@ -304,12 +312,12 @@ EOF } function check_desktop_app { - if [[ " ${ARGS[*]} " == *" --headless "* || has_no_display -eq 1 ]]; then + if [[ " ${ARGS[*]} " == *" --headless "* ]] || ! has_no_display; then
ebook2audiobook.sh
26
Shell
0.643
suggestion
311
51
51
false
v25.12.19
1,367
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Shell File: ebook2audiobook.sh PR Title: v25.12.19 BEFORE CODE: Exec=$SCRIPT_DIR/ebook2audiobook.sh Icon=$ICON_PATH Terminal=true Categories=Utility; EOF chmod +x "$MENU_ENTRY" mkdir -p "$HOME/Desktop" 2>&1 > /dev/null cp "$MENU_ENTRY" "$DESKTOP_SHORTCUT" chmod +x "$DE...
The logic appears inverted. The function `has_no_display` returns 0 (success/true) when a display IS present, so `! has_no_display` will be true when there's NO display, which contradicts the intended behavior of checking for desktop app viability. Consider changing to `|| has_no_display` without the negation.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
#!/usr/bin/env bash if [[ "$OSTYPE" == darwin* && -z "$SWITCHED_TO_ZSH" && "$(ps -p $$ -o comm=)" != "zsh" ]]; then export SWITCHED_TO_ZSH=1 exec env zsh "$0" "$@" fi if [[ -n "$BASH_SOURCE" ]]; then script_path="${BASH_SOURCE[0]}" elif [[ -n "$ZSH_VERSION" ]]; then script_path="${(%):-%x}" else script_path="$0"...
Variable CURRENT_PYVENV should be quoted consistently with the defensive quoting pattern used elsewhere. Change to `\"$CURRENT_PYVENV\"`. ```suggestion echo -e "\e[31m=============== Error: Current python virtual environment detected: \"$CURRENT_PYVENV\"..\e[0m" ```
exit 1 fi build_docker_image "$device_info_str" || exit 1 elif [[ "$DOCKER_DEVICE_STR" != "" ]];then install_python_packages || exit 1 install_device_packages "${DOCKER_DEVICE_STR}" || exit 1 check_sitecustomized || exit 1 fi elif [[ "$SCRIPT_MODE" == "$NATIVE" ]]; then # Check if running in a...
@@ -766,21 +791,22 @@ else fi elif [[ "$SCRIPT_MODE" == "$NATIVE" ]]; then # Check if running in a Conda or Python virtual environment - if [[ -n "$CONDA_DEFAULT_ENV" ]]; then - current_pyvenv="$CONDA_PREFIX" - elif [[ -n "$VIRTUAL_ENV" ]]; then + if [[ -n "${CONDA_DEFAULT_ENV:-}" ]]; then + current_pyve...
ebook2audiobook.sh
26
Shell
1
suggestion
269
803
46
false
v25.12.19
1,367
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Shell File: ebook2audiobook.sh PR Title: v25.12.19 BEFORE CODE: #!/usr/bin/env bash if [[ "$OSTYPE" == darwin* && -z "$SWITCHED_TO_ZSH" && "$(ps -p $$ -o comm=)" != "zsh" ]]; then export SWITCHED_TO_ZSH=1 exec env zsh "$0" "$@" fi if [[ -n "$BASH_SOURCE" ]]; then scri...
Variable CURRENT_PYVENV should be quoted consistently with the defensive quoting pattern used elsewhere. Change to `\"$CURRENT_PYVENV\"`. ```suggestion echo -e "\e[31m=============== Error: Current python virtual environment detected: \"$CURRENT_PYVENV\"..\e[0m" ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
#!/usr/bin/env bash if [[ "$OSTYPE" == darwin* && -z "$SWITCHED_TO_ZSH" && "$(ps -p $$ -o comm=)" != "zsh" ]]; then export SWITCHED_TO_ZSH=1 exec env zsh "$0" "$@" fi if [[ -n "$BASH_SOURCE" ]]; then script_path="${BASH_SOURCE[0]}" elif [[ -n "$ZSH_VERSION" ]]; then script_path="${(%):-%x}" else script_path="$0"...
The condition checks if CURRENT_PYVENV is empty, but CURRENT_PYVENV is never assigned before this check (it's initialized as empty at line 5). This should check `current_pyvenv` (lowercase) which is set in lines 795 and 797, then assign to CURRENT_PYVENV. ```suggestion if [[ -z "${current_pyvenv:-}" ]]; then PYTHO...
fi device_info_str="$(check_device_info "${SCRIPT_MODE}")" if [[ "$device_info_str" == "" ]]; then echo "check_device_info() error: result is empty" exit 1 fi build_docker_image "$device_info_str" || exit 1 elif [[ "$DOCKER_DEVICE_STR" != "" ]];then install_python_packages || exit 1 insta...
@@ -766,21 +791,22 @@ else fi elif [[ "$SCRIPT_MODE" == "$NATIVE" ]]; then # Check if running in a Conda or Python virtual environment - if [[ -n "$CONDA_DEFAULT_ENV" ]]; then - current_pyvenv="$CONDA_PREFIX" - elif [[ -n "$VIRTUAL_ENV" ]]; then + if [[ -n "${CONDA_DEFAULT_ENV:-}" ]]; then + current_pyve...
ebook2audiobook.sh
26
Shell
1
suggestion
662
803
50
false
v25.12.19
1,367
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Shell File: ebook2audiobook.sh PR Title: v25.12.19 BEFORE CODE: #!/usr/bin/env bash if [[ "$OSTYPE" == darwin* && -z "$SWITCHED_TO_ZSH" && "$(ps -p $$ -o comm=)" != "zsh" ]]; then export SWITCHED_TO_ZSH=1 exec env zsh "$0" "$@" fi if [[ -n "$BASH_SOURCE" ]]; then scri...
The condition checks if CURRENT_PYVENV is empty, but CURRENT_PYVENV is never assigned before this check (it's initialized as empty at line 5). This should check `current_pyvenv` (lowercase) which is set in lines 795 and 797, then assign to CURRENT_PYVENV. ```suggestion if [[ -z "${current_pyvenv:-}" ]]; then PYTHO...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
else: if proc_file != dst_file: os.replace(proc_file, dst_file) shutil.rmtree(self.demucs_dir, ignore_errors = True) msg = 'Audio normalization successful!' return True, msg except sub...
Missing a period after the f-string interpolation placeholder. The error message should have proper punctuation between the exception message and the description. ```suggestion error = f'normalize_audio() FileNotFoundError: {e}. Input file or FFmpeg PATH not found!' ```
] try: proc = SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_duration=self._get_audio_duration(src_file), msg='Normalize') if not os.path.exists(proc_file) or os.path.getsize(proc_file) == 0: error = f'normalize_audio(...
@@ -233,23 +239,34 @@ def normalize_audio(self, src_file:str=None, proc_file:str=None, dst_file:str=No '-y', proc_file ] try: - SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_duration=self._get_audio_duration(src_file), msg='Normalize')...
lib/classes/voice_extractor.py
26
Python
1
suggestion
282
43
51
false
v25.12.19
1,368
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: else: if proc_file != dst_file: os.replace(proc_file, dst_file) shutil.rmtree(self.demucs_dir, ignore_errors = T...
Missing a period after the f-string interpolation placeholder. The error message should have proper punctuation between the exception message and the description. ```suggestion error = f'normalize_audio() FileNotFoundError: {e}. Input file or FFmpeg PATH not found!' ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
#!/usr/bin/env bash if [[ "$OSTYPE" == darwin* && -z "$SWITCHED_TO_ZSH" && "$(ps -p $$ -o comm=)" != "zsh" ]]; then export SWITCHED_TO_ZSH=1 exec env zsh "$0" "$@" fi if [[ -n "$BASH_SOURCE" ]]; then script_path="${BASH_SOURCE[0]}" elif [[ -n "$ZSH_VERSION" ]]; then script_path="${(%):-%x}" else script_path="$0"...
The condition checks if CURRENT_PYVENV is empty, but then assigns to CURRENT_PYVENV (uppercase), while earlier in the code at lines 794-797 it assigns to 'current_pyvenv' (lowercase). This inconsistency will cause the variable check to always pass since CURRENT_PYVENV won't be set by the earlier assignments. Either all...
exit 1 fi build_docker_image "$device_info_str" || exit 1 elif [[ "$DOCKER_DEVICE_STR" != "" ]];then install_python_packages || exit 1 install_device_packages "${DOCKER_DEVICE_STR}" || exit 1 check_sitecustomized || exit 1 fi elif [[ "$SCRIPT_MODE" == "$NATIVE" ]]; then # Check if running in a...
@@ -766,21 +791,22 @@ else fi elif [[ "$SCRIPT_MODE" == "$NATIVE" ]]; then # Check if running in a Conda or Python virtual environment - if [[ -n "$CONDA_DEFAULT_ENV" ]]; then - current_pyvenv="$CONDA_PREFIX" - elif [[ -n "$VIRTUAL_ENV" ]]; then + if [[ -n "${CONDA_DEFAULT_ENV:-}" ]]; then + current_pyve...
ebook2audiobook.sh
26
Shell
0.5
style
391
803
46
false
v25.12.19
1,368
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Shell File: ebook2audiobook.sh PR Title: v25.12.19 BEFORE CODE: #!/usr/bin/env bash if [[ "$OSTYPE" == darwin* && -z "$SWITCHED_TO_ZSH" && "$(ps -p $$ -o comm=)" != "zsh" ]]; then export SWITCHED_TO_ZSH=1 exec env zsh "$0" "$@" fi if [[ -n "$BASH_SOURCE" ]]; then scri...
The condition checks if CURRENT_PYVENV is empty, but then assigns to CURRENT_PYVENV (uppercase), while earlier in the code at lines 794-797 it assigns to 'current_pyvenv' (lowercase). This inconsistency will cause the variable check to always pass since CURRENT_PYVENV won't be set by the earlier assignments. Either all...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
def _validate_format(self)->tuple[bool,str]: file_extension = os.path.splitext(self.voice_file)[1].lower() if file_extension in voice_formats: msg = 'Input file is valid' return True,msg error = f'Unsupported file format: {file_extension}. Supported formats are: {", ...
The error message references 'normalize_audio()' but this code is in the '_convert2wav' method. The error message should reference the correct function name '_convert2wav()'. ```suggestion error = f'_convert2wav() SubprocessPipe Error:' ```
def _validate_format(self)->tuple[bool,str]: file_extension = os.path.splitext(self.voice_file)[1].lower() if file_extension in voice_formats: msg = 'Input file is valid' return True,msg error = f'Unsupported file format: {file_extension}. Supported formats are: {", ...
@@ -46,13 +46,17 @@ def _convert2wav(self)->tuple[bool, str]: shutil.which('ffmpeg'), '-hide_banner', '-nostats', '-i', self.voice_file, '-ac', '1', '-y', self.wav_file ] - SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_duration=self...
lib/classes/voice_extractor.py
26
Python
1
suggestion
260
51
51
false
v25.12.19
1,368
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: def _validate_format(self)->tuple[bool,str]: file_extension = os.path.splitext(self.voice_file)[1].lower() if file_extension in voice_formats: msg = 'Input file is...
The error message references 'normalize_audio()' but this code is in the '_convert2wav' method. The error message should reference the correct function name '_convert2wav()'. ```suggestion error = f'_convert2wav() SubprocessPipe Error:' ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
def _validate_format(self)->tuple[bool,str]: file_extension = os.path.splitext(self.voice_file)[1].lower() if file_extension in voice_formats: msg = 'Input file is valid' return True,msg error = f'Unsupported file format: {file_extension}. Supported formats are: {", ...
The error message ends with a colon but provides no additional information. Consider either adding specific error details or removing the trailing colon to make the message complete. ```suggestion error = 'normalize_audio() SubprocessPipe Error' ```
def _validate_format(self)->tuple[bool,str]: file_extension = os.path.splitext(self.voice_file)[1].lower() if file_extension in voice_formats: msg = 'Input file is valid' return True,msg error = f'Unsupported file format: {file_extension}. Supported formats are: {", ...
@@ -46,13 +46,17 @@ def _convert2wav(self)->tuple[bool, str]: shutil.which('ffmpeg'), '-hide_banner', '-nostats', '-i', self.voice_file, '-ac', '1', '-y', self.wav_file ] - SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_duration=self...
lib/classes/voice_extractor.py
26
Python
1
suggestion
269
51
51
false
v25.12.19
1,368
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: def _validate_format(self)->tuple[bool,str]: file_extension = os.path.splitext(self.voice_file)[1].lower() if file_extension in voice_formats: msg = 'Input file is...
The error message ends with a colon but provides no additional information. Consider either adding specific error details or removing the trailing colon to make the message complete. ```suggestion error = 'normalize_audio() SubprocessPipe Error' ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
return True,status,msg except Exception as e: error = f'_detect_background() error: {e}' raise ValueError(error) return False,False,error def _demucs_voice(self)->tuple[bool, str]: try: cmd = [ "demucs", "--...
The error message ends with a colon but provides no additional information. Consider either adding specific error details or removing the trailing colon to make the message complete.
if status: msg = 'Background noise or music detected. Proceeding voice extraction...' else: msg = 'No background noise or music detected. Skipping separation...' return True,status,msg except Exception as e: error = f'_detect_backgr...
@@ -91,10 +95,13 @@ def _demucs_voice(self)->tuple[bool, str]: "--out", self.output_dir, self.wav_file ] - SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_duration=self._get_audio_duration(self.wav_file), msg='Denoising') - se...
lib/classes/voice_extractor.py
26
Python
0.571
suggestion
182
51
51
false
v25.12.19
1,368
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: return True,status,msg except Exception as e: error = f'_detect_background() error: {e}' raise ValueError(error) return False,False,error ...
The error message ends with a colon but provides no additional information. Consider either adding specific error details or removing the trailing colon to make the message complete.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
cmd += [ '-filter_complex', filter_complex, '-map', '[audio]', '-ar', f'{default_audio_proc_samplerate}', '-y', proc_file ] try: SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_du...
The error message ends with a colon but provides no additional information. Consider either adding specific error details or removing the trailing colon to make the message complete. ```suggestion error = 'normalize_audio() SubprocessPipe Error' ```
'equalizer=f=250:t=q:w=2:g=-3,' 'equalizer=f=3000:t=q:w=2:g=2,' 'equalizer=f=5500:t=q:w=2:g=-4,' 'equalizer=f=9000:t=q:w=2:g=-2,' 'highpass=f=63[audio]' ) cmd += [ '-filter_complex', filter_complex, ...
@@ -233,23 +239,34 @@ def normalize_audio(self, src_file:str=None, proc_file:str=None, dst_file:str=No '-y', proc_file ] try: - SubprocessPipe(cmd, is_gui_process=self.session['is_gui_process'], total_duration=self._get_audio_duration(src_file), msg='Normalize')...
lib/classes/voice_extractor.py
26
Python
1
suggestion
273
51
51
false
v25.12.19
1,368
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/voice_extractor.py PR Title: v25.12.19 BEFORE CODE: cmd += [ '-filter_complex', filter_complex, '-map', '[audio]', '-ar', f'{default_audio_proc_samplerate}', '-y', proc_fil...
The error message ends with a colon but provides no additional information. Consider either adding specific error details or removing the trailing colon to make the message complete. ```suggestion error = 'normalize_audio() SubprocessPipe Error' ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
total_bytes += model_size_bytes(model) except Exception: pass gb = total_bytes / (1024 ** 3) return round(gb, 2) def load_xtts_builtin_list()->dict: try: if len(xtts_builtin_speakers_list) > 0: return xtts_builtin_speakers_list speakers_path = hf_hub_download(repo_id=models[TT...
The new apply_cuda_policy function should include type hints for its parameters to maintain consistency with the rest of the codebase. Consider adding: ```python def apply_cuda_policy(using_gpu: bool, enough_vram: bool, seed: int) -> None: ``` ```suggestion def apply_cuda_policy(using_gpu: bool, enough_vram: bool, seed...
total_bytes += model_size_bytes(model) except Exception: pass gb = total_bytes / (1024 ** 3) return round(gb, 2) def load_xtts_builtin_list()->dict: try: if len(xtts_builtin_speakers_list) > 0: return xtts_builtin_speakers_list speakers_path = hf_hub_download(repo_id=models[TT...
@@ -57,6 +57,26 @@ def load_xtts_builtin_list()->dict: "load_xtts_builtin_list() failed" ) from error +def apply_cuda_policy(using_gpu, enough_vram, seed):
lib/classes/tts_engines/common/utils.py
26
Python
1
suggestion
339
51
51
false
v25.12.20
1,382
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/common/utils.py PR Title: v25.12.20 BEFORE CODE: total_bytes += model_size_bytes(model) except Exception: pass gb = total_bytes / (1024 ** 3) return round(gb, 2) def load_xtts_builtin_list()->dict: try: if len(xtt...
The new apply_cuda_policy function should include type hints for its parameters to maintain consistency with the rest of the codebase. Consider adding: ```python def apply_cuda_policy(using_gpu: bool, enough_vram: bool, seed: int) -> None: ``` ```suggestion def apply_cuda_policy(using_gpu: bool, enough_vram: bool, seed...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
total_bytes += model_size_bytes(model) except Exception: pass gb = total_bytes / (1024 ** 3) return round(gb, 2) def load_xtts_builtin_list()->dict: try: if len(xtts_builtin_speakers_list) > 0: return xtts_builtin_speakers_list speakers_path = hf_hub_download(repo_id=models[TT...
The function parameters are missing type hints. Add type annotations for the parameters (using_gpu: bool, enough_vram: bool, seed: int) to maintain consistency with other functions in this file and improve code clarity. ```suggestion def apply_cuda_policy(using_gpu: bool, enough_vram: bool, seed: int) -> None: ```
total_bytes += model_size_bytes(model) except Exception: pass gb = total_bytes / (1024 ** 3) return round(gb, 2) def load_xtts_builtin_list()->dict: try: if len(xtts_builtin_speakers_list) > 0: return xtts_builtin_speakers_list speakers_path = hf_hub_download(repo_id=models[TT...
@@ -57,6 +57,26 @@ def load_xtts_builtin_list()->dict: "load_xtts_builtin_list() failed" ) from error +def apply_cuda_policy(using_gpu, enough_vram, seed):
lib/classes/tts_engines/common/utils.py
26
Python
0.929
suggestion
315
51
51
false
v25.12.20
1,383
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/common/utils.py PR Title: v25.12.20 BEFORE CODE: total_bytes += model_size_bytes(model) except Exception: pass gb = total_bytes / (1024 ** 3) return round(gb, 2) def load_xtts_builtin_list()->dict: try: if len(xtt...
The function parameters are missing type hints. Add type annotations for the parameters (using_gpu: bool, enough_vram: bool, seed: int) to maintain consistency with other functions in this file and improve code clarity. ```suggestion def apply_cuda_policy(using_gpu: bool, enough_vram: bool, seed: int) -> None: ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if session['audiobook'] is not None: return gr.update(choices=audiobook_options, value=session['audiobook']) else: return gr.update(choices=audiobook_options, value=audiobook_options[0][1]) ...
The indentation change introduces a logic bug. The session restoration code is now nested inside the else block, which means it only executes when data.get('id') returns a truthy value. However, when a new UUID is generated in line 1604 (when data.get('id') is falsy), the session restoration will be skipped entirely. T...
if session['audiobook'] in [option[1] for option in audiobook_options] else None ) if len(audiobook_options) > 0: if session['audiobook'] is not None: retur...
@@ -1600,9 +1604,9 @@ def change_gr_restore_session(data:DictProxy|None, state:dict, req:gr.Request)-> session = context.set_session(str(uuid.uuid4())) else: session = context.set_session(data.get('id')) - if len(active_sessions) ...
lib/gradio.py
26
Python
1
bug
718
51
51
false
v25.12.25
1,386
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.25 BEFORE CODE: if session['audiobook'] is not None: return gr.update(choices=audiobook_options, value=session['audiobook']) else: ...
The indentation change introduces a logic bug. The session restoration code is now nested inside the else block, which means it only executes when data.get('id') returns a truthy value. However, when a new UUID is generated in line 1604 (when data.get('id') is falsy), the session restoration will be skipped entirely. T...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if session['audiobook'] is not None: return gr.update(choices=audiobook_options, value=session['audiobook']) else: return gr.update(choices=audiobook_options, value=audiobook_options[0][1]) ...
The indentation change moves the session restoration logic inside the `else` block, which means `restore_session_from_data` will only be called when `data.get('id')` exists. Previously, restoration would occur for both new and existing sessions (based on the `active_sessions` and `data['status']` conditions). This chan...
if session['audiobook'] in [option[1] for option in audiobook_options] else None ) if len(audiobook_options) > 0: if session['audiobook'] is not None: retur...
@@ -1600,9 +1604,9 @@ def change_gr_restore_session(data:DictProxy|None, state:dict, req:gr.Request)-> session = context.set_session(str(uuid.uuid4())) else: session = context.set_session(data.get('id')) - if len(active_sessions) ...
lib/gradio.py
26
Python
0.857
bug
670
51
51
false
v25.12.25
1,387
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.25 BEFORE CODE: if session['audiobook'] is not None: return gr.update(choices=audiobook_options, value=session['audiobook']) else: ...
The indentation change moves the session restoration logic inside the `else` block, which means `restore_session_from_data` will only be called when `data.get('id')` exists. Previously, restoration would occur for both new and existing sessions (based on the `active_sessions` and `data['status']` conditions). This chan...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
[laughter] [laughs] [sighs] [music] [gasps] [clears throat] — or ... for hesitations ♪ for song lyrics C...
The conditional logic adds `speaker_wav` to `tts_dyn_params` only when the .pth file doesn't exist, but `speaker_wav` is already being passed unconditionally on line 191. This creates redundancy and potential confusion about which value takes precedence. Consider either removing the unconditional parameter or clarifyin...
[laughter] [laughs] [sighs] [music] [gasps] [clears throat] — or ... for hesitations ♪ for song lyrics C...
@@ -165,6 +165,9 @@ def convert(self, sentence_index:int, sentence:str)->bool: """ pth_voice_dir = os.path.join(bark_dir, speaker) pth_voice_file = os.path.join(bark_dir, speaker, f'{speaker}.pth') + tts_dyn_params = {} + ...
lib/classes/tts_engines/bark.py
26
Python
0.643
suggestion
344
51
51
false
v25.12.25
1,388
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/bark.py PR Title: v25.12.25 BEFORE CODE: [laughter] [laughs] [sighs] [music] [gasps] [clears...
The conditional logic adds `speaker_wav` to `tts_dyn_params` only when the .pth file doesn't exist, but `speaker_wav` is already being passed unconditionally on line 191. This creates redundancy and potential confusion about which value takes precedence. Consider either removing the unconditional parameter or clarifyin...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if len(audiobook_options) > 0: if session['audiobook'] is not None: return gr.update(choices=audiobook_options, value=session['audiobook']) else: return gr.update(choices=audio...
The condition `data.get('status', None) is None` is redundant. The `.get()` method already returns `None` by default when the key doesn't exist, so explicitly passing `None` as the second argument is unnecessary. Simplify to `data.get('status') is None`. ```suggestion if len(active_sessions) == 0 or...
session['audiobook'] = ( session['audiobook'] if session['audiobook'] in [option[1] for option in audiobook_options] else None ) if len(audiobook_options) > 0: ...
@@ -1604,9 +1609,9 @@ def change_gr_restore_session(data:DictProxy|None, state:dict, req:gr.Request)-> session = context.set_session(str(uuid.uuid4())) else: session = context.set_session(data.get('id')) - if len(active_sessio...
lib/gradio.py
26
Python
0.857
refactor
363
51
51
false
v25.12.25
1,389
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.25 BEFORE CODE: if len(audiobook_options) > 0: if session['audiobook'] is not None: return gr.update(choices=audiobook_options, value=session['au...
The condition `data.get('status', None) is None` is redundant. The `.get()` method already returns `None` by default when the key doesn't exist, so explicitly passing `None` as the second argument is unnecessary. Simplify to `data.get('status') is None`. ```suggestion if len(active_sessions) == 0 or...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
[laughter] [laughs] [sighs] [music] [gasps] [clears throat] — or ... for hesitations ♪ for song lyrics C...
The variable `tts_dyn_params` could be named more descriptively to clarify its purpose as conditional parameters. Consider renaming to `conditional_params` or `voice_fallback_params` to better convey that it contains fallback parameters when the voice file is missing.
[laughter] [laughs] [sighs] [music] [gasps] [clears throat] — or ... for hesitations ♪ for song lyrics C...
@@ -165,6 +165,9 @@ def convert(self, sentence_index:int, sentence:str)->bool: """ pth_voice_dir = os.path.join(bark_dir, speaker) pth_voice_file = os.path.join(bark_dir, speaker, f'{speaker}.pth') + tts_dyn_params = {} + ...
lib/classes/tts_engines/bark.py
26
Python
0.643
suggestion
268
51
51
false
v25.12.25
1,389
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/bark.py PR Title: v25.12.25 BEFORE CODE: [laughter] [laughs] [sighs] [music] [gasps] [clears...
The variable `tts_dyn_params` could be named more descriptively to clarify its purpose as conditional parameters. Consider renaming to `conditional_params` or `voice_fallback_params` to better convey that it contains fallback parameters when the voice file is missing.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if session: models = load_engine_presets(session['tts_engine']) if method == 'confirm_voice_del': selected_name = Path(voice_path).stem pattern = re.sub(r'\.wav$', '*.wav', voi...
The refactored logic has a subtle behavior change. In the original code, if voice_options[0][1] was None (which is possible since line 1164 shows ('Default', None) can be added to voice_options), session['voice'] would be set to None. The new code unconditionally sets session['voice'] to models[session['fine_tuned']]['...
def confirm_deletion(voice_path:str, custom_model:str, audiobook:str, id:str, method:str|None=None)->tuple: try: nonlocal models if method is not None: session = context.get_session(id) if session: ...
@@ -1067,8 +1073,10 @@ def confirm_deletion(voice_path:str, custom_model:str, audiobook:str, id:str, me shutil.rmtree(custom_model, ignore_errors=True) msg = f'Custom model {selected_name} deleted!' ...
lib/gradio.py
26
Python
0.857
refactor
829
51
51
false
v25.12.25
1,408
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.25 BEFORE CODE: if session: models = load_engine_presets(session['tts_engine']) if method == 'confirm_voice_del': sel...
The refactored logic has a subtle behavior change. In the original code, if voice_options[0][1] was None (which is possible since line 1164 shows ('Default', None) can be added to voice_options), session['voice'] would be set to None. The new code unconditionally sets session['voice'] to models[session['fine_tuned']]['...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
"xtts_top_p": float, "xtts_speed": float, #"xtts_gpt_cond_len": int, #"xtts_gpt_batch_size": int, "xtts_enable_text_splitting": bool ...
The audio_sentence variable is referenced but never defined. The line that extracts audio_sentence from the result (audio_sentence = result.get('wav') if isinstance(result, dict) else None) was removed in this change. This will cause a NameError when this code executes. You need to add the extraction of audio_sentence ...
"xtts_top_p": float, "xtts_speed": float, #"xtts_gpt_cond_len": int, #"xtts_gpt_batch_size": int, "xtts_enable_text_splitting": bool ...
@@ -207,7 +207,16 @@ def _check_xtts_builtin_speakers(self, voice_path:str, speaker:str)->str|bool: speaker_embedding=speaker_embedding, **fine_tuned_params, ) - audio_sentence = result.get('wav') if is...
lib/classes/tts_engines/common/utils.py
26
Python
0.643
refactor
357
51
51
false
v25.12.25
1,411
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/common/utils.py PR Title: v25.12.25 BEFORE CODE: "xtts_top_p": float, "xtts_speed": float, #"xtts_gpt_cond_len": int, ...
The audio_sentence variable is referenced but never defined. The line that extracts audio_sentence from the result (audio_sentence = result.get('wav') if isinstance(result, dict) else None) was removed in this change. This will cause a NameError when this code executes. You need to add the extraction of audio_sentence ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
pattern_speaker = re.compile(r"^.*?_speaker_(\d+)$") bark_options = [ (pattern_speaker.sub(r"Speaker \1", f.stem), str(f.with_suffix(".wav"))) for f in speakers_path.rglob(f"{lang}_spe...
Potential IndexError if voice_options is empty. The code accesses voice_options[0][1] without checking if the list is empty. This could occur if no voice files are found in any of the directories. Consider adding a check: 'if voice_options and voice_options[0][1] is not None' or handle the empty case explicitly before ...
pattern_speaker = re.compile(r"^.*?_speaker_(\d+)$") bark_options = [ (pattern_speaker.sub(r"Speaker \1", f.stem), str(f.with_suffix(".wav"))) for f in speakers_path.rglob(f"{lang}_spe...
@@ -1163,10 +1163,12 @@ def update_gr_voice_list(id:str)->dict: if session['tts_engine'] in [TTS_ENGINES['VITS'], TTS_ENGINES['FAIRSEQ'], TTS_ENGINES['TACOTRON2'], TTS_ENGINES['YOURTTS']]: voice_options = [('Default', None)] + sorted(voice_options, key=lambda x: x[0...
lib/gradio.py
26
Python
1
suggestion
541
51
51
false
v25.12.25
1,412
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.25 BEFORE CODE: pattern_speaker = re.compile(r"^.*?_speaker_(\d+)$") bark_options = [ (pattern_speaker.sub(r"Speaker \1", f.stem)...
Potential IndexError if voice_options is empty. The code accesses voice_options[0][1] without checking if the list is empty. This could occur if no voice files are found in any of the directories. Consider adding a check: 'if voice_options and voice_options[0][1] is not None' or handle the empty case explicitly before ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
bark_options = [ (pattern_speaker.sub(r"Speaker \1", f.stem), str(f.with_suffix(".wav"))) for f in speakers_path.rglob(f"{lang}_speaker_*.npz") ] voice_options ...
The comparison 'session['voice'] not in voice_options' is incorrect. The session['voice'] is a string path, but voice_options is a list of tuples in the format (label, path). This comparison will always be True because it's comparing a string to tuples. The correct check should iterate through the values: 'session['voi...
bark_options = [ (pattern_speaker.sub(r"Speaker \1", f.stem), str(f.with_suffix(".wav"))) for f in speakers_path.rglob(f"{lang}_speaker_*.npz") ] voice_options ...
@@ -1163,10 +1163,12 @@ def update_gr_voice_list(id:str)->dict: if session['tts_engine'] in [TTS_ENGINES['VITS'], TTS_ENGINES['FAIRSEQ'], TTS_ENGINES['TACOTRON2'], TTS_ENGINES['YOURTTS']]: voice_options = [('Default', None)] + sorted(voice_options, key=lambda x: x[0...
lib/gradio.py
26
Python
0.857
bug
561
51
51
false
v25.12.25
1,412
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.25 BEFORE CODE: bark_options = [ (pattern_speaker.sub(r"Speaker \1", f.stem), str(f.with_suffix(".wav"))) for f in speakers_p...
The comparison 'session['voice'] not in voice_options' is incorrect. The session['voice'] is a string path, but voice_options is a list of tuples in the format (label, path). This comparison will always be True because it's comparing a string to tuples. The correct check should iterate through the values: 'session['voi...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if self.session['free_vram_gb'] > models_loaded_size_gb: loaded_tts[key] = engine return engine except Exception as e: error = f'_load_checkpoint() error: {e}' print(error) return None def _load_engine_zs(self)-...
Potential UnboundLocalError: proc_voice_path is used in the exception handler (line 253) but is only defined inside a nested conditional block (line 228). If an exception occurs before proc_voice_path is defined, this will raise UnboundLocalError. Initialize proc_voice_path to an empty string or None at the beginning o...
if self.session['free_vram_gb'] > models_loaded_size_gb: loaded_tts[key] = engine return engine except Exception as e: error = f'_load_checkpoint() error: {e}' print(error) return None def _load_engine_zs(self)-...
@@ -150,6 +150,7 @@ def _load_engine_zs(self)->Any: raise ValueError(error) def _check_xtts_builtin_speakers(self, voice_path:str, speaker:str)->str|bool: + new_voice_path = ''
lib/classes/tts_engines/common/utils.py
26
Python
1
suggestion
450
51
51
false
v25.12.25
1,412
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/common/utils.py PR Title: v25.12.25 BEFORE CODE: if self.session['free_vram_gb'] > models_loaded_size_gb: loaded_tts[key] = engine return engine except Exception as e: ...
Potential UnboundLocalError: proc_voice_path is used in the exception handler (line 253) but is only defined inside a nested conditional block (line 228). If an exception occurs before proc_voice_path is defined, this will raise UnboundLocalError. Initialize proc_voice_path to an empty string or None at the beginning o...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) else: if session['tts_engine'] == TTS_ENGINES['BARK']: bark_visible = visible_gr_tab_bark_params return ( gr.update(value=show_rating(session['tts_engine'])), ...
Redundant condition: The else block at line 1343-1344 sets visible_custom_model to False, which is already set to False at line 1340. This redundant assignment can be removed or the condition can be simplified. ```suggestion ```
else: if session['tts_engine'] == TTS_ENGINES['BARK']: bark_visible = visible_gr_tab_bark_params return ( gr.update(value=show_rating(session['tts_engine'])), gr.update...
@@ -1337,14 +1336,12 @@ def change_gr_fine_tuned_list(selected:str, id:str)->tuple: if selected: session = context.get_session(id) if session: - models = load_engine_presets(session['tts_engine']) session['fine_tu...
lib/gradio.py
26
Python
0.857
suggestion
229
51
51
false
v25.12.25
1,412
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.25 BEFORE CODE: ) else: if session['tts_engine'] == TTS_ENGINES['BARK']: bark_visible = visible_gr_tab_bark_params ...
Redundant condition: The else block at line 1343-1344 sets visible_custom_model to False, which is already set to False at line 1340. This redundant assignment can be removed or the condition can be simplified. ```suggestion ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
] voice_options = builtin_options + eng_options + bark_options session['voice_dir'] = os.path.join(voices_dir, '__sessions', f"voice-{session['id']}", session['language']) os.makedirs(session['voice_dir'], exist_ok=T...
Missing fallback logic: When new_voice_path doesn't exist, the voice path is left unchanged, which could point to an invalid path. The original code had a fallback to models[session['fine_tuned']]['voice'] when the new_voice_path doesn't exist. Consider adding an else clause to handle this case, or setting session['voi...
] voice_options = builtin_options + eng_options + bark_options session['voice_dir'] = os.path.join(voices_dir, '__sessions', f"voice-{session['id']}", session['language']) os.makedirs(session['voice_dir'], exist_ok=T...
@@ -1163,10 +1163,12 @@ def update_gr_voice_list(id:str)->dict: if session['tts_engine'] in [TTS_ENGINES['VITS'], TTS_ENGINES['FAIRSEQ'], TTS_ENGINES['TACOTRON2'], TTS_ENGINES['YOURTTS']]: voice_options = [('Default', None)] + sorted(voice_options, key=lambda x: x[0...
lib/gradio.py
26
Python
1
suggestion
1,177
51
51
false
v25.12.25
1,412
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.25 BEFORE CODE: ] voice_options = builtin_options + eng_options + bark_options session['voice_dir'] = os.path.join(voices_dir, '__sessions', f"voice-...
Missing fallback logic: When new_voice_path doesn't exist, the voice path is left unchanged, which could point to an invalid path. The original code had a fallback to models[session['fine_tuned']]['voice'] when the new_voice_path doesn't exist. Consider adding an else clause to handle this case, or setting session['voi...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if f.is_file() ] if session.get('custom_model_dir'): voice_options.extend( (f.stem, str(f)) for f in Path(session['custom_model_dir']).rglob('*....
The bare except clause `except Exception:` silently catches all exceptions without logging them. This makes debugging difficult if there are unexpected errors accessing the models dictionary or session configuration. Consider logging the exception or at least being more specific about which exceptions to catch. ```sugg...
if f.is_file() ] if session.get('custom_model_dir'): voice_options.extend( (f.stem, str(f)) for f in Path(session['custom_model_dir']).rglob('*....
@@ -1164,11 +1164,22 @@ def update_gr_voice_list(id:str)->dict: voice_options = [('Default', None)] + sorted(voice_options, key=lambda x: x[0].lower()) else: voice_options = sorted(voice_options, key=lambda x: x[0].lower()) - ...
lib/gradio.py
26
Python
1
bug
559
51
51
false
v25.12.25
1,413
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.25 BEFORE CODE: if f.is_file() ] if session.get('custom_model_dir'): voice_options.extend( ...
The bare except clause `except Exception:` silently catches all exceptions without logging them. This makes debugging difficult if there are unexpected errors accessing the models dictionary or session configuration. Consider logging the exception or at least being more specific about which exceptions to catch. ```sugg...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if session.get('custom_model_dir'): voice_options.extend( (f.stem, str(f)) for f in Path(session['custom_model_dir']).rglob('*.wav') if f.is_file() ...
The error message variable name 'error' conflicts with potential naming conventions. Consider renaming to 'error_msg' or 'error_message' to avoid confusion with the exception object 'e'.
if session.get('custom_model_dir'): voice_options.extend( (f.stem, str(f)) for f in Path(session['custom_model_dir']).rglob('*.wav') if f.is_file() ...
@@ -1177,8 +1177,9 @@ def update_gr_voice_list(id:str)->dict: fine_tuned_cfg = models.get(session.get('fine_tuned')) if isinstance(fine_tuned_cfg, dict): fallback_voice = fine_tuned_cfg.get('vo...
lib/gradio.py
26
Python
0.571
suggestion
186
51
51
false
v25.12.25
1,414
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.25 BEFORE CODE: if session.get('custom_model_dir'): voice_options.extend( (f.stem, str(f)) for f in Path(session[...
The error message variable name 'error' conflicts with potential naming conventions. Consider renaming to 'error_msg' or 'error_message' to avoid confusion with the exception object 'e'.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
fine_tuned_params = { key.removeprefix("xtts_"): cast_type(self.session[key]) for key, cast_type in { "xtts_temperature": float, #"xtts_codec_temperature": float, ...
If `engine.inference()` returns `None` or a non-dictionary type, calling `result.get('wav')` will raise an AttributeError. Add validation to ensure `result` is a dictionary before calling `.get()`. ```suggestion ) if not isinstance(result, dict): ...
fine_tuned_params = { key.removeprefix("xtts_"): cast_type(self.session[key]) for key, cast_type in { "xtts_temperature": float, #"xtts_codec_temperature": float, ...
@@ -202,13 +202,14 @@ def _check_xtts_builtin_speakers(self, voice_path:str, speaker:str)->str|bool: if self.session.get(key) is not None } with torch.no_grad(): - audio_sentence = engine.inference( + ...
lib/classes/tts_engines/common/utils.py
26
Python
0.929
suggestion
506
51
51
false
v25.12.25
1,414
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/common/utils.py PR Title: v25.12.25 BEFORE CODE: fine_tuned_params = { key.removeprefix("xtts_"): cast_type(self.session[key]) for key, cast_type in { ...
If `engine.inference()` returns `None` or a non-dictionary type, calling `result.get('wav')` will raise an AttributeError. Add validation to ensure `result` is a dictionary before calling `.get()`. ```suggestion ) if not isinstance(result, dict): ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
version_str = toolkit_version_parse(version_out) cmp = toolkit_version_compare(version_str, xpu_version_range) if cmp == -1 or cmp == 1: msg = f'XPU {version_str} out of supported range {xpu_version_range}. Falling back to CPU.' elif cm...
The comparison `tag_letters == 'cu'` is incorrect. `re.match()` returns a Match object (or None), not a string. Use `tag_letters.group()` to extract the matched string, or compare using `tag_letters.group() if tag_letters else None`. ```suggestion tag_letters = re.match(r"[a-zA-Z]+", forced_tag) ...
version_str = toolkit_version_parse(version_out) cmp = toolkit_version_compare(version_str, xpu_version_range) if cmp == -1 or cmp == 1: msg = f'XPU {version_str} out of supported range {xpu_version_range}. Falling back to CPU.' elif cm...
@@ -542,8 +542,15 @@ def has_working_xpu(): # CPU # ============================================================ if tag is None: - name = 'cpu' - tag = 'cpu' + forced_tag = os.environ.get("DEVICE_TAG") + if forced_tag: + tag_letters =...
lib/classes/device_installer.py
26
Python
0.857
bug
390
51
51
false
README Typos
1,420
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/device_installer.py PR Title: README Typos BEFORE CODE: version_str = toolkit_version_parse(version_out) cmp = toolkit_version_compare(version_str, xpu_version_range) if cmp == -1 or cmp == 1: ...
The comparison `tag_letters == 'cu'` is incorrect. `re.match()` returns a Match object (or None), not a string. Use `tag_letters.group()` to extract the matched string, or compare using `tag_letters.group() if tag_letters else None`. ```suggestion tag_letters = re.match(r"[a-zA-Z]+", forced_tag) ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
cmp = toolkit_version_compare(version_str, xpu_version_range) if cmp == -1 or cmp == 1: msg = f'XPU {version_str} out of supported range {xpu_version_range}. Falling back to CPU.' elif cmp == 0: devices['XPU']['found'] = True ...
This nested ternary expression is difficult to read and maintain. Consider refactoring to a dictionary mapping or if-elif chain for better clarity. ```suggestion if tag_letters == 'cu': name = 'cuda' elif tag_letters == 'rocm': name = 'rocm' ...
cmp = toolkit_version_compare(version_str, xpu_version_range) if cmp == -1 or cmp == 1: msg = f'XPU {version_str} out of supported range {xpu_version_range}. Falling back to CPU.' elif cmp == 0: devices['XPU']['found'] = True ...
@@ -542,8 +542,15 @@ def has_working_xpu(): # CPU # ============================================================ if tag is None: - name = 'cpu' - tag = 'cpu' + forced_tag = os.environ.get("DEVICE_TAG") + if forced_tag: + tag_letters =...
lib/classes/device_installer.py
26
Python
0.857
refactor
606
51
51
false
README Typos
1,420
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/device_installer.py PR Title: README Typos BEFORE CODE: cmp = toolkit_version_compare(version_str, xpu_version_range) if cmp == -1 or cmp == 1: msg = f'XPU {version_str} out of supported range {xp...
This nested ternary expression is difficult to read and maintain. Consider refactoring to a dictionary mapping or if-elif chain for better clarity. ```suggestion if tag_letters == 'cu': name = 'cuda' elif tag_letters == 'rocm': name = 'rocm' ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
tag = 'xpu' else: msg = 'Intel GPU detected but Intel oneAPI Base Toolkit not installed.' # ============================================================ # APPLE MPS # ============================================================ eli...
The `re.match()` function returns a Match object, not a string. Comparing `tag_letters == 'cu'` will always be False. Extract the matched group using `tag_letters.group()` if a match is found, or use `re.match(r'^(cu|rocm|jetson|xpu|mps)', forced_tag)` and check `match.group(1)` to get the actual matched string. ```sug...
tag = 'xpu' else: msg = 'Intel GPU detected but Intel oneAPI Base Toolkit not installed.' # ============================================================ # APPLE MPS # ============================================================ eli...
@@ -542,8 +542,15 @@ def has_working_xpu(): # CPU # ============================================================ if tag is None: - name = 'cpu' - tag = 'cpu' + forced_tag = os.environ.get("DEVICE_TAG") + if forced_tag: + tag_letters =...
lib/classes/device_installer.py
26
Python
0.857
refactor
1,073
51
51
false
README Typos
1,421
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/device_installer.py PR Title: README Typos BEFORE CODE: tag = 'xpu' else: msg = 'Intel GPU detected but Intel oneAPI Base Toolkit not installed.' # ===================================...
The `re.match()` function returns a Match object, not a string. Comparing `tag_letters == 'cu'` will always be False. Extract the matched group using `tag_letters.group()` if a match is found, or use `re.match(r'^(cu|rocm|jetson|xpu|mps)', forced_tag)` and check `match.group(1)` to get the actual matched string. ```sug...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
cmp = toolkit_version_compare(version_str, xpu_version_range) if cmp == -1 or cmp == 1: msg = f'XPU {version_str} out of supported range {xpu_version_range}. Falling back to CPU.' elif cmp == 0: devices['XPU']['found'] = True ...
The nested ternary operators create a single line that is difficult to read and maintain. Consider refactoring this into a dictionary mapping or an if-elif-else chain for better readability. ```suggestion tag_match = re.match(r"[a-zA-Z]+", forced_tag) if tag_match: ta...
cmp = toolkit_version_compare(version_str, xpu_version_range) if cmp == -1 or cmp == 1: msg = f'XPU {version_str} out of supported range {xpu_version_range}. Falling back to CPU.' elif cmp == 0: devices['XPU']['found'] = True ...
@@ -542,8 +542,15 @@ def has_working_xpu(): # CPU # ============================================================ if tag is None: - name = 'cpu' - tag = 'cpu' + forced_tag = os.environ.get("DEVICE_TAG") + if forced_tag: + tag_letters =...
lib/classes/device_installer.py
26
Python
0.857
refactor
714
51
51
false
README Typos
1,421
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/device_installer.py PR Title: README Typos BEFORE CODE: cmp = toolkit_version_compare(version_str, xpu_version_range) if cmp == -1 or cmp == 1: msg = f'XPU {version_str} out of supported range {xp...
The nested ternary operators create a single line that is difficult to read and maintain. Consider refactoring this into a dictionary mapping or an if-elif-else chain for better readability. ```suggestion tag_match = re.match(r"[a-zA-Z]+", forced_tag) if tag_match: ta...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
elif cmp == 0: devices['XPU']['found'] = True name = 'xpu' tag = 'xpu' else: msg = 'Intel GPU detected but Intel oneAPI Base Toolkit not installed.' # ================================================...
The newly added line assumes that `tag_letters` is not None, but `re.match()` can return None if the pattern doesn't match. If `forced_tag` contains no letters (e.g., "123" or special characters only), this will raise an AttributeError when trying to call `.group(0)`. Consider checking if `tag_letters` is not None befo...
elif cmp == 0: devices['XPU']['found'] = True name = 'xpu' tag = 'xpu' else: msg = 'Intel GPU detected but Intel oneAPI Base Toolkit not installed.' # ================================================...
@@ -545,6 +545,7 @@ def has_working_xpu(): forced_tag = os.environ.get("DEVICE_TAG") if forced_tag: tag_letters = re.match(r"[a-zA-Z]+", forced_tag) + tag_letters = tag_letters.group(0).lower() name = 'cuda' if tag_letters == 'cu' else 'rocm' if...
lib/classes/device_installer.py
26
Python
1
bug
987
51
51
false
v25.12.26
1,422
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/device_installer.py PR Title: v25.12.26 BEFORE CODE: elif cmp == 0: devices['XPU']['found'] = True name = 'xpu' tag = 'xpu' else: msg = ...
The newly added line assumes that `tag_letters` is not None, but `re.match()` can return None if the pattern doesn't match. If `forced_tag` contains no letters (e.g., "123" or special characters only), this will raise an AttributeError when trying to call `.group(0)`. Consider checking if `tag_letters` is not None befo...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
elif cmp == 0: devices['XPU']['found'] = True name = 'xpu' tag = 'xpu' else: msg = 'Intel GPU detected but Intel oneAPI Base Toolkit not installed.' # ================================================...
The code assumes that `re.match()` will always return a match object, but it can return `None` if the pattern doesn't match. This will cause an `AttributeError: 'NoneType' object has no attribute 'group'` when calling `.group(0).lower()` on a None value. You should add a None check before accessing the match object, or...
elif cmp == 0: devices['XPU']['found'] = True name = 'xpu' tag = 'xpu' else: msg = 'Intel GPU detected but Intel oneAPI Base Toolkit not installed.' # ================================================...
@@ -545,6 +545,7 @@ def has_working_xpu(): forced_tag = os.environ.get("DEVICE_TAG") if forced_tag: tag_letters = re.match(r"[a-zA-Z]+", forced_tag) + tag_letters = tag_letters.group(0).lower() name = 'cuda' if tag_letters == 'cu' else 'rocm' if...
lib/classes/device_installer.py
26
Python
1
suggestion
1,038
51
51
false
v25.12.26
1,423
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/device_installer.py PR Title: v25.12.26 BEFORE CODE: elif cmp == 0: devices['XPU']['found'] = True name = 'xpu' tag = 'xpu' else: msg = ...
The code assumes that `re.match()` will always return a match object, but it can return `None` if the pattern doesn't match. This will cause an `AttributeError: 'NoneType' object has no attribute 'group'` when calling `.group(0).lower()` on a None value. You should add a None check before accessing the match object, or...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
print(f"Installing the right library packages for {device_info['name']}...") os_env = device_info['os'] arch = device_info['arch'] tag = device_info['tag'] ...
This commented-out code should be removed rather than left in the codebase. Leaving large blocks of commented code reduces code maintainability and can cause confusion about whether the code might be needed in the future. ```suggestion ```
print(f"Installing the right library packages for {device_info['name']}...") os_env = device_info['os'] arch = device_info['arch'] tag = device_info['tag'] ...
@@ -734,10 +734,11 @@ def install_device_packages(self, device_info_str:str)->int: torchaudio_pkg = f'{url}/cpu/torchaudio-{torch_version_base}-{torchaudio_tag_py}-{os_env}_{arch}.whl' subprocess.check_call([sys.executable, '-m', 'pip', '...
lib/classes/device_installer.py
26
Python
0.857
suggestion
240
51
51
false
v25.12.26
1,425
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/device_installer.py PR Title: v25.12.26 BEFORE CODE: print(f"Installing the right library packages for {device_info['name']}...") os_env = device_info['os'] ...
This commented-out code should be removed rather than left in the codebase. Leaving large blocks of commented code reduces code maintainability and can cause confusion about whether the code might be needed in the future. ```suggestion ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
os_env = device_info['os'] arch = device_info['arch'] tag = device_info['tag'] url = torch_matrix[device_info['tag']]['url'] toolkit_version...
The new installation command is missing the '--upgrade' flag that was present in the previous implementation (line 740). This could lead to situations where existing packages are not updated when they should be. Consider adding '--upgrade' to ensure consistent behavior with other installation paths in this function (se...
os_env = device_info['os'] arch = device_info['arch'] tag = device_info['tag'] url = torch_matrix[device_info['tag']]['url'] toolkit_version...
@@ -734,10 +734,11 @@ def install_device_packages(self, device_info_str:str)->int: torchaudio_pkg = f'{url}/cpu/torchaudio-{torch_version_base}-{torchaudio_tag_py}-{os_env}_{arch}.whl' subprocess.check_call([sys.executable, '-m', 'pip', '...
lib/classes/device_installer.py
26
Python
0.857
performance
627
50
51
false
v25.12.26
1,425
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/device_installer.py PR Title: v25.12.26 BEFORE CODE: os_env = device_info['os'] arch = device_info['arch'] tag = device_info['tag'] ...
The new installation command is missing the '--upgrade' flag that was present in the previous implementation (line 740). This could lead to situations where existing packages are not updated when they should be. Consider adding '--upgrade' to ensure consistent behavior with other installation paths in this function (se...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
-t "$DOCKER_IMG_NAME" \ . || return 1 fi if [[ -n "$cmd_options" ]]; then cmd_extra="$cmd_options " fi echo "Docker image ready! to run your docker: " echo "GUI mode:" echo " docker run ${cmd_extra}--rm -it -p 7860:7860 $DOCKER_IMG_NAME" echo "Headless mode:" echo " docker run ${cmd_extra}--rm -it -v \"...
The TAG variable is set here but not exported or declared as global. The `build_docker_image` function called at line 793 depends on this TAG variable being available. In bash, variables are inherited by functions in the same script, but it would be clearer to either export TAG or pass it as a parameter to make the dep...
fi echo "Docker image ready! to run your docker: " echo "GUI mode:" echo " docker run ${cmd_extra}--rm -it -p 7860:7860 $DOCKER_IMG_NAME" echo "Headless mode:" echo " docker run ${cmd_extra}--rm -it -v \"/my/real/ebooks/folder/absolute/path:/app/ebooks\" -v \"/my/real/output/folder/absolute/path:/app/audiobooks\"...
@@ -784,16 +779,17 @@ else if [[ "$SCRIPT_MODE" == "$BUILD_DOCKER" ]]; then if [[ "$DOCKER_DEVICE_STR" == "" ]]; then check_docker || exit 1 - if docker image inspect "$DOCKER_IMG_NAME" >/dev/null 2>&1; then - echo "[STOP] Docker image '$DOCKER_IMG_NAME' already exists. Aborting build." - echo "Delete ...
ebook2audiobook.sh
26
Shell
0.786
suggestion
481
51
51
false
v25.12.27
1,428
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Shell File: ebook2audiobook.sh PR Title: v25.12.27 BEFORE CODE: -t "$DOCKER_IMG_NAME" \ . || return 1 fi if [[ -n "$cmd_options" ]]; then cmd_extra="$cmd_options " fi echo "Docker image ready! to run your docker: " echo "GUI mode:" echo " docker run ${cmd_ext...
The TAG variable is set here but not exported or declared as global. The `build_docker_image` function called at line 793 depends on this TAG variable being available. In bash, variables are inherited by functions in the same script, but it would be clearer to either export TAG or pass it as a parameter to make the dep...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
url = torch_matrix[device_info['tag']]['url'] toolkit_version = "".join(c for c in tag if c.isdigit()) if device_info['name'] == devices['JETSON']['proc']: py_major, py_min...
The `--force` flag is not a valid pip option. The correct flag for forcing reinstallation is `--force-reinstall`. This will cause the pip command to fail with an "unrecognized arguments" error.
os_env = device_info['os'] arch = device_info['arch'] tag = device_info['tag'] url = torch_matrix[device_info['tag']]['url'] toolkit_version...
@@ -738,7 +741,7 @@ def install_device_packages(self, device_info_str:str)->int: #torch_pkg = f'{url}/{tag}/torch-{torch_version_base}%2B{tag}-{tag_py}-{os_env}_{arch}.whl' #torchaudio_pkg = f'{url}/{tag}/torchaudio-{torch_version_base}%2...
lib/classes/device_installer.py
26
Python
0.714
bug
193
48
51
false
v25.12.27
1,430
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/device_installer.py PR Title: v25.12.27 BEFORE CODE: url = torch_matrix[device_info['tag']]['url'] toolkit_version = "".join(c for c in tag if c.isdigit()) ...
The `--force` flag is not a valid pip option. The correct flag for forcing reinstallation is `--force-reinstall`. This will cause the pip command to fail with an "unrecognized arguments" error.
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
msg = 'Intel GPU detected but Intel oneAPI Base Toolkit not installed.' # ============================================================ # APPLE MPS # ============================================================ elif sys.platform == 'darwin' and arch in ('arm64', 'aarc...
The forced device tag logic has been moved outside the "if tag is None" block, which changes the behavior. Previously, DEVICE_TAG would only be checked when no device was detected. Now it will override any detected device, even if hardware was successfully detected. This makes the DEVICE_TAG environment variable more f...
msg = 'Intel GPU detected but Intel oneAPI Base Toolkit not installed.' # ============================================================ # APPLE MPS # ============================================================ elif sys.platform == 'darwin' and arch in ('arm64', 'aarc...
@@ -542,17 +542,20 @@ def has_working_xpu(): # CPU # ============================================================ if tag is None: - forced_tag = os.environ.get("DEVICE_TAG") - if forced_tag: - tag_letters = re.match(r"[a-zA-Z]+", forced_tag) + n...
lib/classes/device_installer.py
26
Python
0.5
suggestion
483
51
51
false
v25.12.27
1,432
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/device_installer.py PR Title: v25.12.27 BEFORE CODE: msg = 'Intel GPU detected but Intel oneAPI Base Toolkit not installed.' # ============================================================ # APPLE MPS # =...
The forced device tag logic has been moved outside the "if tag is None" block, which changes the behavior. Previously, DEVICE_TAG would only be checked when no device was detected. Now it will override any detected device, even if hardware was successfully detected. This makes the DEVICE_TAG environment variable more f...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
name = 'xpu' tag = 'xpu' else: msg = 'Intel GPU detected but Intel oneAPI Base Toolkit not installed.' # ============================================================ # APPLE MPS # =======================================...
This deeply nested ternary expression is difficult to read and maintain. Consider refactoring to use a dictionary mapping or if-elif chain for better readability and maintainability. ```suggestion tag_to_name = { 'cu': 'cuda', 'rocm': 'rocm', '...
name = 'xpu' tag = 'xpu' else: msg = 'Intel GPU detected but Intel oneAPI Base Toolkit not installed.' # ============================================================ # APPLE MPS # =======================================...
@@ -542,17 +542,20 @@ def has_working_xpu(): # CPU # ============================================================ if tag is None: - forced_tag = os.environ.get("DEVICE_TAG") - if forced_tag: - tag_letters = re.match(r"[a-zA-Z]+", forced_tag) + n...
lib/classes/device_installer.py
26
Python
0.857
refactor
487
51
51
false
v25.12.27
1,432
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/device_installer.py PR Title: v25.12.27 BEFORE CODE: name = 'xpu' tag = 'xpu' else: msg = 'Intel GPU detected but Intel oneAPI Base Toolkit not installed.' # =====...
This deeply nested ternary expression is difficult to read and maintain. Consider refactoring to use a dictionary mapping or if-elif chain for better readability and maintainability. ```suggestion tag_to_name = { 'cu': 'cuda', 'rocm': 'rocm', '...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
alert_exception(error, id) return gr.update(), gr.update(visible=False), gr.update(visible=False) def confirm_deletion(voice_path:str, custom_model:str, audiobook:str, id:str, method:str|None=None)->tuple: try: nonlocal models ...
The condition `session['custom_model'] in session['voice']` will raise a TypeError if `session['custom_model']` is None, since the `in` operator cannot be used with None as the left operand. This should check if both values are not None, or use a safer comparison like checking if `session['voice']` is not None and then...
alert_exception(error, id) return gr.update(), gr.update(visible=False), gr.update(visible=False) def confirm_deletion(voice_path:str, custom_model:str, audiobook:str, id:str, method:str|None=None)->tuple: try: nonlocal models ...
@@ -1073,10 +1073,7 @@ def confirm_deletion(voice_path:str, custom_model:str, audiobook:str, id:str, me shutil.rmtree(custom_model, ignore_errors=True) msg = f'Custom model {selected_name} deleted!' ...
lib/gradio.py
26
Python
0.786
suggestion
381
51
51
false
v25.12.28
1,438
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.28 BEFORE CODE: alert_exception(error, id) return gr.update(), gr.update(visible=False), gr.update(visible=False) def confirm_deletion(voice_path:str, custom_model:str, audiobook:s...
The condition `session['custom_model'] in session['voice']` will raise a TypeError if `session['custom_model']` is None, since the `in` operator cannot be used with None as the left operand. This should check if both values are not None, or use a safer comparison like checking if `session['voice']` is not None and then...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
for name, details in models.items() if details.get("lang") in ("multi", session["language"]) ] if session['fine_tuned'] in fine_tuned_options: fine_tuned = session['fine_tuned'] ...
The `voice_options` variable used here is a module-level variable that is only updated inside `update_gr_voice_list()`. When `change_gr_language()` is called, `voice_options` will contain voice options from the previous language, not the current one being switched to. This means the code will assign a voice from the wr...
] if session['fine_tuned'] in fine_tuned_options: fine_tuned = session['fine_tuned'] else: fine_tuned = default_fine_tuned session['fine_tuned'] = fine_tuned ...
@@ -1256,6 +1254,9 @@ def change_gr_language(selected:str, id:str)->tuple: if session: prev = session['language'] session['language'] = selected + if session['voice'] is not None: + if voice_op...
lib/gradio.py
26
Python
0.786
bug
521
51
51
false
v25.12.28
1,438
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.28 BEFORE CODE: for name, details in models.items() if details.get("lang") in ("multi", session["language"]) ] if session['fi...
The `voice_options` variable used here is a module-level variable that is only updated inside `update_gr_voice_list()`. When `change_gr_language()` is called, `voice_options` will contain voice options from the previous language, not the current one being switched to. This means the code will assign a voice from the wr...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
alert_exception(error, id) return gr.update(), gr.update(visible=False), gr.update(visible=False) def confirm_deletion(voice_path:str, custom_model:str, audiobook:str, id:str, method:str|None=None)->tuple: try: nonlocal models ...
This condition will raise a TypeError if `session['voice']` is None, since you cannot use the `in` operator with None. The check should verify that `session['voice']` is not None before using the `in` operator, or handle the case where either value could be None. ```suggestion if session...
alert_exception(error, id) return gr.update(), gr.update(visible=False), gr.update(visible=False) def confirm_deletion(voice_path:str, custom_model:str, audiobook:str, id:str, method:str|None=None)->tuple: try: nonlocal models ...
@@ -1073,10 +1073,7 @@ def confirm_deletion(voice_path:str, custom_model:str, audiobook:str, id:str, me shutil.rmtree(custom_model, ignore_errors=True) msg = f'Custom model {selected_name} deleted!' ...
lib/gradio.py
26
Python
1
suggestion
442
51
51
false
v25.12.28
1,439
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.28 BEFORE CODE: alert_exception(error, id) return gr.update(), gr.update(visible=False), gr.update(visible=False) def confirm_deletion(voice_path:str, custom_model:str, audiobook:s...
This condition will raise a TypeError if `session['voice']` is None, since you cannot use the `in` operator with None. The check should verify that `session['voice']` is not None before using the `in` operator, or handle the case where either value could be None. ```suggestion if session...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
for name, details in models.items() if details.get("lang") in ("multi", session["language"]) ] if session['fine_tuned'] in fine_tuned_options: fine_tuned = session['fine_tuned'] ...
This code references `voice_options` before it has been updated for the new language. The `update_gr_voice_list(id)` call on line 1265 populates `voice_options` with voices for the newly selected language, but this check occurs before that update. This means `voice_options` will contain voices from the previous languag...
] if session['fine_tuned'] in fine_tuned_options: fine_tuned = session['fine_tuned'] else: fine_tuned = default_fine_tuned session['fine_tuned'] = fine_tuned ...
@@ -1256,6 +1254,9 @@ def change_gr_language(selected:str, id:str)->tuple: if session: prev = session['language'] session['language'] = selected + if session['voice'] is not None: + if voice_op...
lib/gradio.py
26
Python
0.786
bug
751
51
51
false
v25.12.28
1,439
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.28 BEFORE CODE: for name, details in models.items() if details.get("lang") in ("multi", session["language"]) ] if session['fi...
This code references `voice_options` before it has been updated for the new language. The `update_gr_voice_list(id)` call on line 1265 populates `voice_options` with voices for the newly selected language, but this check occurs before that update. This means `voice_options` will contain voices from the previous languag...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if f.is_file() ] if session.get('custom_model_dir'): voice_options.extend( (f.stem, str(f)) for f in Path(session['custom_model_dir']).rglob('*....
The same bounds checking issue exists here. Accessing parts[idx + 1] on line 1176 without verifying that idx + 1 is within bounds can raise an IndexError if "voices" is the last component in the path. ```suggestion if "voices" in parts: idx = p...
for f in session_voice_dir.rglob(file_pattern) if f.is_file() ] if session.get('custom_model_dir'): voice_options.extend( (f.stem, str(f)) ...
@@ -1161,24 +1162,22 @@ def update_gr_voice_list(id:str)->dict: voice_options = [('Default', None)] + sorted(voice_options, key=lambda x: x[0].lower()) else: voice_options = sorted(voice_options, key=lambda x: x[0].lower()) - ...
lib/gradio.py
26
Python
0.929
suggestion
936
51
51
false
v25.12.28
1,440
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.28 BEFORE CODE: if f.is_file() ] if session.get('custom_model_dir'): voice_options.extend( ...
The same bounds checking issue exists here. Accessing parts[idx + 1] on line 1176 without verifying that idx + 1 is within bounds can raise an IndexError if "voices" is the last component in the path. ```suggestion if "voices" in parts: idx = p...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
(pattern_speaker.sub(r"Speaker \1", f.stem), str(f.with_suffix(".wav"))) for f in speakers_path.rglob(f"{lang}_speaker_*.npz") ] voice_options = builtin_options + eng_options + bark_options ...
The nested condition on line 1166 lacks a None check for session['voice_dir']. If session['voice_dir'] is None, the 'in' operation will raise a TypeError. Although session['voice_dir'] is set earlier in the function, it should be checked here to be defensive, or the logic should be restructured to guarantee it's not No...
bark_options = [ (pattern_speaker.sub(r"Speaker \1", f.stem), str(f.with_suffix(".wav"))) for f in speakers_path.rglob(f"{lang}_speaker_*.npz") ] voice_options ...
@@ -1161,24 +1162,22 @@ def update_gr_voice_list(id:str)->dict: voice_options = [('Default', None)] + sorted(voice_options, key=lambda x: x[0].lower()) else: voice_options = sorted(voice_options, key=lambda x: x[0].lower()) - ...
lib/gradio.py
26
Python
1
suggestion
447
51
51
false
v25.12.28
1,440
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.28 BEFORE CODE: (pattern_speaker.sub(r"Speaker \1", f.stem), str(f.with_suffix(".wav"))) for f in speakers_path.rglob(f"{lang}_speaker_*.npz") ...
The nested condition on line 1166 lacks a None check for session['voice_dir']. If session['voice_dir'] is None, the 'in' operation will raise a TypeError. Although session['voice_dir'] is set earlier in the function, it should be checked here to be defensive, or the logic should be restructured to guarantee it's not No...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if session.get('custom_model_dir'): voice_options.extend( (f.stem, str(f)) for f in Path(session['custom_model_dir']).rglob('*.wav') if f.is_file() ...
The condition on line 1178 is redundant. The else block at line 1178 already guarantees that session['voice'] is None (from the if condition on line 1165), so the additional check 'if session['voice'] is None' on line 1179 is unnecessary. ```suggestion if voice_options and voice_options[0][1...
] if session.get('custom_model_dir'): voice_options.extend( (f.stem, str(f)) for f in Path(session['custom_model_dir']).rglob('*.wav') if f.is_f...
@@ -1161,24 +1162,22 @@ def update_gr_voice_list(id:str)->dict: voice_options = [('Default', None)] + sorted(voice_options, key=lambda x: x[0].lower()) else: voice_options = sorted(voice_options, key=lambda x: x[0].lower()) - ...
lib/gradio.py
26
Python
0.786
suggestion
338
51
51
false
v25.12.28
1,440
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.28 BEFORE CODE: if session.get('custom_model_dir'): voice_options.extend( (f.stem, str(f)) for f in Path(session[...
The condition on line 1178 is redundant. The else block at line 1178 already guarantees that session['voice'] is None (from the if condition on line 1165), so the additional check 'if session['voice'] is None' on line 1179 is unnecessary. ```suggestion if voice_options and voice_options[0][1...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if f.is_file() ] if session.get('custom_model_dir'): voice_options.extend( (f.stem, str(f)) for f in Path(session['custom_model_dir']).rglob('*....
The code assumes that "voices" exists in the path parts without validation. If the voice path doesn't contain "voices" as a directory component, parts.index("voices") on line 1170 will raise a ValueError, which will be caught by the generic exception handler but could lead to unclear error messages. Consider adding val...
for f in session_voice_dir.rglob(file_pattern) if f.is_file() ] if session.get('custom_model_dir'): voice_options.extend( (f.stem, str(f)) ...
@@ -1161,24 +1162,22 @@ def update_gr_voice_list(id:str)->dict: voice_options = [('Default', None)] + sorted(voice_options, key=lambda x: x[0].lower()) else: voice_options = sorted(voice_options, key=lambda x: x[0].lower()) - ...
lib/gradio.py
26
Python
1
suggestion
1,147
51
51
false
v25.12.28
1,440
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.28 BEFORE CODE: if f.is_file() ] if session.get('custom_model_dir'): voice_options.extend( ...
The code assumes that "voices" exists in the path parts without validation. If the voice path doesn't contain "voices" as a directory component, parts.index("voices") on line 1170 will raise a ValueError, which will be caught by the generic exception handler but could lead to unclear error messages. Consider adding val...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
if f.is_file() ] if session.get('custom_model_dir'): voice_options.extend( (f.stem, str(f)) for f in Path(session['custom_model_dir']).rglob('*....
The code attempts to access parts[idx + 1] without verifying that idx + 1 is within bounds. If "voices" is the last directory component in the path, this will raise an IndexError. Add a bounds check to ensure idx + 1 is less than len(parts) before accessing it. ```suggestion if idx +...
for f in session_voice_dir.rglob(file_pattern) if f.is_file() ] if session.get('custom_model_dir'): voice_options.extend( (f.stem, str(f)) ...
@@ -1161,24 +1162,22 @@ def update_gr_voice_list(id:str)->dict: voice_options = [('Default', None)] + sorted(voice_options, key=lambda x: x[0].lower()) else: voice_options = sorted(voice_options, key=lambda x: x[0].lower()) - ...
lib/gradio.py
26
Python
0.929
suggestion
839
51
51
false
v25.12.28
1,440
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.28 BEFORE CODE: if f.is_file() ] if session.get('custom_model_dir'): voice_options.extend( ...
The code attempts to access parts[idx + 1] without verifying that idx + 1 is within bounds. If "voices" is the last directory component in the path, this will raise an IndexError. Add a bounds check to ensure idx + 1 is less than len(parts) before accessing it. ```suggestion if idx +...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
] if session.get('custom_model_dir'): voice_options.extend( (f.stem, str(f)) for f in Path(session['custom_model_dir']).rglob('*.wav') if f.is_f...
The added guard checks prevent potential IndexError when "voices" is not in parts or when idx + 1 exceeds the list length. However, the logic doesn't handle the case where the path structure is invalid but "voices" exists. If idx + 1 >= len(parts) and the if condition fails, the session voice is left unchanged, which m...
] if session.get('custom_model_dir'): voice_options.extend( (f.stem, str(f)) for f in Path(session['custom_model_dir']).rglob('*.wav') if f.is_f...
@@ -1167,16 +1167,18 @@ def update_gr_voice_list(id:str)->dict: if not any(v[1] == session['voice'] for v in voice_options): voice_path = Path(session['voice']) parts = list(voice_path.parts) - ...
lib/gradio.py
26
Python
1
bug
850
51
51
false
v25.12.28
1,446
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/gradio.py PR Title: v25.12.28 BEFORE CODE: ] if session.get('custom_model_dir'): voice_options.extend( (f.stem, str(f)) ...
The added guard checks prevent potential IndexError when "voices" is not in parts or when idx + 1 exceeds the list length. However, the logic doesn't handle the case where the path structure is invalid but "voices" exists. If idx + 1 >= len(parts) and the if condition fails, the session voice is left unchanged, which m...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
#"xtts_gpt_batch_size": int, "xtts_enable_text_splitting": bool }.items() if self.session.get(key) is not None } with torch.no_grad(): result = self.eng...
The detach().cpu() call at line 154 is redundant for tensors created at line 145 (which already calls detach().cpu()), but it handles the other branches (lines 147-149) where tensors are created without detach().cpu(). However, for numpy arrays and lists converted to tensors, detach() is unnecessary as they don't have ...
#"xtts_gpt_batch_size": int, "xtts_enable_text_splitting": bool }.items() if self.session.get(key) is not None } with torch.no_grad(): result = self.eng...
@@ -151,6 +151,7 @@ def convert(self, sentence_index:int, sentence:str)->bool: error = f"Unsupported XTTSv2 wav type: {type(audio_sentence)}" print(error) return False + audio_tensor = audio_tensor.detach().cpu...
lib/classes/tts_engines/xtts.py
26
Python
1
suggestion
490
51
51
false
v25.12.28
1,446
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/xtts.py PR Title: v25.12.28 BEFORE CODE: #"xtts_gpt_batch_size": int, "xtts_enable_text_splitting": bool }.items() if self.session.g...
The detach().cpu() call at line 154 is redundant for tensors created at line 145 (which already calls detach().cpu()), but it handles the other branches (lines 147-149) where tensors are created without detach().cpu(). However, for numpy arrays and lists converted to tensors, detach() is unnecessary as they don't have ...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
sentence, #speaker_wav=self.params['voice_path'], speaker=speaker, voice_dir=pth_voice_dir, **fine_tuned_params ) """ ...
The `.cpu()` call here is redundant. `torch.tensor()` creates a CPU tensor by default unless a device parameter is explicitly specified. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion elif isins...
sentence, #speaker_wav=self.params['voice_path'], speaker=speaker, voice_dir=pth_voice_dir, **fine_tuned_params ) """ ...
@@ -202,10 +202,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/bark.py
26
Python
0.929
suggestion
467
51
51
false
v25.12.28
1,450
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/bark.py PR Title: v25.12.28 BEFORE CODE: sentence, #speaker_wav=self.params['voice_path'], speaker=speaker, voice_dir=pth_vo...
The `.cpu()` call here is redundant. `torch.tensor()` creates a CPU tensor by default unless a device parameter is explicitly specified. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion elif isins...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
audio_sentence = self.engine_zs.voice_conversion( source_wav=source_wav, target_wav=target_wav ) else: error = f'Engine {self.tts_zs_key} is None' ...
The `.cpu()` call here is redundant. `torch.from_numpy()` always creates a CPU tensor since numpy arrays exist only on CPU. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion ```
audio_sentence = self.engine_zs.voice_conversion( source_wav=source_wav, target_wav=target_wav ) else: error = f'Engine {self.tts_zs_key} is None' ...
@@ -183,10 +183,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/vits.py
26
Python
0.786
suggestion
277
51
51
false
v25.12.28
1,450
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/vits.py PR Title: v25.12.28 BEFORE CODE: audio_sentence = self.engine_zs.voice_conversion( source_wav=source_wav, target_wav=target_wav ...
The `.cpu()` call here is redundant. `torch.from_numpy()` always creates a CPU tensor since numpy arrays exist only on CPU. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
The `.cpu()` call here is redundant. `torch.tensor()` creates a CPU tensor by default unless a device parameter is explicitly specified. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion ```
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
@@ -183,10 +183,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/vits.py
26
Python
0.786
suggestion
290
51
51
false
v25.12.28
1,450
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/vits.py PR Title: v25.12.28 BEFORE CODE: ) else: error = f'Engine {self.tts_zs_key} is None' print(error) ...
The `.cpu()` call here is redundant. `torch.tensor()` creates a CPU tensor by default unless a device parameter is explicitly specified. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
audio_sentence = self.engine_zs.voice_conversion( source_wav=source_wav, target_wav=target_wav ) else: error = f'Engine {self.tts_zs_key} is None' ...
The `.cpu()` call here is redundant. `torch.from_numpy()` always creates a CPU tensor since numpy arrays exist only on CPU. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion ```
audio_sentence = self.engine_zs.voice_conversion( source_wav=source_wav, target_wav=target_wav ) else: error = f'Engine {self.tts_zs_key} is None' ...
@@ -198,10 +198,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/tacotron.py
26
Python
0.786
suggestion
277
51
51
false
v25.12.28
1,450
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/tacotron.py PR Title: v25.12.28 BEFORE CODE: audio_sentence = self.engine_zs.voice_conversion( source_wav=source_wav, target_wav=target_wav ...
The `.cpu()` call here is redundant. `torch.from_numpy()` always creates a CPU tensor since numpy arrays exist only on CPU. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
The `.cpu()` call here is redundant. `torch.tensor()` creates a CPU tensor by default unless a device parameter is explicitly specified. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion ```
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
@@ -198,10 +198,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/tacotron.py
26
Python
0.786
suggestion
290
51
51
false
v25.12.28
1,450
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/tacotron.py PR Title: v25.12.28 BEFORE CODE: ) else: error = f'Engine {self.tts_zs_key} is None' print(error) ...
The `.cpu()` call here is redundant. `torch.tensor()` creates a CPU tensor by default unless a device parameter is explicitly specified. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
The `.cpu()` call here is redundant. `torch.tensor()` creates a CPU tensor by default unless a device parameter is explicitly specified. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion elif isins...
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
@@ -170,10 +170,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/fairseq.py
26
Python
0.929
suggestion
467
51
51
false
v25.12.28
1,450
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/fairseq.py PR Title: v25.12.28 BEFORE CODE: ) else: error = f'Engine {self.tts_zs_key} is None' print(error) ...
The `.cpu()` call here is redundant. `torch.tensor()` creates a CPU tensor by default unless a device parameter is explicitly specified. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion elif isins...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
else: if sentence.endswith("'"): sentence = sentence[:-1] trim_audio_buffer = 0.002 sentence += '...' if sentence[-1].isalnum() else '' speaker_argument = {} not_supported_punc_pat...
The `.cpu()` call here is redundant. `torch.from_numpy()` always creates a CPU tensor since numpy arrays exist only on CPU. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion ```
else: if sentence.endswith("'"): sentence = sentence[:-1] trim_audio_buffer = 0.002 sentence += '...' if sentence[-1].isalnum() else '' speaker_argument = {} not_supported_punc_pat...
@@ -113,10 +113,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/yourtts.py
26
Python
0.786
suggestion
277
51
51
false
v25.12.28
1,450
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/yourtts.py PR Title: v25.12.28 BEFORE CODE: else: if sentence.endswith("'"): sentence = sentence[:-1] trim_audio_buffer = 0.002 sentence...
The `.cpu()` call here is redundant. `torch.from_numpy()` always creates a CPU tensor since numpy arrays exist only on CPU. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
trim_audio_buffer = 0.002 sentence += '...' if sentence[-1].isalnum() else '' speaker_argument = {} not_supported_punc_pattern = re.compile(r'[—]') language = self.session['language_iso1'] if self.session['language_iso1'...
The `.cpu()` call here is redundant. `torch.tensor()` creates a CPU tensor by default unless a device parameter is explicitly specified. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion elif isins...
trim_audio_buffer = 0.002 sentence += '...' if sentence[-1].isalnum() else '' speaker_argument = {} not_supported_punc_pattern = re.compile(r'[—]') language = self.session['language_iso1'] if self.session['language_iso1'...
@@ -113,10 +113,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/yourtts.py
26
Python
0.929
suggestion
467
51
51
false
v25.12.28
1,450
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/yourtts.py PR Title: v25.12.28 BEFORE CODE: trim_audio_buffer = 0.002 sentence += '...' if sentence[-1].isalnum() else '' speaker_argument = {} not_supporte...
The `.cpu()` call here is redundant. `torch.tensor()` creates a CPU tensor by default unless a device parameter is explicitly specified. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion elif isins...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
"xtts_repetition_penalty": float, #"xtts_cvvp_weight": float, "xtts_top_k": int, "xtts_top_p": float, "xtts_speed": float, #"xtts_gpt_cond_len": int, ...
The `.cpu()` call here is redundant. `torch.from_numpy()` always creates a CPU tensor since numpy arrays exist only on CPU. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion ```
"xtts_repetition_penalty": float, #"xtts_cvvp_weight": float, "xtts_top_k": int, "xtts_top_p": float, "xtts_speed": float, #"xtts_gpt_cond_len": int, ...
@@ -142,16 +142,17 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_sentence = result.get('wav') if is_audio_data_valid(audio_sentence): if isinstance(audio_sentence, torch.Tensor): - audio_tensor = audio_se...
lib/classes/tts_engines/xtts.py
26
Python
0.786
suggestion
277
51
51
false
v25.12.28
1,450
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/xtts.py PR Title: v25.12.28 BEFORE CODE: "xtts_repetition_penalty": float, #"xtts_cvvp_weight": float, "xtts_top_k": int, "x...
The `.cpu()` call here is redundant. `torch.from_numpy()` always creates a CPU tensor since numpy arrays exist only on CPU. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
"xtts_top_p": float, "xtts_speed": float, #"xtts_gpt_cond_len": int, #"xtts_gpt_batch_size": int, "xtts_enable_text_splitting": bool }.items() ...
The `.cpu()` call here is redundant. `torch.tensor()` creates a CPU tensor by default unless a device parameter is explicitly specified. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion elif isins...
"xtts_top_p": float, "xtts_speed": float, #"xtts_gpt_cond_len": int, #"xtts_gpt_batch_size": int, "xtts_enable_text_splitting": bool }.items() ...
@@ -142,16 +142,17 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_sentence = result.get('wav') if is_audio_data_valid(audio_sentence): if isinstance(audio_sentence, torch.Tensor): - audio_tensor = audio_se...
lib/classes/tts_engines/xtts.py
26
Python
0.929
suggestion
467
51
51
false
v25.12.28
1,450
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/xtts.py PR Title: v25.12.28 BEFORE CODE: "xtts_top_p": float, "xtts_speed": float, #"xtts_gpt_cond_len": int, #"xtts_gpt_bat...
The `.cpu()` call here is redundant. `torch.tensor()` creates a CPU tensor by default unless a device parameter is explicitly specified. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion elif isins...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
The `.cpu()` call here is redundant. `torch.from_numpy()` always creates a CPU tensor since numpy arrays exist only on CPU. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion elif isinstance(audio_s...
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
@@ -170,10 +170,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/fairseq.py
26
Python
0.929
suggestion
454
51
51
false
v25.12.28
1,450
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/fairseq.py PR Title: v25.12.28 BEFORE CODE: ) else: error = f'Engine {self.tts_zs_key} is None' print(error) ...
The `.cpu()` call here is redundant. `torch.from_numpy()` always creates a CPU tensor since numpy arrays exist only on CPU. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion elif isinstance(audio_s...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
with torch.no_grad(): """ result = self.engine.synthesize( sentence, #speaker_wav=self.params['voice_path'], speaker=speaker, voice_dir=pth_...
The `.cpu()` call here is redundant. `torch.from_numpy()` always creates a CPU tensor since numpy arrays exist only on CPU. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion ```
with torch.no_grad(): """ result = self.engine.synthesize( sentence, #speaker_wav=self.params['voice_path'], speaker=speaker, voice_dir=pth_...
@@ -202,10 +202,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/bark.py
26
Python
0.786
suggestion
277
51
51
false
v25.12.28
1,450
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/bark.py PR Title: v25.12.28 BEFORE CODE: with torch.no_grad(): """ result = self.engine.synthesize( sentence, #s...
The `.cpu()` call here is redundant. `torch.from_numpy()` always creates a CPU tensor since numpy arrays exist only on CPU. While this doesn't break functionality, it adds unnecessary overhead and makes the code less clear about the actual device management. ```suggestion ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
"xtts_top_p": float, "xtts_speed": float, #"xtts_gpt_cond_len": int, #"xtts_gpt_batch_size": int, "xtts_enable_text_splitting": bool }.items() ...
The `.cpu()` call is redundant here. `torch.from_numpy()` already creates tensors on CPU by default since numpy arrays exist in CPU memory. This unnecessary operation adds overhead without benefit. ```suggestion elif isinstance(audio_sentence, (list, tuple)): audio_te...
"xtts_top_p": float, "xtts_speed": float, #"xtts_gpt_cond_len": int, #"xtts_gpt_batch_size": int, "xtts_enable_text_splitting": bool }.items() ...
@@ -142,16 +142,17 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_sentence = result.get('wav') if is_audio_data_valid(audio_sentence): if isinstance(audio_sentence, torch.Tensor): - audio_tensor = audio_se...
lib/classes/tts_engines/xtts.py
26
Python
0.929
suggestion
393
51
51
false
v25.12.28
1,451
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/xtts.py PR Title: v25.12.28 BEFORE CODE: "xtts_top_p": float, "xtts_speed": float, #"xtts_gpt_cond_len": int, #"xtts_gpt_bat...
The `.cpu()` call is redundant here. `torch.from_numpy()` already creates tensors on CPU by default since numpy arrays exist in CPU memory. This unnecessary operation adds overhead without benefit. ```suggestion elif isinstance(audio_sentence, (list, tuple)): audio_te...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
"xtts_top_p": float, "xtts_speed": float, #"xtts_gpt_cond_len": int, #"xtts_gpt_batch_size": int, "xtts_enable_text_splitting": bool }.items() ...
The `.cpu()` call is redundant here. `torch.tensor()` creates tensors on CPU by default unless a device is explicitly specified. This unnecessary operation adds overhead without benefit. ```suggestion ```
"xtts_top_p": float, "xtts_speed": float, #"xtts_gpt_cond_len": int, #"xtts_gpt_batch_size": int, "xtts_enable_text_splitting": bool }.items() ...
@@ -142,16 +142,17 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_sentence = result.get('wav') if is_audio_data_valid(audio_sentence): if isinstance(audio_sentence, torch.Tensor): - audio_tensor = audio_se...
lib/classes/tts_engines/xtts.py
26
Python
0.786
suggestion
205
51
51
false
v25.12.28
1,451
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/xtts.py PR Title: v25.12.28 BEFORE CODE: "xtts_top_p": float, "xtts_speed": float, #"xtts_gpt_cond_len": int, #"xtts_gpt_bat...
The `.cpu()` call is redundant here. `torch.tensor()` creates tensors on CPU by default unless a device is explicitly specified. This unnecessary operation adds overhead without benefit. ```suggestion ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
else: if sentence.endswith("'"): sentence = sentence[:-1] trim_audio_buffer = 0.002 sentence += '...' if sentence[-1].isalnum() else '' speaker_argument = {} not_supported_punc_pat...
The `.cpu()` call is redundant here. `torch.from_numpy()` already creates tensors on CPU by default since numpy arrays exist in CPU memory. This unnecessary operation adds overhead without benefit. ```suggestion ```
else: if sentence.endswith("'"): sentence = sentence[:-1] trim_audio_buffer = 0.002 sentence += '...' if sentence[-1].isalnum() else '' speaker_argument = {} not_supported_punc_pat...
@@ -113,10 +113,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/yourtts.py
26
Python
0.929
suggestion
216
51
51
false
v25.12.28
1,451
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/yourtts.py PR Title: v25.12.28 BEFORE CODE: else: if sentence.endswith("'"): sentence = sentence[:-1] trim_audio_buffer = 0.002 sentence...
The `.cpu()` call is redundant here. `torch.from_numpy()` already creates tensors on CPU by default since numpy arrays exist in CPU memory. This unnecessary operation adds overhead without benefit. ```suggestion ```
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
trim_audio_buffer = 0.002 sentence += '...' if sentence[-1].isalnum() else '' speaker_argument = {} not_supported_punc_pattern = re.compile(r'[—]') language = self.session['language_iso1'] if self.session['language_iso1'...
The `.cpu()` call is redundant here. `torch.tensor()` creates tensors on CPU by default unless a device is explicitly specified. This unnecessary operation adds overhead without benefit. ```suggestion elif isinstance(audio_sentence, (list, tuple)): audio_tensor = torc...
trim_audio_buffer = 0.002 sentence += '...' if sentence[-1].isalnum() else '' speaker_argument = {} not_supported_punc_pattern = re.compile(r'[—]') language = self.session['language_iso1'] if self.session['language_iso1'...
@@ -113,10 +113,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/yourtts.py
26
Python
0.929
suggestion
382
51
51
false
v25.12.28
1,451
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/yourtts.py PR Title: v25.12.28 BEFORE CODE: trim_audio_buffer = 0.002 sentence += '...' if sentence[-1].isalnum() else '' speaker_argument = {} not_supporte...
The `.cpu()` call is redundant here. `torch.tensor()` creates tensors on CPU by default unless a device is explicitly specified. This unnecessary operation adds overhead without benefit. ```suggestion elif isinstance(audio_sentence, (list, tuple)): audio_tensor = torc...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
The `.cpu()` call is redundant here. `torch.from_numpy()` already creates tensors on CPU by default since numpy arrays exist in CPU memory. This unnecessary operation adds overhead without benefit. ```suggestion elif isinstance(audio_sentence, (list, tuple)): audio_te...
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
@@ -183,10 +183,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/vits.py
26
Python
0.929
suggestion
393
51
51
false
v25.12.28
1,451
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/vits.py PR Title: v25.12.28 BEFORE CODE: ) else: error = f'Engine {self.tts_zs_key} is None' print(error) ...
The `.cpu()` call is redundant here. `torch.from_numpy()` already creates tensors on CPU by default since numpy arrays exist in CPU memory. This unnecessary operation adds overhead without benefit. ```suggestion elif isinstance(audio_sentence, (list, tuple)): audio_te...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
The `.cpu()` call is redundant here. `torch.tensor()` creates tensors on CPU by default unless a device is explicitly specified. This unnecessary operation adds overhead without benefit. ```suggestion elif isinstance(audio_sentence, (list, tuple)): audio_tensor = torc...
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
@@ -183,10 +183,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/vits.py
26
Python
0.929
suggestion
382
51
51
false
v25.12.28
1,451
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/vits.py PR Title: v25.12.28 BEFORE CODE: ) else: error = f'Engine {self.tts_zs_key} is None' print(error) ...
The `.cpu()` call is redundant here. `torch.tensor()` creates tensors on CPU by default unless a device is explicitly specified. This unnecessary operation adds overhead without benefit. ```suggestion elif isinstance(audio_sentence, (list, tuple)): audio_tensor = torc...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
The `.cpu()` call is redundant here. `torch.from_numpy()` already creates tensors on CPU by default since numpy arrays exist in CPU memory. This unnecessary operation adds overhead without benefit. ```suggestion elif isinstance(audio_sentence, (list, tuple)): audio_te...
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
@@ -198,10 +198,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/tacotron.py
26
Python
0.929
suggestion
393
51
51
false
v25.12.28
1,451
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/tacotron.py PR Title: v25.12.28 BEFORE CODE: ) else: error = f'Engine {self.tts_zs_key} is None' print(error) ...
The `.cpu()` call is redundant here. `torch.from_numpy()` already creates tensors on CPU by default since numpy arrays exist in CPU memory. This unnecessary operation adds overhead without benefit. ```suggestion elif isinstance(audio_sentence, (list, tuple)): audio_te...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
The `.cpu()` call is redundant here. `torch.tensor()` creates tensors on CPU by default unless a device is explicitly specified. This unnecessary operation adds overhead without benefit. ```suggestion elif isinstance(audio_sentence, (list, tuple)): audio_tensor = torc...
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
@@ -198,10 +198,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/tacotron.py
26
Python
0.929
suggestion
382
51
51
false
v25.12.28
1,451
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/tacotron.py PR Title: v25.12.28 BEFORE CODE: ) else: error = f'Engine {self.tts_zs_key} is None' print(error) ...
The `.cpu()` call is redundant here. `torch.tensor()` creates tensors on CPU by default unless a device is explicitly specified. This unnecessary operation adds overhead without benefit. ```suggestion elif isinstance(audio_sentence, (list, tuple)): audio_tensor = torc...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
The `.cpu()` call is redundant here. `torch.from_numpy()` already creates tensors on CPU by default since numpy arrays exist in CPU memory. This unnecessary operation adds overhead without benefit. ```suggestion elif isinstance(audio_sentence, (list, tuple)): audio_te...
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
@@ -170,10 +170,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/fairseq.py
26
Python
0.929
suggestion
393
51
51
false
v25.12.28
1,451
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/fairseq.py PR Title: v25.12.28 BEFORE CODE: ) else: error = f'Engine {self.tts_zs_key} is None' print(error) ...
The `.cpu()` call is redundant here. `torch.from_numpy()` already creates tensors on CPU by default since numpy arrays exist in CPU memory. This unnecessary operation adds overhead without benefit. ```suggestion elif isinstance(audio_sentence, (list, tuple)): audio_te...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
The `.cpu()` call is redundant here. `torch.tensor()` creates tensors on CPU by default unless a device is explicitly specified. This unnecessary operation adds overhead without benefit. ```suggestion elif isinstance(audio_sentence, (list, tuple)): audio_tensor = torc...
) else: error = f'Engine {self.tts_zs_key} is None' print(error) return False if os.path.exists(tmp_in_wav): os.remove(tmp_in_wav) ...
@@ -170,10 +170,12 @@ def convert(self, sentence_index:int, sentence:str)->bool: audio_tensor = audio_sentence.detach().cpu().unsqueeze(0) elif isinstance(audio_sentence, np.ndarray): audio_tensor = torch.from_numpy(audio_sentence).unsqu...
lib/classes/tts_engines/fairseq.py
26
Python
0.929
suggestion
382
51
51
false
v25.12.28
1,451
DrewThomasson/ebook2audiobook
13,365
Python
Copilot
ROBERT-MCDOWELL
Review this pull request change. Language: Python File: lib/classes/tts_engines/fairseq.py PR Title: v25.12.28 BEFORE CODE: ) else: error = f'Engine {self.tts_zs_key} is None' print(error) ...
The `.cpu()` call is redundant here. `torch.tensor()` creates tensors on CPU by default unless a device is explicitly specified. This unnecessary operation adds overhead without benefit. ```suggestion elif isinstance(audio_sentence, (list, tuple)): audio_tensor = torc...
You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate.