before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
def jetpack_version(text:str)->str:
m1 = re.search(r'r(\d+)', text)
m2 = re.search(r'revision:\s*([\d\.]+)', text)
msg = ''
if not m1 or not m2:
msg = 'Unrecognized JetPack version. Falling back to CPU.'
return ('unknown', msg)
... | This assignment is unreachable: every branch above returns (`l4t_major < 35`, `l4t_major == 35`, and both `rev_major` branches). Either remove the dead code, or adjust the branching so an actually-unrecognized JetPack 6.x revision falls through here (e.g., explicitly handle known revisions and `return ('unknown', msg)`... | def jetpack_version(text:str)->str:
m1 = re.search(r'r(\d+)', text)
m2 = re.search(r'revision:\s*([\d\.]+)', text)
msg = ''
if not m1 or not m2:
msg = 'Unrecognized JetPack version. Falling back to CPU.'
return ('unknown', msg)
... | @@ -204,7 +204,7 @@ def jetpack_version(text:str)->str:
return ('60', msg)
else:
return ('61', msg)
- msg = 'Unrecognized JetPack 6.x version. Falling back to CPU.'
+ msg = 'Unrecognized JetPack 6.x version. Falling back to... | lib/classes/device_installer.py | 26 | Python | 0.786 | suggestion | 332 | 51 | 51 | false | v26.2.26 | 1,642 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
from lib.classes.tts_engines.common.preset_loader import load_engine_presets
class Vits(TTSUtils, TTSRegistry, name='vits'):
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key = ... | `self.load_engine()` is called before `self.model_path` is assigned, but `load_engine()` now uses `self.model_path` to set `self.tts_key` and call `_load_api()`. This will raise `AttributeError` during initialization. Move the language/sub resolution and `self.model_path` assignment above the `self.engine = self.load_e... | from lib.classes.tts_engines.common.preset_loader import load_engine_presets
class Vits(TTSUtils, TTSRegistry, name='vits'):
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key = ... | @@ -14,14 +14,22 @@ def __init__(self, session:DictProxy):
self.resampler_cache = {}
self.audio_segments = []
self.models = load_engine_presets(self.session['tts_engine'])
- self.params = {"semitones":{}, "samplerate": None}
+ self.params = {"semitones":{}}
... | lib/classes/tts_engines/vits.py | 26 | Python | 0.786 | suggestion | 391 | 51 | 51 | false | v26.2.26 | 1,642 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
from lib.classes.tts_engines.common.preset_loader import load_engine_presets
class Tortoise(TTSUtils, TTSRegistry, name='tortoise'):
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.sp... | `self.load_engine()` runs before `self.model_path` is computed, but `load_engine()` now depends on `self.model_path` for `self.tts_key` and `_load_api()`. This will crash with `AttributeError` in `__init__`. Resolve `iso_dir/sub` and set `self.model_path` before calling `load_engine()` (or keep the resolution logic ins... | from lib.classes.tts_engines.common.preset_loader import load_engine_presets
class Tortoise(TTSUtils, TTSRegistry, name='tortoise'):
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.sp... | @@ -14,13 +14,21 @@ def __init__(self, session:DictProxy):
self.resampler_cache = {}
self.audio_segments = []
self.models = load_engine_presets(self.session['tts_engine'])
- self.params = {"samplerate": None}
+ self.params = {}
enough_vram = self... | lib/classes/tts_engines/tortoise.py | 26 | Python | 0.714 | bug | 341 | 51 | 51 | false | v26.2.26 | 1,642 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
from lib.classes.tts_engines.common.headers import *
from lib.classes.tts_engines.common.preset_loader import load_engine_presets
class Tacotron2(TTSUtils, TTSRegistry, name='tacotron'):
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
... | `__init__` invokes `self.load_engine()` before `self.model_path` is computed, but `load_engine()` now relies on `self.model_path` to set `self.tts_key` and call `_load_api()`. This makes initialization crash with `AttributeError`. Resolve `iso_dir/sub` and set `self.model_path` (and samplerate) before calling `load_eng... | from lib.classes.tts_engines.common.headers import *
from lib.classes.tts_engines.common.preset_loader import load_engine_presets
class Tacotron2(TTSUtils, TTSRegistry, name='tacotron'):
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
... | @@ -14,14 +14,25 @@ def __init__(self, session:DictProxy):
self.resampler_cache = {}
self.audio_segments = []
self.models = load_engine_presets(self.session['tts_engine'])
- self.params = {"semitones":{}, "samplerate": None}
+ self.params = {"semitones":{}}
... | lib/classes/tts_engines/tacotron.py | 25 | Python | 0.714 | bug | 374 | 50 | 50 | false | v26.2.26 | 1,642 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
class GlowTTS(TTSUtils, TTSRegistry, name='glowtts'):
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key = self.session['model_cache']
self.tts_zs_key = default_vc_mo... | `self.load_engine()` is invoked before `self.model_path` is set, but `load_engine()` now uses `self.model_path` for the cache key and `_load_api()` path. As written, initialization will fail with `AttributeError`. Compute `self.model_path` (and samplerate) before calling `load_engine()`, or move the model-path resoluti... |
class GlowTTS(TTSUtils, TTSRegistry, name='glowtts'):
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key = self.session['model_cache']
self.tts_zs_key = default_vc_mo... | @@ -22,6 +22,14 @@ def __init__(self, session:DictProxy):
self.xtts_speakers = self._load_xtts_builtin_list()
self.engine = self.load_engine()
self.engine_zs = self._load_engine_zs()
+ iso_dir = default_engine_settings[self.session['tts_engine']]['languages'][self.sessi... | lib/classes/tts_engines/glowtts.py | 26 | Python | 0.786 | bug | 349 | 51 | 51 | false | v26.2.26 | 1,642 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
class Fairseq(TTSUtils, TTSRegistry, name='fairseq'):
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key = self.session['model_cache']
self.tts_zs_key = default_vc_mo... | `model_cfg = self.models[self.session['fine_tuned']]` can throw `KeyError` and will be surfaced as a generic `ValueError('__init__() error: ...')` with only the missing dict key. To keep user-facing errors actionable, catch `KeyError` here and raise a more descriptive message indicating the invalid `fine_tuned` option.... |
class Fairseq(TTSUtils, TTSRegistry, name='fairseq'):
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key = self.session['model_cache']
self.tts_zs_key = default_vc_mo... | @@ -21,6 +21,8 @@ def __init__(self, session:DictProxy):
#random.seed(seed)
self.amp_dtype = self._apply_gpu_policy(enough_vram=enough_vram, seed=seed)
self.xtts_speakers = self._load_xtts_builtin_list()
+ model_cfg = self.models[self.session['fine_tuned']]
+ ... | lib/classes/tts_engines/fairseq.py | 26 | Python | 1 | bug | 1,702 | 51 | 51 | false | v26.2.26 | 1,644 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
from lib.classes.tts_engines.common.headers import *
from lib.classes.tts_engines.common.preset_loader import load_engine_presets
class Bark(TTSUtils, TTSRegistry, name='bark'):
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
... | `model_cfg = self.models[self.session['fine_tuned']]` will raise a bare `KeyError` if `fine_tuned` is invalid, which then gets wrapped into a generic `ValueError('__init__() error: ...')` and loses the more actionable context (which model key was invalid). Consider catching `KeyError` here and raising a clearer message... | from lib.classes.tts_engines.common.headers import *
from lib.classes.tts_engines.common.preset_loader import load_engine_presets
class Bark(TTSUtils, TTSRegistry, name='bark'):
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
... | @@ -21,6 +21,8 @@ def __init__(self, session:DictProxy):
#random.seed(seed)
self.amp_dtype = self._apply_gpu_policy(enough_vram=enough_vram, seed=seed)
self.xtts_speakers = self._load_xtts_builtin_list()
+ model_cfg = self.models[self.session['fine_tuned']]
+ ... | lib/classes/tts_engines/bark.py | 26 | Python | 0.786 | suggestion | 408 | 51 | 51 | false | v26.2.26 | 1,644 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
self.audio_segments = []
self.models = load_engine_presets(self.session['tts_engine'])
self.params = {}
self.params['samplerate'] = self.models[self.session['fine_tuned']]['samplerate']
enough_vram = self.session['free_vram_gb'] > 4.0
seed = 0
... | `load_engine()` no longer wraps `_load_api()` failures, so exceptions will bubble up without the consistent `load_engine(): _load_api() failed` context used by other engines in this package. Recommend restoring a try/except around `_load_api()` and re-raising a `RuntimeError` (with `from e`) for consistent, debuggable ... | self.audio_segments = []
self.models = load_engine_presets(self.session['tts_engine'])
self.params = {}
self.params['samplerate'] = self.models[self.session['fine_tuned']]['samplerate']
enough_vram = self.session['free_vram_gb'] > 4.0
seed = 0
... | @@ -35,17 +37,7 @@ def load_engine(self)->Any:
if self.session['custom_model'] is not None:
error = f"{self.session['tts_engine']} custom model not implemented yet!"
raise NotImplementedError(error)
- try:
- model_cfg = self.models[self.session['f... | lib/classes/tts_engines/bark.py | 26 | Python | 1 | bug | 592 | 51 | 51 | false | v26.2.26 | 1,644 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
from lib.classes.tts_engines.common.headers import *
from lib.classes.tts_engines.common.preset_loader import load_engine_presets
class Fairseq(TTSUtils, TTSRegistry, name='fairseq'):
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
... | `model_cfg = self.models[self.session['fine_tuned']]` / `model_cfg['repo']` can raise a KeyError that gets wrapped into a generic `ValueError('__init__() error: ...')`, losing the more actionable "Invalid fine_tuned model ..." messaging used by other engines. Consider catching `KeyError` here (or validating `fine_tuned... | from lib.classes.tts_engines.common.headers import *
from lib.classes.tts_engines.common.preset_loader import load_engine_presets
class Fairseq(TTSUtils, TTSRegistry, name='fairseq'):
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
... | @@ -21,6 +21,8 @@ def __init__(self, session:DictProxy):
#random.seed(seed)
self.amp_dtype = self._apply_gpu_policy(enough_vram=enough_vram, seed=seed)
self.xtts_speakers = self._load_xtts_builtin_list()
+ model_cfg = self.models[self.session['fine_tuned']]
+ ... | lib/classes/tts_engines/fairseq.py | 26 | Python | 0.786 | suggestion | 411 | 51 | 51 | false | v26.2.26 | 1,645 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
from lib.classes.tts_engines.common.headers import *
from lib.classes.tts_engines.common.preset_loader import load_engine_presets
class Bark(TTSUtils, TTSRegistry, name='bark'):
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
... | `model_cfg = self.models[self.session['fine_tuned']]` / `model_cfg['repo']` can raise a KeyError that will be wrapped into a generic `ValueError('__init__() error: ...')`, which makes misconfiguration harder to diagnose. Consider handling `KeyError` explicitly and raising a clearer error that includes the invalid `fine... | from lib.classes.tts_engines.common.headers import *
from lib.classes.tts_engines.common.preset_loader import load_engine_presets
class Bark(TTSUtils, TTSRegistry, name='bark'):
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
... | @@ -21,6 +21,8 @@ def __init__(self, session:DictProxy):
#random.seed(seed)
self.amp_dtype = self._apply_gpu_policy(enough_vram=enough_vram, seed=seed)
self.xtts_speakers = self._load_xtts_builtin_list()
+ model_cfg = self.models[self.session['fine_tuned']]
+ ... | lib/classes/tts_engines/bark.py | 26 | Python | 1 | suggestion | 1,374 | 51 | 51 | false | v26.2.26 | 1,645 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
self.audio_segments = []
self.models = load_engine_presets(self.session['tts_engine'])
self.params = {}
self.params['samplerate'] = self.models[self.session['fine_tuned']]['samplerate']
enough_vram = self.session['free_vram_gb'] > 4.0
seed = 0
... | `engine = self._load_api(self.tts_key, self.model_path)` is no longer wrapped; any exception will bubble up and get rethrown by `__init__` as a generic `ValueError`, losing the consistent `load_engine(): _load_api() failed` context used in other engines. Consider restoring a narrow try/except around `_load_api` and ret... | self.audio_segments = []
self.models = load_engine_presets(self.session['tts_engine'])
self.params = {}
self.params['samplerate'] = self.models[self.session['fine_tuned']]['samplerate']
enough_vram = self.session['free_vram_gb'] > 4.0
seed = 0
... | @@ -35,17 +37,7 @@ def load_engine(self)->Any:
if self.session['custom_model'] is not None:
error = f"{self.session['tts_engine']} custom model not implemented yet!"
raise NotImplementedError(error)
- try:
- model_cfg = self.models[self.session['f... | lib/classes/tts_engines/bark.py | 26 | Python | 1 | bug | 666 | 51 | 51 | false | v26.2.26 | 1,645 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
fine_tuned = self.session.get('fine_tuned')
if tts_engine not in default_engine_settings:
error = f'Invalid tts_engine {tts_engine}.'
raise ValueError(error)
engine_langs = default_engine_settings[tts_engine].get('languages', {})
if languag... | The error message is missing a period at the end, which is inconsistent with other similar error messages in tortoise.py, tacotron.py, and within this same file. Error messages should have consistent punctuation.
```suggestion
error = f'{tts_engine} checkpoint for {language} not found.'
``` | if language not in engine_langs:
error = f'Language {language} not supported by engine {tts_engine}.'
raise ValueError(error)
iso_dir = engine_langs[language]
if fine_tuned not in self.models:
error = f'Invalid fine_tuned model {fine_tu... | @@ -20,14 +20,37 @@ def __init__(self, session:DictProxy):
#random.seed(seed)
self.amp_dtype = self._apply_gpu_policy(enough_vram=enough_vram, seed=seed)
self.xtts_speakers = self._load_xtts_builtin_list()
- iso_dir = default_engine_settings[self.session['tts_engine']][... | lib/classes/tts_engines/vits.py | 26 | Python | 1 | suggestion | 307 | 51 | 51 | false | v26.2.26 | 1,646 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key = self.session['model_cache']
self.tts_zs_key = default_vc_model.rsplit('/',1)[-1]
self.pth_voice_file = ... | The validation is missing a check for the 'samplerate' key in model_cfg. Line 18 (before the validation checks) accesses model_cfg['samplerate'], but there's no validation to ensure this key exists. If the model configuration is missing 'samplerate', line 18 will raise a KeyError before reaching these validation checks... | def __init__(self, session: DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key = self.session['model_cache']
self.tts_zs_key = default_vc_model.rsplit('/', 1)[-1]
self.pth_voice_file ... | @@ -21,7 +21,14 @@ def __init__(self, session:DictProxy):
#random.seed(seed)
self.amp_dtype = self._apply_gpu_policy(enough_vram=enough_vram, seed=seed)
self.xtts_speakers = self._load_xtts_builtin_list()
- model_cfg = self.models[self.session['fine_tuned']]
+ ... | lib/classes/tts_engines/fairseq.py | 26 | Python | 0.643 | suggestion | 478 | 51 | 51 | false | v26.2.26 | 1,646 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.speaker = None
self.tts_key = self.session['model_cache']
#self.pth_voice_file = None
self.resampler_... | The validation is missing a check for the 'samplerate' key in model_cfg. Line 18 (before the validation checks) accesses model_cfg['samplerate'], but there's no validation to ensure this key exists. If the model configuration is missing 'samplerate', line 18 will raise a KeyError before reaching these validation checks... | def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.speaker = None
self.tts_key = self.session['model_cache']
#self.pth_voice_file = None
self.resampler_... | @@ -21,7 +21,14 @@ def __init__(self, session:DictProxy):
#random.seed(seed)
self.amp_dtype = self._apply_gpu_policy(enough_vram=enough_vram, seed=seed)
self.xtts_speakers = self._load_xtts_builtin_list()
- model_cfg = self.models[self.session['fine_tuned']]
+ ... | lib/classes/tts_engines/bark.py | 26 | Python | 0.643 | suggestion | 478 | 51 | 51 | false | v26.2.26 | 1,646 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
self.params = {"semitones":{}}
enough_vram = self.session['free_vram_gb'] > 4.0
seed = 0
#random.seed(seed)
self.amp_dtype = self._apply_gpu_policy(enough_vram=enough_vram, seed=seed)
self.xtts_speakers = self._load_xtts_builtin_list()
... | After checking that 'samplerate' exists in model_cfg (line 41-43), the code accesses model_cfg['samplerate'][sub] on line 52 without verifying that 'sub' is a valid key in the samplerate dictionary. If the samplerate dictionary doesn't contain the 'sub' key, this will raise a KeyError. Consider adding validation to che... | self.params = {"semitones":{}}
tts_engine = self.session.get('tts_engine')
language = self.session.get('language')
fine_tuned = self.session.get('fine_tuned')
if tts_engine not in default_engine_settings:
error = f'Invalid tts_engine {tts_engin... | @@ -20,14 +20,37 @@ def __init__(self, session:DictProxy):
#random.seed(seed)
self.amp_dtype = self._apply_gpu_policy(enough_vram=enough_vram, seed=seed)
self.xtts_speakers = self._load_xtts_builtin_list()
- iso_dir = default_engine_settings[self.session['tts_engine']][... | lib/classes/tts_engines/vits.py | 26 | Python | 1 | suggestion | 731 | 51 | 51 | false | v26.2.26 | 1,646 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
self.params = {}
enough_vram = self.session['free_vram_gb'] > 4.0
seed = 0
#random.seed(seed)
self.amp_dtype = self._apply_gpu_policy(enough_vram=enough_vram, seed=seed)
self.xtts_speakers = self._load_xtts_builtin_list()
tts_engine = s... | After checking that 'samplerate' exists in model_cfg (line 41-43), the code accesses model_cfg['samplerate'][sub] on line 52 without verifying that 'sub' is a valid key in the samplerate dictionary. If the samplerate dictionary doesn't contain the 'sub' key, this will raise a KeyError. Consider adding validation to che... | self.params = {}
tts_engine = self.session.get('tts_engine')
language = self.session.get('language')
fine_tuned = self.session.get('fine_tuned')
if tts_engine not in default_engine_settings:
error = f'Invalid tts_engine {tts_engine}.'
... | @@ -20,14 +20,37 @@ def __init__(self, session:DictProxy):
#random.seed(seed)
self.amp_dtype = self._apply_gpu_policy(enough_vram=enough_vram, seed=seed)
self.xtts_speakers = self._load_xtts_builtin_list()
- iso_dir = default_engine_settings[self.session['tts_engine']][... | lib/classes/tts_engines/tortoise.py | 26 | Python | 1 | suggestion | 698 | 51 | 51 | false | v26.2.26 | 1,646 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
#random.seed(seed)
self.amp_dtype = self._apply_gpu_policy(enough_vram=enough_vram, seed=seed)
self.xtts_speakers = self._load_xtts_builtin_list()
tts_engine = self.session.get('tts_engine')
language = self.session.get('language')
fine_tuned = self... | After checking that 'samplerate' exists in model_cfg (line 41-43), the code accesses model_cfg['samplerate'][sub] on line 55 without verifying that 'sub' is a valid key in the samplerate dictionary. If the samplerate dictionary doesn't contain the 'sub' key, this will raise a KeyError. Consider adding validation to che... | fine_tuned = self.session.get('fine_tuned')
if tts_engine not in default_engine_settings:
error = f'Invalid tts_engine {tts_engine}.'
raise ValueError(error)
engine_langs = default_engine_settings[tts_engine].get('languages', {})
if languag... | @@ -20,17 +20,40 @@ def __init__(self, session:DictProxy):
#random.seed(seed)
self.amp_dtype = self._apply_gpu_policy(enough_vram=enough_vram, seed=seed)
self.xtts_speakers = self._load_xtts_builtin_list()
- iso_dir = default_engine_settings[self.session['tts_engine']][... | lib/classes/tts_engines/tacotron.py | 26 | Python | 1 | suggestion | 697 | 51 | 51 | false | v26.2.26 | 1,646 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
self.params = {"semitones": {}, "samplerate": None}
enough_vram = self.session['free_vram_gb'] > 4.0
seed = 0
#random.seed(seed)
self.amp_dtype = self._apply_gpu_policy(enough_vram=enough_vram, seed=seed)
self.xtts_speakers = self._load_xtts_builti... | After checking that 'samplerate' exists in model_cfg (line 41-43), the code accesses model_cfg['samplerate'][sub] on line 52 without verifying that 'sub' is a valid key in the samplerate dictionary. If the samplerate dictionary doesn't contain the 'sub' key, this will raise a KeyError. Consider adding validation to che... | self.params = {"semitones": {}, "samplerate": None}
tts_engine = self.session.get('tts_engine')
language = self.session.get('language')
fine_tuned = self.session.get('fine_tuned')
if tts_engine not in default_engine_settings:
error = f'Invalid ... | @@ -20,14 +20,37 @@ def __init__(self, session:DictProxy):
#random.seed(seed)
self.amp_dtype = self._apply_gpu_policy(enough_vram=enough_vram, seed=seed)
self.xtts_speakers = self._load_xtts_builtin_list()
- iso_dir = default_engine_settings[self.session['tts_engine']][... | lib/classes/tts_engines/glowtts.py | 26 | Python | 1 | suggestion | 733 | 51 | 51 | false | v26.2.26 | 1,646 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
tts_engine = self.session.get('tts_engine')
language = self.session.get('language')
fine_tuned = self.session.get('fine_tuned')
if tts_engine not in default_engine_settings:
error = f'Invalid tts_engine {tts_engine}.'
raise ValueError(error... | This validation logic is duplicated across multiple TTS engine files (vits.py, tortoise.py, tacotron.py). Consider extracting this common validation pattern into a shared utility method in TTSUtils or a separate validation helper. This would improve maintainability by centralizing the validation logic and making it eas... | tts_engine = self.session.get('tts_engine')
language = self.session.get('language')
fine_tuned = self.session.get('fine_tuned')
if tts_engine not in default_engine_settings:
error = f'Invalid tts_engine {tts_engine}.'
raise ValueError(error... | @@ -15,19 +15,37 @@ def __init__(self, session:DictProxy):
self.audio_segments = []
self.models = load_engine_presets(self.session['tts_engine'])
self.params = {"semitones": {}, "samplerate": None}
+ tts_engine = self.session.get('tts_engine')
+ language = se... | lib/classes/tts_engines/glowtts.py | 26 | Python | 0.5 | refactor | 366 | 51 | 51 | false | v26.2.26 | 1,647 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
self.audio_segments = []
self.models = load_engine_presets(self.session['tts_engine'])
self.params = {"semitones": {}, "samplerate": None}
tts_engine = self.session.get('tts_engine')
language = self.session.get('language')
fine_tuned = self.session... | Inconsistent error message punctuation: this error message ends with an exclamation mark, while other similar error messages in this PR use periods (e.g., vits.py line 40, tortoise.py line 40). For consistency, consider using a period instead of an exclamation mark.
```suggestion
error = f'{tts_engine} ... | self.audio_segments = []
self.models = load_engine_presets(self.session['tts_engine'])
self.params = {"semitones": {}, "samplerate": None}
tts_engine = self.session.get('tts_engine')
language = self.session.get('language')
fine_tuned = self.session... | @@ -15,19 +15,37 @@ def __init__(self, session:DictProxy):
self.audio_segments = []
self.models = load_engine_presets(self.session['tts_engine'])
self.params = {"semitones": {}, "samplerate": None}
+ tts_engine = self.session.get('tts_engine')
+ language = se... | lib/classes/tts_engines/glowtts.py | 26 | Python | 1 | suggestion | 361 | 51 | 51 | false | v26.2.26 | 1,647 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key = self.session['model_cache']
self.tts_zs_key = default_vc_model.rsplit('/',1)[-1]
self.pth_voice_file = ... | Potential issue: using session.get('tts_engine'), session.get('language'), and session.get('fine_tuned') return None if keys don't exist, which would cause unclear error messages. For example, line 22 would show 'Invalid tts_engine None' and line 30 would show 'Invalid fine_tuned model None'. Consider checking if these... | def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key = self.session['model_cache']
self.tts_zs_key = default_vc_model.rsplit('/',1)[-1]
self.pth_voice_file = ... | @@ -15,19 +15,37 @@ def __init__(self, session:DictProxy):
self.audio_segments = []
self.models = load_engine_presets(self.session['tts_engine'])
self.params = {"semitones": {}, "samplerate": None}
+ tts_engine = self.session.get('tts_engine')
+ language = se... | lib/classes/tts_engines/glowtts.py | 26 | Python | 0.643 | suggestion | 454 | 51 | 51 | false | v26.2.26 | 1,647 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
class Fairseq(TTSUtils, TTSRegistry, name='fairseq'):
def __init__(self, session: DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key = self.session['model_cache']
self.tts_zs_key = default_vc_m... | This validation logic pattern (for fine_tuned models) is duplicated across multiple TTS engine files (bark.py, fairseq.py, yourtts.py, xtts.py). Consider extracting this common validation pattern into a shared utility method in TTSUtils or a separate validation helper to improve maintainability and consistency. |
class Fairseq(TTSUtils, TTSRegistry, name='fairseq'):
def __init__(self, session: DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key = self.session['model_cache']
self.tts_zs_key = default_vc_m... | @@ -3,26 +3,34 @@
class Fairseq(TTSUtils, TTSRegistry, name='fairseq'):
- def __init__(self, session:DictProxy):
+ def __init__(self, session: DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key =... | lib/classes/tts_engines/fairseq.py | 26 | Python | 0.5 | refactor | 312 | 51 | 51 | false | v26.2.26 | 1,647 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
from lib.classes.tts_engines.common.headers import *
from lib.classes.tts_engines.common.preset_loader import load_engine_presets
class Fairseq(TTSUtils, TTSRegistry, name='fairseq'):
def __init__(self, session: DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
... | Potential issue: using session.get('fine_tuned') returns None if the key doesn't exist, which would cause unclear error messages. The error message on line 20 would show 'Invalid fine_tuned model None' which is confusing. Consider checking if fine_tuned is None first and providing a more specific error message like 'Mi... | from lib.classes.tts_engines.common.headers import *
from lib.classes.tts_engines.common.preset_loader import load_engine_presets
class Fairseq(TTSUtils, TTSRegistry, name='fairseq'):
def __init__(self, session: DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
... | @@ -3,26 +3,34 @@
class Fairseq(TTSUtils, TTSRegistry, name='fairseq'):
- def __init__(self, session:DictProxy):
+ def __init__(self, session: DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key =... | lib/classes/tts_engines/fairseq.py | 18 | Python | 1 | suggestion | 576 | 43 | 43 | false | v26.2.26 | 1,647 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
class Fairseq(TTSUtils, TTSRegistry, name='fairseq'):
def __init__(self, session: DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key = self.session['model_cache']
self.tts_zs_key = default_vc_m... | Inconsistent quote style in string replacement pattern: this uses double quotes around '[lang]' while other similar patterns in this PR use single quotes (e.g., vits.py line 43 uses '[lang_iso1]' and '[xxx]'). For consistency across the codebase, consider using single quotes for the placeholder strings.
```suggestion
... |
class Fairseq(TTSUtils, TTSRegistry, name='fairseq'):
def __init__(self, session: DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key = self.session['model_cache']
self.tts_zs_key = default_vc_m... | @@ -3,26 +3,34 @@
class Fairseq(TTSUtils, TTSRegistry, name='fairseq'):
- def __init__(self, session:DictProxy):
+ def __init__(self, session: DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key =... | lib/classes/tts_engines/fairseq.py | 26 | Python | 0.857 | suggestion | 414 | 51 | 51 | false | v26.2.26 | 1,647 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
}
function install_programs {
if [[ "$OSTYPE" == darwin* ]]; then
echo -e "\e[33mInstalling required programs...\e[0m"
PACK_MGR="brew install"
if ! command -v brew &> /dev/null; then
echo -e "\e[33mHomebrew is not installed. Installing Homebrew...\e[0m"
/usr/bin/env bash -c "$(curl -fsSL $BREW_INSTALLE... | No issues found. | }
function install_programs {
if [[ "$OSTYPE" == darwin* ]]; then
echo -e "\e[33mInstalling required programs...\e[0m"
PACK_MGR="brew install"
if ! command -v brew &> /dev/null; then
echo -e "\e[33mHomebrew is not installed. Installing Homebrew...\e[0m"
/usr/bin/env bash -c "$(curl -fsSL $BREW_INSTALLE... | @@ -74,13 +74,13 @@ while (( $# > 0 )); do
shift
done
-if [[ "${arguments[script_mode]}" == "$BUILD_DOCKER" ]]; then
- SCRIPT_MODE="${arguments[script_mode]}"
-fi
-
-if [[ "$SCRIPT_MODE" != "$NATIVE" && "$SCRIPT_MODE" != "$BUILD_DOCKER" ]]; then
- echo "Error: Invalid script mode argument: $SCRIPT_MODE"
- ... | ebook2audiobook.sh | 0 | Shell | 1 | none | 16 | 51 | 51 | true | v25.12.2b11 | 1,236 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
function install_programs {
if [[ "$OSTYPE" == darwin* ]]; then
echo -e "\e[33mInstalling required programs...\e[0m"
PACK_MGR="brew install"
if ! command -v brew &> /dev/null; then
echo -e "\e[33mHomebrew is not installed. Installing Homebrew...\e[0m"
/usr/bin/env bash -c "$(curl -fsSL $BREW_INSTALLER_... | No issues found. |
function install_programs {
if [[ "$OSTYPE" == darwin* ]]; then
echo -e "\e[33mInstalling required programs...\e[0m"
PACK_MGR="brew install"
if ! command -v brew &> /dev/null; then
echo -e "\e[33mHomebrew is not installed. Installing Homebrew...\e[0m"
/usr/bin/env bash -c "$(curl -fsSL $BREW_INSTALLER_... | @@ -36,9 +36,9 @@ APP_NAME="ebook2audiobook"
APP_VERSION=$(<"$SCRIPT_DIR/VERSION.txt")
OS_LANG=$(echo "${LANG:-en}" | cut -d_ -f1 | tr '[:upper:]' '[:lower:]')
HOST_PROGRAMS=("curl" "pkg-config" "calibre" "ffmpeg" "nodejs" "espeak-ng" "rust" "sox" "tesseract")
-DOCKER_PROGRAMS=("curl" "ffmpeg" "nodejs" "espeak-ng" "... | ebook2audiobook.sh | 0 | Shell | 1 | none | 16 | 51 | 51 | true | v25.12.4b13 | 1,250 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
if ! command -v "$bin" &>/dev/null; then
echo -e "\e[33m$pkg is not installed.\e[0m"
programs_missing+=("$pkg")
fi
done
(( ${#programs_missing[@]} == 0 ))
}
function install_programs {
if [[ "$OSTYPE" == darwin* ]]; then
echo -e "\e[33mInstalling required programs...\e[0m"
PACK_MGR="brew install"
i... | No issues found. | if ! command -v "$bin" &>/dev/null; then
echo -e "\e[33m$pkg is not installed.\e[0m"
programs_missing+=("$pkg")
fi
done
(( ${#programs_missing[@]} == 0 ))
}
function install_programs {
if [[ "$OSTYPE" == darwin* ]]; then
echo -e "\e[33mInstalling required programs...\e[0m"
PACK_MGR="brew install"
i... | @@ -35,7 +35,7 @@ SCRIPT_MODE="$NATIVE"
APP_NAME="ebook2audiobook"
APP_VERSION=$(<"$SCRIPT_DIR/VERSION.txt")
OS_LANG=$(echo "${LANG:-en}" | cut -d_ -f1 | tr '[:upper:]' '[:lower:]')
-HOST_PROGRAMS=("curl" "pkg-config" "calibre" "ffmpeg" "nodejs" "espeak-ng" "rust" "sox" "tesseract")
+HOST_PROGRAMS=("curl" "pkg-confi... | ebook2audiobook.sh | 0 | Shell | 1 | none | 16 | 51 | 51 | true | v25.12.4b14 | 1,258 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
# ---------------------------------------------------------------------
# Hardware mappings
# ---------------------------------------------------------------------
devices = {
"CPU": {"proc": "cpu", "found": True},
"CUDA": {"proc": "cuda", "found": False},
"MPS": {"proc": "mps", "found": False},
... | No issues found. | # ---------------------------------------------------------------------
# Hardware mappings
# ---------------------------------------------------------------------
devices = {
"CPU": {"proc": "cpu", "found": True},
"CUDA": {"proc": "cuda", "found": False},
"MPS": {"proc": "mps", "found": False},
... | @@ -29,6 +29,7 @@
os.environ['CALIBRE_NO_NATIVE_FILEDIALOGS'] = '1'
os.environ['CALIBRE_TEMP_DIR'] = tmp_dir
os.environ['CALIBRE_CACHE_DIRECTORY'] = tmp_dir
+os.environ['CALIBRE_CONFIG_DIRECTORY'] = tmp_dir
os.environ['TMPDIR'] = tmp_dir
os.environ['GRADIO_DEBUG'] = '0'
os.environ['DO_NOT_TRACK'] = 'True'
... | lib/conf.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.13 | 1,289 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
gui_group.add_argument(options[2], action='store_true', help='''Enable a public shareable Gradio link.''')
headless_group = parser.add_argument_group('**** The following options are for --headless mode only')
headless_group.add_argument(options[3], action='store_true', help='''Run the script in headless mod... | No issues found. | gui_group.add_argument(options[2], action='store_true', help='''Enable a public shareable Gradio link.''')
headless_group = parser.add_argument_group('**** The following options are for --headless mode only')
headless_group.add_argument(options[3], action='store_true', help='''Run the script in headless mod... | @@ -120,6 +120,12 @@ def main()->None:
docker run --device=/dev/dri --rm -it -v "/my/real/ebooks/folder/absolute/path:/app/ebooks" -v "/my/real/output/folder/absolute/path:/app/audiobooks" -p 7860:7860 ebook2audiobook:xpu --headless --ebook "/app/ebooks/myfile.pdf" [--voice /app/my/voicepath/voice.mp3 etc..]
... | app.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.13 | 1,291 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
return True
else:
return True
except Exception as e:
error = f'_check_bark_npz() error: {e}'
print(error)
return False
def _tensor_type(self,audio_data:Any)->torch.Tensor:
if isinstance(audio_data, torch.Ten... | No issues found. | return True
else:
return True
except Exception as e:
error = f'_check_bark_npz() error: {e}'
print(error)
return False
def _tensor_type(self,audio_data:Any)->torch.Tensor:
if isinstance(audio_data, torch.Ten... | @@ -48,7 +48,7 @@ def __init__(self, session:DictProxy):
np.random.seed(seed)
torch.manual_seed(seed)
if using_gpu and enough_vram:
- if devices['CUDA']['found'] or devices['ROCM']['found']:
+ if devices['CUDA']['found'] or devices... | lib/classes/tts_engines/coqui.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.14 | 1,295 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
function install_programs {
if [[ "$OSTYPE" == darwin* ]]; then
echo -e "\e[33mInstalling required programs...\e[0m"
PACK_MGR="brew install"
if ! command -v brew &> /dev/null; then
echo -e "\e[33mHomebrew is not installed. Installing Homebrew...\e[0m"
/usr/bin/env bash -c "$(curl -fsSL $BREW_INSTALLER_U... | No issues found. | function install_programs {
if [[ "$OSTYPE" == darwin* ]]; then
echo -e "\e[33mInstalling required programs...\e[0m"
PACK_MGR="brew install"
if ! command -v brew &> /dev/null; then
echo -e "\e[33mHomebrew is not installed. Installing Homebrew...\e[0m"
/usr/bin/env bash -c "$(curl -fsSL $BREW_INSTALLER_U... | @@ -36,7 +36,7 @@ APP_NAME="ebook2audiobook"
APP_VERSION=$(<"$SCRIPT_DIR/VERSION.txt")
OS_LANG=$(echo "${LANG:-en}" | cut -d_ -f1 | tr '[:upper:]' '[:lower:]')
HOST_PROGRAMS=("cmake" "curl" "pkg-config" "calibre" "ffmpeg" "nodejs" "espeak-ng" "cargo" "rust" "sox" "tesseract")
-DOCKER_PROGRAMS=("curl" "wget" "ffmpeg"... | ebook2audiobook.sh | 0 | Shell | 1 | none | 16 | 51 | 51 | true | v25.12.15 | 1,308 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
def has_working_xpu():
# No XPU on macOS
if sys.platform == "darwin":
return False
# ---------- Linux ----------
if os.name == "posix":
# Must have render node
if not os.path.exists("/dev/dri/renderD128"):
... | No issues found. | def has_working_xpu():
# No XPU on macOS
if sys.platform == "darwin":
return False
# ---------- Linux ----------
if os.name == "posix":
# Must have render node
if not os.path.exists("/dev/dri/renderD128"):
... | @@ -199,6 +199,197 @@ def jetpack_version(text:str)->str:
msg = 'Unrecognized JetPack 6.x version. Falling back to CPU.'
return ('unknown', msg)
+ def has_amd_gpu_pci():
+ # macOS: no ROCm-capable AMD GPUs
+ if sys.platform == "darwin":
+ retur... | lib/classes/device_installer.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.16 | 1,340 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
speaker=speaker,
voice_dir=pth_voice_dir,
**fine_tuned_params
)
del result
msg = f"Saved file: {pth_voice_file}"
print(msg)
return T... | No issues found. | speaker=speaker,
voice_dir=pth_voice_dir,
**fine_tuned_params
)
del result
msg = f"Saved file: {pth_voice_file}"
print(msg)
return T... | @@ -1,4 +1,4 @@
-import threading, torch, torchaudio, random, gc, shutil, subprocess, tempfile, uuid
+import threading, torch, torchaudio, random, gc, shutil, subprocess, tempfile, uuid, types
import regex as re
import numpy as np | lib/classes/tts_engines/coqui.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.17 | 1,342 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
voice_dir=pth_voice_dir,
**fine_tuned_params
)
del result
msg = f"Saved file: {pth_voice_file}"
print(msg)
return True
else:
return ... | No issues found. | voice_dir=pth_voice_dir,
**fine_tuned_params
)
del result
msg = f"Saved file: {pth_voice_file}"
print(msg)
return True
else:
return ... | @@ -17,21 +17,6 @@
#import logging
#logging.basicConfig(level=logging.DEBUG)
-if not hasattr(torch, "distributed"):
- torch.distributed = types.SimpleNamespace()
-
-if not hasattr(torch.distributed, "ReduceOp"):
- class _ReduceOp:
- SUM = None
- MAX = None
- MIN = None
- torch.distributed.ReduceOp = _ReduceOp
-
... | lib/classes/tts_engines/coqui.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.18 | 1,352 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
"voice": os.path.join(voices_dir, 'eng', 'adult', 'male', 'DeathPussInBoots.wav'),
"files": default_engine_settings[TTS_ENGINES['XTTSv2']]['files'],
"samplerate": default_engine_settings[TTS_ENGINES['XTTSv2']]['samplerate']
},
"DermotCrowley": {
"lang... | No issues found. | "voice": os.path.join(voices_dir, 'eng', 'adult', 'male', 'DeathPussInBoots.wav'),
"files": default_engine_settings[TTS_ENGINES['XTTSv2']]['files'],
"samplerate": default_engine_settings[TTS_ENGINES['XTTSv2']]['samplerate']
},
"DermotCrowley": {
"lang... | @@ -30,7 +30,6 @@
default_fine_tuned = 'internal'
default_vc_model = TTS_VOICE_CONVERSION['knnvc']['path']
default_voice_detection_model = 'drewThomasson/segmentation'
-#default_voice_detection_model = 'pyannote/segmentation-3.0'
max_custom_model = 100
max_custom_voices = 1000
| lib/models.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.18 | 1,356 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
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_f... | No issues found. |
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_f... | @@ -1,42 +1,56 @@
-import os
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()
+... | lib/classes/background_detector.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.18 | 1,357 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
# ---------------------------------------------------------------------
# Hardware mappings
# ---------------------------------------------------------------------
devices = {
"CPU": {"proc": "cpu", "found": True},
"CUDA": {"proc": "cuda", "found": False},
"MPS": {"proc": "mps", "found": False},
... | No issues found. | # ---------------------------------------------------------------------
# Hardware mappings
# ---------------------------------------------------------------------
devices = {
"CPU": {"proc": "cpu", "found": True},
"CUDA": {"proc": "cuda", "found": False},
"MPS": {"proc": "mps", "found": False},
... | @@ -49,7 +49,6 @@
os.environ['PYTORCH_ENABLE_MPS_FALLBACK'] = '1'
os.environ['PYTORCH_NO_CUDA_MEMORY_CACHING'] = '1'
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'max_split_size_mb:32,garbage_collection_threshold:0.6,expandable_segments:True'
-os.environ["LD_PRELOAD"] = f"/usr/lib/aarch64-linux-gnu/libgomp.so.1:{os.en... | lib/conf.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.19 | 1,363 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
# No XPU on macOS
if sys.platform == "darwin":
return False
# ---------- Linux ----------
if os.name == "posix":
# Must have render node
if not os.path.exists("/dev/dri/renderD128"):
return False
... | No issues found. | # No XPU on macOS
if sys.platform == "darwin":
return False
# ---------- Linux ----------
if os.name == "posix":
# Must have render node
if not os.path.exists("/dev/dri/renderD128"):
return False
... | @@ -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 | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.19 | 1,365 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
is_ffmpeg = "ffmpeg" in os.path.basename(self.cmd[0])
if is_ffmpeg:
self.process = subprocess.Popen(
self.cmd,
stdout=subprocess.DEVNULL,
stderr=subprocess.PIPE,
text=False,
bufsiz... | No issues found. | is_ffmpeg = "ffmpeg" in os.path.basename(self.cmd[0])
if is_ffmpeg:
self.process = subprocess.Popen(
self.cmd,
stdout=subprocess.DEVNULL,
stderr=subprocess.PIPE,
text=False,
bufsiz... | @@ -1,4 +1,4 @@
-import os, subprocess, re, sys, tqdm, gradio as gr
+import os, subprocess, re, sys, gradio as gr
class SubprocessPipe:
def __init__(self, cmd:str, is_gui_process:bool, total_duration:float, msg:str='Processing'): | lib/classes/subprocess_pipe.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.19 | 1,366 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
if sys.platform == "darwin":
return False
# ---------- Linux ----------
if os.name == "posix":
# Must have render node
if not os.path.exists("/dev/dri/renderD128"):
return False
# Prefer Level Zero ru... | No issues found. | if sys.platform == "darwin":
return False
# ---------- Linux ----------
if os.name == "posix":
# Must have render node
if not os.path.exists("/dev/dri/renderD128"):
return False
# Prefer Level Zero ru... | @@ -409,9 +409,10 @@ def has_working_xpu():
devices['JETSON']['found'] = True
name = 'jetson'
tag = f'jetson{jp_code}'
- out = try_cmd('uname -a')
- if 'tegra' in out:
- msg = 'Jetson GPU detected but not(?) compatible'
... | lib/classes/device_installer.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.19 | 1,367 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
key.removeprefix("xtts_"): cast_type(self.session[key])
for key, cast_type in {
"xtts_temperature": float,
#"xtts_codec_temperature": float,
"xtts_length_penalty": floa... | No issues found. | key.removeprefix("xtts_"): cast_type(self.session[key])
for key, cast_type in {
"xtts_temperature": float,
#"xtts_codec_temperature": float,
"xtts_length_penalty": floa... | @@ -11,7 +11,7 @@
from lib.classes.tts_registry import TTSRegistry
from lib.classes.vram_detector import VRAMDetector
-from lib.classes.tts_engines.common.utils import cleanup_memory, append_sentence2vtt, loaded_tts_size_gb, load_xtts_builtin_list #, ensure_safe_checkpoint
+from lib.classes.tts_engines.common.utils... | lib/classes/tts_engines/bark.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.20 | 1,382 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
visible_custom_model = True if session['fine_tuned'] == 'internal' else False
return (
gr.update(value=show_rating(session['tts_engine'])),
gr.update(visible=visible_gr_tab_xtts_params),
... | No issues found. | visible_custom_model = True if session['fine_tuned'] == 'internal' else False
return (
gr.update(value=show_rating(session['tts_engine'])),
gr.update(visible=visible_gr_tab_xtts_params),
... | @@ -1045,9 +1045,11 @@ def click_gr_audiobook_del_btn(selected:str, id:str)->tuple:
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:
... | lib/gradio.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.25 | 1,388 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
else self.models[self.session['fine_tuned']]['voice']
)
if self.params['voice_path'] is not None:
speaker = re.sub(r'\.wav$', '', os.path.basename(self.params['voice_path']))
if self.params['voice_path'] not in default_engine_settings[TTS_ENGINES['... | No issues found. | else self.models[self.session['fine_tuned']]['voice']
)
if self.params['voice_path'] is not None:
speaker = re.sub(r'\.wav$', '', os.path.basename(self.params['voice_path']))
if self.params['voice_path'] not in default_engine_settings[TTS_ENGINES['... | @@ -141,10 +141,16 @@ def convert(self, sentence_index:int, sentence:str)->bool:
)
audio_sentence = result.get('wav')
if is_audio_data_valid(audio_sentence):
- audio_sentence = audio_sentence.tolist()
- if is_au... | lib/classes/tts_engines/xtts.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.25 | 1,411 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
msg = f"Loading ZeroShot {self.tts_zs_key} model, it takes a while, please be patient..."
print(msg)
self._cleanup_memory()
engine_zs = loaded_tts.get(self.tts_zs_key, False)
if not engine_zs:
engine_zs = self._load_api(self.tts_zs_key, default... | No issues found. | msg = f"Loading ZeroShot {self.tts_zs_key} model, it takes a while, please be patient..."
print(msg)
self._cleanup_memory()
engine_zs = loaded_tts.get(self.tts_zs_key, False)
if not engine_zs:
engine_zs = self._load_api(self.tts_zs_key, default... | @@ -151,6 +151,7 @@ def _load_engine_zs(self)->Any:
def _check_xtts_builtin_speakers(self, voice_path:str, speaker:str)->str|bool:
new_voice_path = ''
+ proc_voice_path = ''
try:
voice_parts = Path(voice_path).parts
if (self.session['language'] in voice_parts or... | lib/classes/tts_engines/common/utils.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.25 | 1,413 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
out = try_cmd("sycl-ls").lower()
if "level-zero" in out and "gpu" in out:
return True
if has_cmd("clinfo"):
out = try_cmd("clinfo").lower()
if "intel" in out and "gpu" in out:
... | No issues found. | out = try_cmd("sycl-ls").lower()
if "level-zero" in out and "gpu" in out:
return True
if has_cmd("clinfo"):
out = try_cmd("clinfo").lower()
if "intel" in out and "gpu" in out:
... | @@ -426,7 +426,7 @@ def has_working_xpu():
if version_out:
break
if not version_out:
- msg = 'ROCm hardware detected but ROCm toolkit version file not found.'
+ msg = 'ROCm hardware detected but AMD ROCm base runtime not installed.... | lib/classes/device_installer.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.25 | 1,414 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
or reuse of custom models and custom cloning voices.''')
gui_group = parser.add_argument_group('**** The following option are for gradio/gui mode only', 'Optional')
gui_group.add_argument(options[2], action='store_true', help='''Enable a public shareable Gradio link.''')
headless_group = parser.add_argu... | No issues found. | or reuse of custom models and custom cloning voices.''')
gui_group = parser.add_argument_group('**** The following option are for gradio/gui mode only', 'Optional')
gui_group.add_argument(options[2], action='store_true', help='''Enable a public shareable Gradio link.''')
headless_group = parser.add_argu... | @@ -105,20 +105,20 @@ def main()->None:
CPU:
docker run --rm -it -p 7860:7860 ebook2audiobook:cpu
CUDA:
- docker run --gpus all --rm -it -p 7860:7860 ebook2audiobook:cu[118/121/128 etc..]
+ docker run --gpus all --rm -it -p 7860:7860 ebook2audiobook:cu[118/122/124/126 etc..]
... | app.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | README Typos | 1,420 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
return gr.update(), gr.update(), gr.update()
def change_gr_tts_engine_list(engine:str, id:str)->tuple:
nonlocal models
session = context.get_session(id)
if session:
models = load_engine_presets(engine)
s... | No issues found. | return gr.update(), gr.update(), gr.update()
def change_gr_tts_engine_list(engine:str, id:str)->tuple:
nonlocal models
session = context.get_session(id)
if session:
models = load_engine_presets(engine)
s... | @@ -1118,12 +1118,14 @@ def update_gr_voice_list(id:str)->dict:
file_pattern = "*.wav"
eng_options = []
bark_options = []
+ builtin_dir = Path(os.path.join(voices_dir, lang_dir))
builtin_options = ... | lib/gradio.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.29 | 1,456 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
return True
else:
return True
except Exception as e:
error = f'_check_bark_npz() error: {e}'
print(error)
return False
"""
def convert(self, sentence_index:int, sentence:str)->bool:
try:
speaker = Non... | No issues found. | return True
else:
return True
except Exception as e:
error = f'_check_bark_npz() error: {e}'
print(error)
return False
"""
def convert(self, sentence_index:int, sentence:str)->bool:
try:
speaker = Non... | @@ -9,7 +9,6 @@ def __init__(self, session:DictProxy):
self.cache_dir = tts_dir
self.speakers_path = None
self.tts_key = self.session['model_cache']
- self.tts_zs_key = default_vc_model.rsplit('/',1)[-1]
self.pth_voice_file = None
self.sentence... | lib/classes/tts_engines/bark.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.31 | 1,478 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
else:
msg = f'DEVICE_TAG not valid'
else:
# ============================================================
# JETSON
# ============================================================
if arch in ('aarch64','arm64') and (os.path.exists('/etc/nv... | No issues found. | else:
msg = f'DEVICE_TAG not valid'
else:
# ============================================================
# JETSON
# ============================================================
if arch in ('aarch64','arm64') and (os.path.exists('/etc/nv... | @@ -428,7 +428,8 @@ def has_working_xpu():
):
if os.path.exists(p):
with open(p, 'r', encoding='utf-8', errors='ignore') as f:
- version = f.read()
+ v = f.read()
+ ... | lib/classes/device_installer.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.32 | 1,485 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
else:
return True
except Exception as e:
error = f'_check_bark_npz() error: {e}'
print(error)
return False
"""
def convert(self, sentence_index:int, sentence:str)->bool:
try:
speaker = None
audio_sentence = F... | No issues found. | else:
return True
except Exception as e:
error = f'_check_bark_npz() error: {e}'
print(error)
return False
"""
def convert(self, sentence_index:int, sentence:str)->bool:
try:
speaker = None
audio_sentence = F... | @@ -122,6 +122,9 @@ def convert(self, sentence_index:int, sentence:str)->bool:
return False
if self.engine:
final_sentence_file = os.path.join(self.session['chapters_dir_sentences'], f'{sentence_index}.{default_audio_proc_format}')
+ s = sentence.str... | lib/classes/tts_engines/bark.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.32 | 1,486 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
self.session['voice'] if self.session['voice'] is not None
else self.models[self.session['fine_tuned']]['voice']
)
if self.params['voice_path'] is not None:
speaker = re.sub(r'\.wav$', '', os.path.basename(self.params['voice_path']))
... | No issues found. | self.session['voice'] if self.session['voice'] is not None
else self.models[self.session['fine_tuned']]['voice']
)
if self.params['voice_path'] is not None:
speaker = re.sub(r'\.wav$', '', os.path.basename(self.params['voice_path']))
... | @@ -30,7 +30,6 @@ def __init__(self, session:DictProxy):
self._apply_cuda_policy(using_gpu=using_gpu, enough_vram=enough_vram, seed=seed)
self.xtts_speakers = self._load_xtts_builtin_list()
self.engine = self._load_engine()
- self.engine_zs = self._load_engine_zs()
... | lib/classes/tts_engines/xtts.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.32 | 1,487 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
def clean_match(match:re.Match)->str:
first_num = clean_single_num(match.group(1))
dash_char = match.group(2) or ''
second_num = clean_single_num(match.group(3)) if match.group(3) else ''
trailing = match.group(4) or ''
if second_num:
return f'{first_num}{dash_ch... | No issues found. |
def clean_match(match:re.Match)->str:
first_num = clean_single_num(match.group(1))
dash_char = match.group(2) or ''
second_num = clean_single_num(match.group(3)) if match.group(3) else ''
trailing = match.group(4) or ''
if second_num:
return f'{first_num}{dash_ch... | @@ -47,6 +47,7 @@
from lib.classes.tts_manager import TTSManager
#from lib.classes.redirect_console import RedirectConsole
#from lib.classes.argos_translator import ArgosTranslator
+from lib.classes.tts_engines.common.audio import get_audio_duration
from lib import *
@@ -1843,28 +1844,6 @@ def combine_audio_sen... | lib/core.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.33 | 1,509 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
def trim_audio(audio_data: Union[list[float], Tensor], samplerate: int, silence_threshold: float = 0.003, buffer_sec: float = 0.005) -> Tensor:
# Ensure audio_data is a PyTorch tensor
if isinstance(audio_data, list):
audio_data = torch.tensor(audio_data, dtype=torch.float32)
if isinstance(audio_dat... | No issues found. |
def trim_audio(audio_data: Union[list[float], Tensor], samplerate: int, silence_threshold: float = 0.003, buffer_sec: float = 0.005) -> Tensor:
# Ensure audio_data is a PyTorch tensor
if isinstance(audio_data, list):
audio_data = torch.tensor(audio_data, dtype=torch.float32)
if isinstance(audio_dat... | @@ -75,10 +75,11 @@ def get_audio_duration(filepath:str)->float:
except Exception:
return 0
except subprocess.CalledProcessError as e:
- DependencyError(e)
+ error = f'get_audio_duration() Error: Failed to process: {e}'
+ print(error)
return 0
except Excepti... | lib/classes/tts_engines/common/audio.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.33 | 1,511 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
error = f'Cannot extract custom model zip file {os.path.basename(f)}'
state['type'] = 'warning'
state['msg'] = error
else:
error = f'{os.path.basename(f... | No issues found. | error = f'Cannot extract custom model zip file {os.path.basename(f)}'
state['type'] = 'warning'
state['msg'] = error
else:
error = f'{os.path.basename(f... | @@ -673,7 +673,53 @@ def enable_components(id:str)->tuple:
if session['event'] == 'confirm_blocks':
outputs = tuple([gr.update() for _ in range(12)])
return outputs
- outputs = tuple([gr.update(interactive=True) for _ in range(12)])
+... | lib/gradio.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.33 | 1,514 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
def clean_single_num(num_str:str)->str:
tok = unicodedata.normalize('NFKC', num_str)
if tok.lower() in ('inf', 'infinity', 'nan'):
return tok
clean = tok.replace(',', '').replace('\u00A0', '').replace(' ', '')
try:
num = float(clean) if '.' in clean else int(... | No issues found. |
def clean_single_num(num_str:str)->str:
tok = unicodedata.normalize('NFKC', num_str)
if tok.lower() in ('inf', 'infinity', 'nan'):
return tok
clean = tok.replace(',', '').replace('\u00A0', '').replace(' ', '')
try:
num = float(clean) if '.' in clean else int(... | @@ -24,7 +24,6 @@
from ebooklib.epub import EpubBook
from ebooklib.epub import EpubHtml
from glob import glob
-from gradio import utils
from iso639 import Lang
from markdown import markdown
from multiprocessing import Pool, cpu_count
@@ -850,7 +849,8 @@ def _tuple_row(node:Any, last_text_char:str|None=None)->Gene... | lib/core.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.1.14 | 1,520 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
print(error)
return None
def _load_engine_zs(self)->Any:
try:
msg = f"Loading ZeroShot {self.tts_zs_key} model, it takes a while, please be patient..."
print(msg)
self._cleanup_memory()
engine_zs = loaded_tts.get(self.tts_zs_key, False... | No issues found. | print(error)
return None
def _load_engine_zs(self)->Any:
try:
msg = f"Loading ZeroShot {self.tts_zs_key} model, it takes a while, please be patient..."
print(msg)
self._cleanup_memory()
engine_zs = loaded_tts.get(self.tts_zs_key, False... | @@ -168,7 +168,7 @@ def _load_api(self, key:str, model_path:str)->Any:
if not engine:
engine = TTSEngine(model_path)
if engine:
- vram_dict = VRAMDetector().detect_vram(self.session['device'])
+ vram_dict = VRAMDetector().detec... | lib/classes/tts_engines/common/utils.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.1.14 | 1,522 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
if ! command -v brew &> /dev/null; then
echo -e "\e[33mHomebrew is not installed. Installing Homebrew...\e[0m"
/usr/bin/env bash -c "$(curl -fsSL $BREW_INSTALLER_URL)"
echo >> $HOME/.zprofile
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> $HOME/.zprofile
eval "$(/usr/local/bin/brew shellenv)"
if !... | No issues found. | if ! command -v brew &> /dev/null; then
echo -e "\e[33mHomebrew is not installed. Installing Homebrew...\e[0m"
/usr/bin/env bash -c "$(curl -fsSL $BREW_INSTALLER_URL)"
echo >> $HOME/.zprofile
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> $HOME/.zprofile
eval "$(/usr/local/bin/brew shellenv)"
if !... | @@ -30,6 +30,8 @@ export CONDA_HOME="$HOME/Miniforge3"
export CONDA_BIN_PATH="$CONDA_HOME/bin"
export CONDA_ENV="$CONDA_HOME/etc/profile.d/conda.sh"
export PATH="$CONDA_BIN_PATH:${PATH-}"
+export APP_VERSION=$(<"$SCRIPT_DIR/VERSION.txt")
+export DEVICE_TAG="${DEVICE_TAG:-}"
NATIVE="native"
BUILD_DOCKER="build_do... | ebook2audiobook.sh | 0 | Shell | 1 | none | 16 | 51 | 51 | true | v26.1.14 | 1,526 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
info = {
"os": self.system,
"device_type": "jetson",
"device_name": "NVIDIA Jetson (Unified Memory)",
"free_bytes": mem.available,
"total_bytes": mem.total,... | No issues found. | info = {
"os": self.system,
"device_type": "jetson",
"device_name": "NVIDIA Jetson (Unified Memory)",
"free_bytes": mem.available,
"total_bytes": mem.total,... | @@ -44,14 +44,13 @@ def _fmt(b:int)->float:
@staticmethod
def _ceil_gb(b: int) -> int:
- return math.ceil(b / (1024 ** 3)) if b > 0 else 0
+ return math.ceil(b / (1024 ** 3))
def detect_vram(self, device:str, script_mode:str, as_json:bool=False)->Any:
info = {}
+ in_dock... | lib/classes/vram_detector.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.33 | 1,527 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
def _run_process(self)->bool:
try:
is_ffmpeg = "ffmpeg" in os.path.basename(self.cmd[0])
if is_ffmpeg:
self.process = subprocess.Popen(
self.cmd,
stdout=subprocess.DEVNULL,
stderr=subprocess.PIPE,
... | No issues found. | def _run_process(self)->bool:
try:
is_ffmpeg = "ffmpeg" in os.path.basename(self.cmd[0])
if is_ffmpeg:
self.process = subprocess.Popen(
self.cmd,
stdout=subprocess.DEVNULL,
stderr=subprocess.PIPE,
... | @@ -10,6 +10,7 @@ def __init__(self, cmd:str, is_gui_process:bool, total_duration:float, msg:str='
self.msg = msg
self.process = None
self._stop_requested = False
+ self.on_progress = on_progress
self.progress_bar = False
if self.is_gui_process:
self.prog... | lib/classes/subprocess_pipe.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.1.14 | 1,528 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
try:
msg = f"Loading ZeroShot {self.tts_zs_key} model, it takes a while, please be patient..."
print(msg)
self._cleanup_memory()
engine_zs = loaded_tts.get(self.tts_zs_key, False)
if not engine_zs:
engine_zs = self._load_api(self.tts_zs... | No issues found. | try:
msg = f"Loading ZeroShot {self.tts_zs_key} model, it takes a while, please be patient..."
print(msg)
self._cleanup_memory()
engine_zs = loaded_tts.get(self.tts_zs_key, False)
if not engine_zs:
engine_zs = self._load_api(self.tts_zs... | @@ -408,29 +408,36 @@ def _set_voice(self)->bool:
return False
return True
- def _convert_sml(self, sml:str)->bool:
- if sml == TTS_SML['break']['token']:
- silence_time = int(np.random.uniform(0.3, 0.6) * 100) / 100
- break_tensor = torch.zeros(1, int(sel... | lib/classes/tts_engines/common/utils.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.33 | 1,538 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
self._cleanup_memory()
engine_zs = loaded_tts.get(self.tts_zs_key, False)
if not engine_zs:
engine_zs = self._load_api(self.tts_zs_key, default_vc_model)
if engine_zs:
self.session['model_zs_cache'] = self.tts_zs_key
msg = f... | No issues found. | self._cleanup_memory()
engine_zs = loaded_tts.get(self.tts_zs_key, False)
if not engine_zs:
engine_zs = self._load_api(self.tts_zs_key, default_vc_model)
if engine_zs:
self.session['model_zs_cache'] = self.tts_zs_key
msg = f... | @@ -125,7 +125,8 @@ def _apply_gpu_policy(self, enough_vram: bool, seed: int) -> torch.dtype:
if quality_mode:
try:
if hasattr(torch.cuda, "is_bf16_supported") and torch.cuda.is_bf16_supported():
- amp_dtype = torch.bfloat16
+ ... | lib/classes/tts_engines/common/utils.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.33 | 1,544 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
#"gpt_cond_len": 512,
#"gpt_batch_size": 1,
"enable_text_splitting": False,
"files": ['config.json', 'model.pth', 'vocab.json', 'ref.wav'],
"voices": {
"ClaribelDervla": "Claribel Dervla", "DaisyStudious": "Daisy Studious", "GracieWise": "Gracie Wise",
... | No issues found. | #"gpt_cond_len": 512,
#"gpt_batch_size": 1,
"enable_text_splitting": False,
"files": ['config.json', 'model.pth', 'vocab.json', 'ref.wav'],
"voices": {
"ClaribelDervla": "Claribel Dervla", "DaisyStudious": "Daisy Studious", "GracieWise": "Gracie Wise",
... | @@ -21,33 +21,27 @@
}
TTS_SML = {
- "break": {
- "match": re.compile(r'(?:‡|\[)break(?:‡|\])'),
- "close_match": None,
- "token": "‡break‡"
- },
- "pause": {
- "match": re.compile(r'(?:‡|\[)pause(?::(\d+(?:\.\d+)?))?(?:‡|\])'),
- "close_match": None,
- "token": "‡pause‡"
- },
- "voice": {
- "ma... | lib/conf_models.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.1.14 | 1,545 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
session['voice'] = os.path.join(model, f'{os.path.basename(os.path.normpath(model))}.wav')
msg = f'{os.path.basename(model)} added to the custom models list'
state['type'] = 'success'
... | No issues found. | session['voice'] = os.path.join(model, f'{os.path.basename(os.path.normpath(model))}.wav')
msg = f'{os.path.basename(model)} added to the custom models list'
state['type'] = 'success'
... | @@ -661,18 +661,7 @@ def build_interface(args:dict)->gr.Blocks:
gr_state_update = gr.State(value={'hash': None})
gr_restore_session = gr.JSON(elem_id='gr_restore_session', visible='hidden')
- gr_save_session = gr.JSON(elem_id='gr_save_session', visible='hidden')
-
- de... | lib/gradio.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.1.15 | 1,548 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
max_upload_size = '6GB'
NATIVE = 'native'
FULL_DOCKER = 'full_docker'
debug_mode = False
# ---------------------------------------------------------------------
# Hardware mappings
# ---------------------------------------------------------------------
devices = {
"CPU": {"proc": "cpu", "found": Tru... | No issues found. | max_upload_size = '6GB'
NATIVE = 'native'
FULL_DOCKER = 'full_docker'
debug_mode = False
# ---------------------------------------------------------------------
# Hardware mappings
# ---------------------------------------------------------------------
devices = {
"CPU": {"proc": "cpu", "found": Tru... | @@ -90,49 +90,36 @@
default_py_minor = sys.version_info.minor
default_pytorch_url = 'https://download.pytorch.org/whl'
-default_jetson_url = 'https://www.e-blokos.com/whl/jetson' # TODO: find a definitive place where to upload the jetpack5 torch
-
-jetson_torch_version_base = {
- "jetson60": "2.4.0",
- ... | lib/conf.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.1.16 | 1,556 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
if device == devices['CPU']['proc']:
self.engine.tts_to_file(
text=part,
file_path=tmp_in_wav,
**speaker_argumen... | No issues found. | if device == devices['CPU']['proc']:
self.engine.tts_to_file(
text=part,
file_path=tmp_in_wav,
**speaker_argumen... | @@ -62,7 +62,7 @@ def convert(self, sentence_index:int, sentence:str)->bool:
self.audio_segments = []
for part in sentence_parts:
part = part.strip()
- if not part:
+ if not part or not any(c.isalnum() for c in part):
... | lib/classes/tts_engines/fairseq.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.33 | 1,558 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
if self.is_gui_process:
self.progress_bar(0, desc=msg)
chunks = silence.split_on_silence(
audio,
min_silence_len = min_silence_len,
silence_thresh = silence_threshold,
keep_silence = keep_silence
)
if not chunks:
ret... | No issues found. | if self.is_gui_process:
self.progress_bar(0, desc=msg)
chunks = silence.split_on_silence(
audio,
min_silence_len = min_silence_len,
silence_thresh = silence_threshold,
keep_silence = keep_silence
)
if not chunks:
ret... | @@ -6,12 +6,14 @@
from pydub.silence import detect_nonsilent
from lib.classes.tts_engines.common.preset_loader import load_engine_presets
+from lib.classes.tts_engines.common.audio import get_audio_duration
from lib.classes.background_detector import BackgroundDetector
from lib.classes.subprocess_pipe import Subp... | lib/classes/voice_extractor.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v25.12.33 Legacy | 1,569 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
default_text,
speaker_wav=voice_path,
speaker=speaker,
voice_dir=pth_voice_dir,
**fine_tuned_params
)
... | No issues found. | default_text,
speaker_wav=voice_path,
speaker=speaker,
voice_dir=pth_voice_dir,
**fine_tuned_params
)
... | @@ -137,8 +137,8 @@ def convert(self, sentence_index:int, sentence:str)->bool:
if not part:
continue
if SML_TAG_PATTERN.fullmatch(part):
- bool, error = self._convert_sml(part)
- if not bool:
+ ... | lib/classes/tts_engines/bark.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.1.26 | 1,579 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
if model is not None:
session['custom_model'] = model
session['voice'] = os.path.join(model, f'{os.path.basename(os.path.normpath(model))}.wav')
msg = f'{os.path.basename(model)} a... | No issues found. | if model is not None:
session['custom_model'] = model
session['voice'] = os.path.join(model, f'{os.path.basename(os.path.normpath(model))}.wav')
msg = f'{os.path.basename(model)} a... | @@ -680,33 +680,36 @@ def enable_components(session_id:str)->tuple:
def disable_on_voice_upload()->tuple:
return (
- *([gr.update(interactive=False) for _ in range(8)]),
- gr.update(visible=False),
- gr.update(visib... | lib/gradio.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.1.26 | 1,581 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
vocals_idx = model.sources.index("vocals")
vocals = sources[0, vocals_idx]
audio_np = vocals.detach().cpu().numpy()
audio_np = audio_np.T
audio_np = (audio_np * 32767.0).clip(-32768, 32767).astype("int16")
audio_segment = AudioSegment(
... | No issues found. | vocals_idx = model.sources.index("vocals")
vocals = sources[0, vocals_idx]
audio_np = vocals.detach().cpu().numpy()
audio_np = audio_np.T
audio_np = (audio_np * 32767.0).clip(-32768, 32767).astype("int16")
audio_segment = AudioSegment(
... | @@ -245,15 +245,12 @@ def _trim_and_clean(self, silence_threshold:int, min_silence_len:int=200, chunk_
print(error)
return False, error
- def normalize_audio(self, src_file:str=None, proc_file:str=None, dst_file:str=None)->tuple[bool, str]:
+ def normalize_audio(self, src_file:str, pro... | lib/classes/voice_extractor.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.1.26 | 1,583 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
msg = f'{os.path.basename(model)} added to the custom models list'
state['type'] = 'success'
state['msg'] = msg
show_alert(state)
return gr.... | No issues found. | msg = f'{os.path.basename(model)} added to the custom models list'
state['type'] = 'success'
state['msg'] = msg
show_alert(state)
return gr.... | @@ -682,46 +682,45 @@ def disable_on_voice_upload()->tuple:
return (
gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False),
gr.update(interactive=False), gr.update(interactive=False), gr.update(in... | lib/gradio.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.1.27 | 1,586 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
print("\r[Demucs] 100.00%")
sources = result[0] if isinstance(result, (tuple, list)) else result
vocals_idx = model.sources.index("vocals")
vocals = sources[0, vocals_idx]
audio_np = vocals.detach().cpu().numpy()
audio_np = audio_np.T
a... | No issues found. | print("\r[Demucs] 100.00%")
sources = result[0] if isinstance(result, (tuple, list)) else result
vocals_idx = model.sources.index("vocals")
vocals = sources[0, vocals_idx]
audio_np = vocals.detach().cpu().numpy()
audio_np = audio_np.T
a... | @@ -104,14 +104,16 @@ def demucs_callback(d: dict):
if percent - last_percent >= 0.01:
last_percent = percent
print(f"\r[Demucs] {percent*100:.2f}%", end="", flush=True)
- self.progress_bar(percent, desc=msg)
+ if self.is_g... | lib/classes/voice_extractor.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.1.27 | 1,590 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
import os
from lib.conf import voices_dir
from lib.conf_models import TTS_ENGINES, default_engine_settings
models = {
"internal": {
"lang": "multi",
"repo": "tts_models/[lang_iso1]/[xxx]",
"sub": {
"multi-dataset/tortoise-v2": ['en'],
},
"voice": os.path.join(voi... | No issues found. | import os
from lib.conf import voices_dir
from lib.conf_models import TTS_ENGINES, default_engine_settings
models = {
"internal": {
"lang": "multi",
"repo": "tts_models/[lang_iso1]/[xxx]",
"sub": {
"multi-dataset/tortoise-v2": ['en'],
},
"voice": os.path.join(voi... | @@ -0,0 +1,18 @@
+import os
+from lib.conf import voices_dir
+from lib.conf_models import TTS_ENGINES, default_engine_settings
+
+models = {
+ "internal": {
+ "lang": "multi",
+ "repo": "tts_models/[lang_iso1]/[xxx]",
+ "sub": {
+ "multi-dataset/tortoise-v2": ['en'],
+ },
+ ... | lib/classes/tts_engines/presets/tortoise_presets.py | 0 | Python | 1 | none | 16 | 18 | 18 | true | v26.1.27 | 1,594 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
else:
integer_part = tok.replace(',', '')
return "{:,}".format(int(integer_part))
def clean_single_num(num_str:str)->str:
tok = unicodedata.normalize('NFKC', num_str)
if tok.lower() in ('inf', 'infinity', 'nan'):
return tok
clean = tok.replace(','... | No issues found. | else:
integer_part = tok.replace(',', '')
return "{:,}".format(int(integer_part))
def clean_single_num(num_str:str)->str:
tok = unicodedata.normalize('NFKC', num_str)
if tok.lower() in ('inf', 'infinity', 'nan'):
return tok
clean = tok.replace(','... | @@ -10,7 +10,7 @@
import traceback, socket, unicodedata, urllib.request, uuid, zipfile, fitz, multiprocessing
import ebooklib, gradio as gr, psutil, regex as re, requests, stanza, importlib, queue
-from typing import Any, TypeAlias, Generator, Callable, Iterable, Dict
+from typing import Any, TypeAlias, Generator, ... | lib/core.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.2.1 | 1,612 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
# ROCm
# ============================================================
elif has_working_rocm() and has_amd_gpu_pci():
version = ''
msg = ''
if os.name == 'posix':
for p in (
'/opt/rocm/.info/ve... | No issues found. | # ROCm
# ============================================================
elif has_working_rocm() and has_amd_gpu_pci():
version = ''
msg = ''
if os.name == 'posix':
for p in (
'/opt/rocm/.info/ve... | @@ -2,6 +2,7 @@
from functools import cached_property
from typing import Union
+from glob import glob
from importlib.metadata import version, PackageNotFoundError
from lib.conf import *
@@ -889,6 +890,27 @@ def install_device_packages(self, device_info_str:str)->int:
error =... | lib/classes/device_installer.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.2.1 | 1,615 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
raise ValueError(error)
def _check_xtts_builtin_speakers(self, current_voice:str, speaker:str)->str|bool:
new_current_voice = ''
proc_current_voice = ''
try:
import torch
import torchaudio
import numpy as np
from huggingface_hub im... | No issues found. | raise ValueError(error)
def _check_xtts_builtin_speakers(self, current_voice:str, speaker:str)->str|bool:
new_current_voice = ''
proc_current_voice = ''
try:
import torch
import torchaudio
import numpy as np
from huggingface_hub im... | @@ -458,12 +458,12 @@ def _convert_sml(self, sml:str)->tuple[bool, str]:
value = m.group('value')
assert tag in TTS_SML, f'Unknown SML tag: {tag!r}'
if tag == 'break':
- silence_time = float(int(np.random.uniform(0.3, 0.6) * 100) / 100)
+ silence_time = float(int(np.rand... | lib/classes/tts_engines/common/utils.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.2.5b1 | 1,618 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
BUILD_DOCKER = 'build_docker'
debug_mode = False
# ---------------------------------------------------------------------
# Python environment references
# ---------------------------------------------------------------------
python_env_dir = os.path.abspath(os.path.join('.','python_env'))
requirements_file ... | No issues found. | BUILD_DOCKER = 'build_docker'
debug_mode = False
# ---------------------------------------------------------------------
# Python environment references
# ---------------------------------------------------------------------
python_env_dir = os.path.abspath(os.path.join('.','python_env'))
requirements_file ... | @@ -69,6 +69,13 @@
debug_mode = False
+# ---------------------------------------------------------------------
+# Python environment references
+# ---------------------------------------------------------------------
+
+python_env_dir = os.path.abspath(os.path.join('.','python_env'))
+requirements_file = o... | lib/conf.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.2.19 | 1,632 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
all_group.add_argument(options[0], type=str, help=argparse.SUPPRESS)
parser.add_argument(options[1], type=str, help='''Session to resume the conversion in case of interruption, crash,
or reuse of custom models and custom cloning voices.''')
gui_group = parser.add_argument_group('**** The following opti... | No issues found. | all_group.add_argument(options[0], type=str, help=argparse.SUPPRESS)
parser.add_argument(options[1], type=str, help='''Session to resume the conversion in case of interruption, crash,
or reuse of custom models and custom cloning voices.''')
gui_group = parser.add_argument_group('**** The following opti... | @@ -70,7 +70,7 @@ def kill_previous_instances(script_name: str):
def main()->None:
wsl_cmd = ''
- if os.environ.get('DOCKER_IN_WSL', 0) == "1":
+ if os.environ.get('DOCKER_IN_WSL', '0') == "1":
wsl_cmd = 'wsl --user root --'
# Argument parser to handle optional parameters with descriptions
... | app.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.2.26 | 1,642 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
language="be",
with_stress=True
)
else:
part_phonemized = part
if self.params['current_voice'] is not None:
proc_dir = os.pa... | No issues found. | language="be",
with_stress=True
)
else:
part_phonemized = part
if self.params['current_voice'] is not None:
proc_dir = os.pa... | @@ -20,8 +20,6 @@ def __init__(self, session:DictProxy):
#random.seed(seed)
self.amp_dtype = self._apply_gpu_policy(enough_vram=enough_vram, seed=seed)
self.xtts_speakers = self._load_xtts_builtin_list()
- self.engine = self.load_engine()
- self.engine_zs = s... | lib/classes/tts_engines/glowtts.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.2.26 | 1,644 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
msg = f'TTS {self.tts_key} Loaded!'
print(msg)
return engine
except Exception as e:
error = 'load_engine(): engine is None'
raise RuntimeError(error)
def convert(self, sentence_index:int, sentence:str)->bool:
try:
import torch
... | No issues found. | msg = f'TTS {self.tts_key} Loaded!'
print(msg)
return engine
except Exception as e:
error = 'load_engine(): engine is None'
raise RuntimeError(error)
def convert(self, sentence_index:int, sentence:str)->bool:
try:
import torch
... | @@ -15,7 +15,17 @@ def __init__(self, session:DictProxy):
self.audio_segments = []
self.models = load_engine_presets(self.session['tts_engine'])
self.params = {}
- self.params['samplerate'] = self.models[self.session['fine_tuned']]['samplerate']
+ fine_tuned ... | lib/classes/tts_engines/yourtts.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.2.26 | 1,646 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
parser.add_argument(options[1], type=str, help='''Session to resume the conversion in case of interruption, crash,
or reuse of custom models and custom cloning voices.''')
gui_group = parser.add_argument_group('**** The following option are for gradio/gui mode only', 'Optional')
gui_group.add_argument(... | No issues found. | parser.add_argument(options[1], type=str, help='''Session to resume the conversion in case of interruption, crash,
or reuse of custom models and custom cloning voices.''')
gui_group = parser.add_argument_group('**** The following option are for gradio/gui mode only', 'Optional')
gui_group.add_argument(... | @@ -115,23 +115,20 @@ def main()->None:
{wsl_cmd} docker run -v "./ebooks:/app/ebooks" -v "./audiobooks:/app/audiobooks" -v "./models:/app/models" -v "./voices:/app/voices" -v "/my/real/ebooks/folder/absolute/path:/app/another_ebook_folder" --device=/dev/dri --rm -it -p 7860:7860 ebook2audiobook:xpu --headles... | app.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | v26.2.26 | 1,647 | DrewThomasson/ebook2audiobook | 13,365 | Python | ROBERT-MCDOWELL | |
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"log"
"os"
"path/filepath"
)
var (
FirefoxPath = "/usr/bin/firefox"
FirefoxProfile = os.Getenv("HOME") + "/.mozilla/fi... | What do you have against emojis 😁 | // Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"log"
"os"
"path/filepath"
)
var (
FirefoxPath = "/usr/bin/firefox"
FirefoxProfile = os.Getenv("HOME") + "/.mozilla/fi... | @@ -17,7 +17,8 @@ var (
)
func (m *mkcert) installPlatform() {
- log.Fatalf("-install is not yet supported on Linux 😣\nYou can manually install the root certificate at %q in the meantime.", filepath.Join(m.CAROOT, rootName))
+ log.Println(" -install is not yet fully supported on Linux") | truststore_linux.go | 20 | Go | 0.071 | suggestion | 33 | 25 | 25 | false | on linux don't declare we installed to the system store | 18 | FiloSottile/mkcert | 55,865 | Go | FiloSottile | adamdecaf |
}
}
return filepath.Join(dir, "mkcert")
}
func (m *mkcert) install() {
var printed bool
if !m.checkPlatform() {
if m.installPlatform() {
log.Print("The local CA is now installed in the system trust store! ⚡️")
}
m.ignoreCheckFailure = true // TODO: replace with a check for a successful install
printed... | Shouldn't this be behind a `if hasKeytool` like `if hasCertutil` above? | }
}
return filepath.Join(dir, "mkcert")
}
func (m *mkcert) install() {
var printed bool
if !m.checkPlatform() {
if m.installPlatform() {
log.Print("The local CA is now installed in the system trust store! ⚡️")
}
m.ignoreCheckFailure = true // TODO: replace with a check for a successful install
printed... | @@ -178,6 +182,11 @@ func (m *mkcert) install() {
}
printed = true
}
+ if hasJava && !m.checkJava() {
+ m.installJava() | main.go | 26 | Go | 0.429 | question | 71 | 51 | 51 | false | support install into java cacerts file | 38 | FiloSottile/mkcert | 55,865 | Go | FiloSottile | adamdecaf |
"crypto/x509"
"encoding/hex"
"encoding/pem"
"fmt"
"hash"
"io/ioutil"
"os"
"os/exec"
"path"
"strings"
)
var (
hasJava bool
hasKeytool bool
javaHome string
cacertsPath string
keytoolPath string
storePass string = "changeit"
)
func init() {
if v := os.Getenv("JAVA_HOME"); v != "" {
hasJava = ... | How common/expected is it for `JAVA_HOME` to be set in the default environment? | import (
"bytes"
"crypto/sha1"
"crypto/sha256"
"crypto/x509"
"encoding/hex"
"hash"
"os"
"os/exec"
"path"
"path/filepath"
"strings"
)
var (
hasJava bool
hasKeytool bool
javaHome string
cacertsPath string
keytoolPath string
storePass string = "changeit"
)
func init() {
if v := os.Getenv("JAVA... | @@ -0,0 +1,121 @@
+package main
+
+import (
+ "bytes"
+ "crypto/sha1"
+ "crypto/sha256"
+ "crypto/x509"
+ "encoding/hex"
+ "encoding/pem"
+ "fmt"
+ "hash"
+ "io/ioutil"
+ "os"
+ "os/exec"
+ "path"
+ "strings"
+)
+
+var (
+ hasJava bool
+ hasKeytool bool
+
+ javaHome string
+ cacertsPath string
+ keytoolPath strin... | truststore_java.go | 26 | Go | 0.357 | question | 79 | 51 | 51 | false | support install into java cacerts file | 38 | FiloSottile/mkcert | 55,865 | Go | FiloSottile | adamdecaf |
if v := os.Getenv("JAVA_HOME"); v != "" {
hasJava = true
javaHome = v
_, err := os.Stat(path.Join(v, "bin/keytool"))
if err == nil {
hasKeytool = true
keytoolPath = path.Join(v, "bin/keytool")
}
cacertsPath = path.Join(v, "jre/lib/security/cacerts")
}
}
func (m *mkcert) checkJava() bool {
// exi... | Nit: I would move the `[]byte` conversion to this line, as `fp` makes sense as a string, and we are converting it for the benefit of `bytes.Contains`. |
func init() {
if v := os.Getenv("JAVA_HOME"); v != "" {
hasJava = true
javaHome = v
_, err := os.Stat(path.Join(v, "bin/keytool"))
if err == nil {
hasKeytool = true
keytoolPath = path.Join(v, "bin/keytool")
}
cacertsPath = path.Join(v, "jre/lib/security/cacerts")
}
}
func (m *mkcert) checkJava()... | @@ -0,0 +1,121 @@
+package main
+
+import (
+ "bytes"
+ "crypto/sha1"
+ "crypto/sha256"
+ "crypto/x509"
+ "encoding/hex"
+ "encoding/pem"
+ "fmt"
+ "hash"
+ "io/ioutil"
+ "os"
+ "os/exec"
+ "path"
+ "strings"
+)
+
+var (
+ hasJava bool
+ hasKeytool bool
+
+ javaHome string
+ cacertsPath string
+ keytoolPath strin... | truststore_java.go | 26 | Go | 0.571 | nitpick | 150 | 51 | 51 | false | support install into java cacerts file | 38 | FiloSottile/mkcert | 55,865 | Go | FiloSottile | adamdecaf |
if err == nil {
hasKeytool = true
keytoolPath = path.Join(v, "bin/keytool")
}
cacertsPath = path.Join(v, "jre/lib/security/cacerts")
}
}
func (m *mkcert) checkJava() bool {
// exists returns true if the given x509.Certificate's fingerprint
// is in the keytool -list output
exists := func(c *x509.Certi... | Why? Could we catch it in `init()`? |
_, err := os.Stat(path.Join(v, "bin/keytool"))
if err == nil {
hasKeytool = true
keytoolPath = path.Join(v, "bin/keytool")
}
cacertsPath = path.Join(v, "jre/lib/security/cacerts")
}
}
func (m *mkcert) checkJava() bool {
// exists returns true if the given x509.Certificate's fingerprint
// is in the ... | @@ -0,0 +1,121 @@
+package main
+
+import (
+ "bytes"
+ "crypto/sha1"
+ "crypto/sha256"
+ "crypto/x509"
+ "encoding/hex"
+ "encoding/pem"
+ "fmt"
+ "hash"
+ "io/ioutil"
+ "os"
+ "os/exec"
+ "path"
+ "strings"
+)
+
+var (
+ hasJava bool
+ hasKeytool bool
+
+ javaHome string
+ cacertsPath string
+ keytoolPath strin... | truststore_java.go | 26 | Go | 0.286 | question | 35 | 51 | 51 | false | support install into java cacerts file | 38 | FiloSottile/mkcert | 55,865 | Go | FiloSottile | adamdecaf |
func init() {
if v := os.Getenv("JAVA_HOME"); v != "" {
hasJava = true
javaHome = v
_, err := os.Stat(path.Join(v, "bin/keytool"))
if err == nil {
hasKeytool = true
keytoolPath = path.Join(v, "bin/keytool")
}
cacertsPath = path.Join(v, "jre/lib/security/cacerts")
}
}
func (m *mkcert) checkJava()... | "delimitated"
But also, the ":" are gone by the time we get here, so this comment is confusing. | storePass string = "changeit"
)
func init() {
if v := os.Getenv("JAVA_HOME"); v != "" {
hasJava = true
javaHome = v
_, err := os.Stat(path.Join(v, "bin/keytool"))
if err == nil {
hasKeytool = true
keytoolPath = path.Join(v, "bin/keytool")
}
cacertsPath = path.Join(v, "jre/lib/security/cacerts")... | @@ -0,0 +1,121 @@
+package main
+
+import (
+ "bytes"
+ "crypto/sha1"
+ "crypto/sha256"
+ "crypto/x509"
+ "encoding/hex"
+ "encoding/pem"
+ "fmt"
+ "hash"
+ "io/ioutil"
+ "os"
+ "os/exec"
+ "path"
+ "strings"
+)
+
+var (
+ hasJava bool
+ hasKeytool bool
+
+ javaHome string
+ cacertsPath string
+ keytoolPath strin... | truststore_java.go | 26 | Go | 0.214 | suggestion | 98 | 51 | 51 | false | support install into java cacerts file | 38 | FiloSottile/mkcert | 55,865 | Go | FiloSottile | adamdecaf |
}
func (m *mkcert) uninstallJava() {
args := []string{
"-delete",
"-alias", fmt.Sprintf("'%s'", m.caUniqueName()),
"-keystore", cacertsPath,
"-storepass", storePass,
}
out, err := m.execKeytool(exec.Command(keytoolPath, args...))
if bytes.Contains(out, []byte("does not exist")) {
return // cert didn't ex... | Nit: `javaHome` is a string, no need for `fmt.Sprintf`, just use `+`. | // Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"bytes"
"crypto/sha1"
"crypto/sha256"
"crypto/x509"
"encoding/hex"
"hash"
"os"
"os/exec"
"path"
"path/filepath"
"strings"
)
v... | @@ -0,0 +1,121 @@
+package main
+
+import (
+ "bytes"
+ "crypto/sha1"
+ "crypto/sha256"
+ "crypto/x509"
+ "encoding/hex"
+ "encoding/pem"
+ "fmt"
+ "hash"
+ "io/ioutil"
+ "os"
+ "os/exec"
+ "path"
+ "strings"
+)
+
+var (
+ hasJava bool
+ hasKeytool bool
+
+ javaHome string
+ cacertsPath string
+ keytoolPath strin... | truststore_java.go | 26 | Go | 0.429 | nitpick | 69 | 32 | 108 | false | support install into java cacerts file | 38 | FiloSottile/mkcert | 55,865 | Go | FiloSottile | adamdecaf |
fp := []byte(strings.ToUpper(hex.EncodeToString(h.Sum(nil))))
return bytes.Contains(keytoolOutput, fp)
}
keytoolOutput, err := exec.Command(keytoolPath, "-list", "-keystore", cacertsPath, "-storepass", storePass).CombinedOutput()
if err != nil {
hasKeytool = false
return false
}
keytoolOutput = bytes.Repl... | Could you use the certificate file on disk? See for example the macOS `security` input. |
keytoolOutput, err := exec.Command(keytoolPath, "-list", "-keystore", cacertsPath, "-storepass", storePass).CombinedOutput()
fatalIfCmdErr(err, "keytool -list", keytoolOutput)
// keytool outputs SHA1 and SHA256 (Java 9+) certificates in uppercase hex
// with each octet pair delimitated by ":". Drop them from the k... | @@ -0,0 +1,121 @@
+package main
+
+import (
+ "bytes"
+ "crypto/sha1"
+ "crypto/sha256"
+ "crypto/x509"
+ "encoding/hex"
+ "encoding/pem"
+ "fmt"
+ "hash"
+ "io/ioutil"
+ "os"
+ "os/exec"
+ "path"
+ "strings"
+)
+
+var (
+ hasJava bool
+ hasKeytool bool
+
+ javaHome string
+ cacertsPath string
+ keytoolPath strin... | truststore_java.go | 26 | Go | 0.571 | security | 87 | 51 | 51 | false | support install into java cacerts file | 38 | FiloSottile/mkcert | 55,865 | Go | FiloSottile | adamdecaf |
"-file", filepath.Join(m.CAROOT, rootName),
"-alias", m.caUniqueName(),
}
out, err := m.execKeytool(exec.Command(keytoolPath, args...))
fatalIfCmdErr(err, "keytool -importcert", out)
}
func (m *mkcert) uninstallJava() {
args := []string{
"-delete",
"-alias", m.caUniqueName(),
"-keystore", cacertsPath,
... | I see https://github.com/FiloSottile/mkcert/commit/564b41305c34b37318c3f3130c32d87980af074e added CommandWithSudo. I'll switch to that here. | "-storepass", storePass,
"-file", filepath.Join(m.CAROOT, rootName),
"-alias", m.caUniqueName(),
}
out, err := m.execKeytool(exec.Command(keytoolPath, args...))
fatalIfCmdErr(err, "keytool -importcert", out)
}
func (m *mkcert) uninstallJava() {
args := []string{
"-delete",
"-alias", m.caUniqueName(),
... | @@ -0,0 +1,106 @@
+package main
+
+import (
+ "bytes"
+ "crypto/sha1"
+ "crypto/sha256"
+ "crypto/x509"
+ "encoding/hex"
+ "hash"
+ "os"
+ "os/exec"
+ "path"
+ "path/filepath"
+ "strings"
+)
+
+var (
+ hasJava bool
+ hasKeytool bool
+
+ javaHome string
+ cacertsPath string
+ keytoolPath string
+ storePass strin... | truststore_java.go | 26 | Go | 0.357 | suggestion | 141 | 38 | 39 | false | support install into java cacerts file | 38 | FiloSottile/mkcert | 55,865 | Go | adamdecaf | adamdecaf |
continue
}
punycode, err := idna.ToASCII(name)
if err != nil {
log.Fatalf("ERROR: %q is not a valid hostname or IP: %s", name, err)
}
args[i] = punycode
if !hostnameRegexp.MatchString(punycode) {
log.Fatalf("ERROR: %q is not a valid hostname or IP", name)
}
}
m.makeCert(args)
}
func getCAROOT... | Just realized that this needs to return and empty string from the calling function, too.
How would you feel about introducing an error return value instead of using the empty string as a sentinel? | continue
}
punycode, err := idna.ToASCII(name)
if err != nil {
log.Fatalf("ERROR: %q is not a valid hostname or IP: %s", name, err)
}
args[i] = punycode
if !hostnameRegexp.MatchString(punycode) {
log.Fatalf("ERROR: %q is not a valid hostname or IP", name)
}
}
m.makeCert(args)
}
func getCAROOT... | @@ -131,32 +131,30 @@ print it with "mkcert -CAROOT".
m.makeCert(args)
}
+func getCAROOTFolder() string {
+ if runtime.GOOS == "windows" {
+ return os.Getenv("LocalAppData")
+ }
+ dir := os.Getenv("XDG_DATA_HOME")
+ if dir != "" {
+ return dir
+ }
+ home := os.Getenv("HOME")
+ if home == "" {
+ return "" | main.go | 26 | Go | 0.571 | question | 199 | 51 | 51 | false | Use $XDG_DATA_HOME on macOS if it is set. | 40 | FiloSottile/mkcert | 55,865 | Go | lgarron | lgarron |
// Load cert
cert, err := ioutil.ReadFile(filepath.Join(m.CAROOT, rootName))
fatalIfErr(err, "failed to read root certificate")
// Decode PEM
if certBlock, _ := pem.Decode(cert); certBlock == nil || certBlock.Type != "CERTIFICATE" {
fatalIfErr(fmt.Errorf("Invalid PEM data"), "decode pem")
} else {
cert = cert... | Should this just be pulled from the certificate?
https://github.com/FiloSottile/mkcert/blob/master/cert.go#L53 | func (m *mkcert) installPlatform() bool {
// Load cert
cert, err := ioutil.ReadFile(filepath.Join(m.CAROOT, rootName))
fatalIfErr(err, "failed to read root certificate")
// Decode PEM
if certBlock, _ := pem.Decode(cert); certBlock == nil || certBlock.Type != "CERTIFICATE" {
fatalIfErr(fmt.Errorf("Invalid PEM dat... | @@ -0,0 +1,129 @@
+package main
+
+import (
+ "crypto/x509"
+ "encoding/pem"
+ "fmt"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "syscall"
+ "unsafe"
+)
+
+var (
+ FirefoxPath = "C:\\Program Files\\Mozilla Firefox"
+ FirefoxProfile = os.Getenv("USERPROFILE") + "\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles"
... | truststore_windows.go | 26 | Go | 0.429 | suggestion | 114 | 51 | 51 | false | Add Windows Support | 46 | FiloSottile/mkcert | 55,865 | Go | adamdecaf | cretz |
uintptr(len(cert)), // DWORD cbCertEncoded
3, // DWORD dwAddDisposition (CERT_STORE_ADD_REPLACE_EXISTING is 3)
0, // PCCERT_CONTEXT *ppCertContext
... | Use `C.GoBytes` https://golang.org/cmd/cgo/#hdr-Go_references_to_C | uintptr(unsafe.Pointer(&cert[0])), // const BYTE *pbCertEncoded
uintptr(len(cert)), // DWORD cbCertEncoded
3, // DWORD dwAddDisposition (CERT_STORE_ADD_REPLACE_EXISTING is 3)
0, ... | @@ -0,0 +1,129 @@
+package main
+
+import (
+ "crypto/x509"
+ "encoding/pem"
+ "fmt"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "syscall"
+ "unsafe"
+)
+
+var (
+ FirefoxPath = "C:\\Program Files\\Mozilla Firefox"
+ FirefoxProfile = os.Getenv("USERPROFILE") + "\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles"
... | truststore_windows.go | 26 | Go | 0.429 | suggestion | 66 | 42 | 43 | false | Add Windows Support | 46 | FiloSottile/mkcert | 55,865 | Go | FiloSottile | cretz |
hasJava bool
hasKeytool bool
javaHome string
cacertsPath string
keytoolPath string
storePass string = "changeit"
)
func init() {
keytoolPath = "bin/keytool"
if runtime.GOOS == "windows" {
keytoolPath += ".exe"
}
if v := os.Getenv("JAVA_HOME"); v != "" {
hasJava = true
javaHome = v
_, err :... | Is this path created by the java installer on macos? I ran a fresh install of jdk 10 on win10 and don't see this path anywhere. I can try it on my mac as well, but I would imagine the path would be at the very least something like `/jre10.0.1/` or something like that. | hasKeytool bool
javaHome string
cacertsPath string
keytoolPath string
storePass string = "changeit"
)
func init() {
if runtime.GOOS == "windows" {
keytoolPath = filepath.Join("bin", "keytool.exe")
} else {
keytoolPath = filepath.Join("bin", "keytool")
}
if v := os.Getenv("JAVA_HOME"); v != "" {
h... | @@ -29,14 +30,19 @@ var (
)
func init() {
+ keytoolPath = "bin/keytool"
+ if runtime.GOOS == "windows" {
+ keytoolPath += ".exe"
+ }
+
if v := os.Getenv("JAVA_HOME"); v != "" {
hasJava = true
javaHome = v
- _, err := os.Stat(path.Join(v, "bin/keytool"))
+ _, err := os.Stat(path.Join(v, keytoolPath))
... | truststore_java.go | 26 | Go | 0.571 | question | 268 | 51 | 51 | false | java: fix keytool path detection on windows and JRE/JDK | 54 | FiloSottile/mkcert | 55,865 | Go | nickkaczmarek | adamdecaf |
"os/exec"
"os/user"
"path/filepath"
"regexp"
"strconv"
"strings"
"time"
"software.sslmate.com/src/go-pkcs12"
)
var userAndHostname string
func init() {
u, _ := user.Current()
if u != nil {
userAndHostname = u.Username + "@"
}
out, _ := exec.Command("hostname").Output()
userAndHostname += strings.TrimS... | Are these replacements needed because of how we generate names? | "os/user"
"path/filepath"
"regexp"
"strconv"
"strings"
"time"
"software.sslmate.com/src/go-pkcs12"
)
var userAndHostname string
func init() {
u, _ := user.Current()
if u != nil {
userAndHostname = u.Username + "@"
}
out, _ := exec.Command("hostname").Output()
userAndHostname += strings.TrimSpace(string... | @@ -39,6 +40,34 @@ func init() {
userAndHostname += strings.TrimSpace(string(out))
}
+// getFileName generate file name according to flags
+func (m *mkcert) getFileName(w string, args []string) (name string, err error) {
+ filename := strings.Replace(args[0], ":", "_", -1)
+ filename = strings.Replace(filename, "*... | cert.go | 26 | Go | 0.286 | question | 64 | 51 | 51 | false | Add ability of customizing file name | 77 | FiloSottile/mkcert | 55,865 | Go | adamdecaf | sleagon |
certname, err = m.getFileName("cert", hosts)
fatalIfErr(err, "failed to generate cert file name")
err = ioutil.WriteFile(certname, pem.EncodeToMemory(
&pem.Block{Type: "CERTIFICATE", Bytes: cert}), 0644)
fatalIfErr(err, "failed to save certificate key")
} else {
domainCert, _ := x509.ParseCertificate(cert... | Shouldn't the parameters be the other way around? `certname` first, `keyname` second. | } else {
log.Printf("\nThe PKCS#12 bundle is at \"%s\" ✅\n", p12File)
log.Printf("\nThe legacy PKCS#12 encryption password is the often hardcoded default \"changeit\" ℹ️\n\n")
}
}
func (m *mkcert) fileNames(hosts []string) (certFile, keyFile, p12File string) {
defaultName := strings.Replace(hosts[0], ":", "_", ... | @@ -111,9 +140,9 @@ func (m *mkcert) makeCert(hosts []string) {
}
if !m.pkcs12 {
- log.Printf("\nThe certificate is at \"./%s.pem\" and the key at \"./%s-key.pem\" ✅\n\n", filename, filename)
+ log.Printf("\nThe certificate is at \"./%s\" and the key at \"./%s\" ✅\n\n", keyname, certname) | cert.go | 26 | Go | 0.429 | suggestion | 85 | 51 | 51 | false | Add ability of customizing file name | 77 | FiloSottile/mkcert | 55,865 | Go | vladmarica | sleagon |
}
if m.csrPath != "" {
m.makeCertFromCSR()
return
}
if len(args) == 0 {
flag.Usage()
return
}
hostnameRegexp := regexp.MustCompile(`(?i)^(\*\.)?[0-9a-z_-]([0-9a-z._-]*[0-9a-z_-])?$`)
for i, name := range args {
if ip := net.ParseIP(name); ip != nil {
continue
}
if email, err := mail.ParseAddr... | Here and below, update the error. | }
if m.csrPath != "" {
m.makeCertFromCSR()
return
}
if len(args) == 0 {
flag.Usage()
return
}
hostnameRegexp := regexp.MustCompile(`(?i)^(\*\.)?[0-9a-z_-]([0-9a-z._-]*[0-9a-z_-])?$`)
for i, name := range args {
if ip := net.ParseIP(name); ip != nil {
continue
}
if email, err := mail.ParseAddr... | @@ -194,6 +195,9 @@ func (m *mkcert) Run(args []string) {
if email, err := mail.ParseAddress(name); err == nil && email.Address == name {
continue
}
+ if _, err := url.Parse(name); err == nil {
+ continue
+ }
punycode, err := idna.ToASCII(name)
if err != nil {
log.Fatalf("ERROR: %q is not a vali... | main.go | 26 | Go | 0.214 | suggestion | 33 | 51 | 51 | false | Add support for certificates with client and server auth and URL SANs | 166 | FiloSottile/mkcert | 55,865 | Go | FiloSottile | robertpanzer |
log.Println("Warning: the local CA is not installed in the Java trust store! ⚠️")
}
if warning {
log.Println("Run \"mkcert -install\" to avoid verification errors ‼️")
}
}
if m.csrPath != "" {
m.makeCertFromCSR()
return
}
if len(args) == 0 {
flag.Usage()
return
}
hostnameRegexp := regexp.Mu... | This is missing the extra validation that happens in `cert.go`. | log.Println("Warning: the local CA is not installed in the Java trust store! ⚠️")
}
if warning {
log.Println("Run \"mkcert -install\" to avoid verification errors ‼️")
}
}
if m.csrPath != "" {
m.makeCertFromCSR()
return
}
if len(args) == 0 {
flag.Usage()
return
}
hostnameRegexp := regexp.Mu... | @@ -194,6 +195,9 @@ func (m *mkcert) Run(args []string) {
if email, err := mail.ParseAddress(name); err == nil && email.Address == name {
continue
}
+ if _, err := url.Parse(name); err == nil { | main.go | 26 | Go | 0.357 | suggestion | 63 | 51 | 51 | false | Add support for certificates with client and server auth and URL SANs | 166 | FiloSottile/mkcert | 55,865 | Go | FiloSottile | robertpanzer |
}
priv, err := m.generateKey(false)
fatalIfErr(err, "failed to generate certificate key")
pub := priv.(crypto.Signer).Public()
tpl := &x509.Certificate{
SerialNumber: randomSerialNumber(),
Subject: pkix.Name{
Organization: []string{"mkcert development certificate"},
OrganizationalUnit: []string{u... | I'm a bit worried this will catch things some people want as hostnames. Anything with a `:` will parse as an URI with `Scheme != ""`, and sometimes people use `:` in hostnames, for example.
Are there other filters we can apply while still working for your use case? | }
priv, err := m.generateKey(false)
fatalIfErr(err, "failed to generate certificate key")
pub := priv.(crypto.Signer).Public()
tpl := &x509.Certificate{
SerialNumber: randomSerialNumber(),
Subject: pkix.Name{
Organization: []string{"mkcert development certificate"},
OrganizationalUnit: []string{u... | @@ -70,13 +71,15 @@ func (m *mkcert) makeCert(hosts []string) {
tpl.IPAddresses = append(tpl.IPAddresses, ip)
} else if email, err := mail.ParseAddress(h); err == nil && email.Address == h {
tpl.EmailAddresses = append(tpl.EmailAddresses, h)
+ } else if uriName, err := url.Parse(h); err == nil && uriName.Sc... | cert.go | 26 | Go | 0.643 | question | 268 | 51 | 51 | false | Add support for certificates with client and server auth and URL SANs | 166 | FiloSottile/mkcert | 55,865 | Go | FiloSottile | robertpanzer |
}
if m.csrPath != "" {
m.makeCertFromCSR()
return
}
if len(args) == 0 {
flag.Usage()
return
}
hostnameRegexp := regexp.MustCompile(`(?i)^(\*\.)?[0-9a-z_-]([0-9a-z._-]*[0-9a-z_-])?$`)
for i, name := range args {
if ip := net.ParseIP(name); ip != nil {
continue
}
if email, err := mail.ParseAddr... | ```suggestion
log.Fatalf("ERROR: %q is not a valid hostname, IP, URL or email: %s", name, err)
``` | }
if m.csrPath != "" {
m.makeCertFromCSR()
return
}
if len(args) == 0 {
flag.Usage()
return
}
hostnameRegexp := regexp.MustCompile(`(?i)^(\*\.)?[0-9a-z_-]([0-9a-z._-]*[0-9a-z_-])?$`)
for i, name := range args {
if ip := net.ParseIP(name); ip != nil {
continue
}
if email, err := mail.ParseAddr... | @@ -194,13 +195,16 @@ func (m *mkcert) Run(args []string) {
if email, err := mail.ParseAddress(name); err == nil && email.Address == name {
continue
}
+ if uriName, err := url.Parse(name); err == nil && uriName.Scheme != "" && uriName.Host != "" {
+ continue
+ }
punycode, err := idna.ToASCII(name)
i... | main.go | 26 | Go | 0.857 | suggestion | 103 | 51 | 51 | false | Add support for certificates with client and server auth and URL SANs | 166 | FiloSottile/mkcert | 55,865 | Go | FiloSottile | robertpanzer |
return
}
if len(args) == 0 {
flag.Usage()
return
}
hostnameRegexp := regexp.MustCompile(`(?i)^(\*\.)?[0-9a-z_-]([0-9a-z._-]*[0-9a-z_-])?$`)
for i, name := range args {
if ip := net.ParseIP(name); ip != nil {
continue
}
if email, err := mail.ParseAddress(name); err == nil && email.Address == name {... | ```suggestion
log.Fatalf("ERROR: %q is not a valid hostname, IP, URL or email", name)
``` | return
}
if len(args) == 0 {
flag.Usage()
return
}
hostnameRegexp := regexp.MustCompile(`(?i)^(\*\.)?[0-9a-z_-]([0-9a-z._-]*[0-9a-z_-])?$`)
for i, name := range args {
if ip := net.ParseIP(name); ip != nil {
continue
}
if email, err := mail.ParseAddress(name); err == nil && email.Address == name {... | @@ -194,13 +195,16 @@ func (m *mkcert) Run(args []string) {
if email, err := mail.ParseAddress(name); err == nil && email.Address == name {
continue
}
+ if uriName, err := url.Parse(name); err == nil && uriName.Scheme != "" && uriName.Host != "" {
+ continue
+ }
punycode, err := idna.ToASCII(name)
i... | main.go | 26 | Go | 0.714 | suggestion | 94 | 51 | 51 | false | Add support for certificates with client and server auth and URL SANs | 166 | FiloSottile/mkcert | 55,865 | Go | FiloSottile | robertpanzer |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.