mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add piper as dependency on Linux
This commit is contained in:
parent
be476c304c
commit
7fbc1d7184
@ -1156,5 +1156,16 @@
|
|||||||
"hash": "sha256:c3f9e322b1ebeebd44e3d9d2d9b124e0c550c1ef41bd552afdcdd719516ee41a",
|
"hash": "sha256:c3f9e322b1ebeebd44e3d9d2d9b124e0c550c1ef41bd552afdcdd719516ee41a",
|
||||||
"urls": ["pypi"]
|
"urls": ["pypi"]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "piper",
|
||||||
|
"os": "linux",
|
||||||
|
"unix": {
|
||||||
|
"filename": "piper-2023.11.14.tar.gz",
|
||||||
|
"hash": "sha256:8b684e102cfe23af097830db9555a8641f17735725853c531a1daeb34b6ed1a8",
|
||||||
|
"urls": ["https://github.com/rhasspy/piper/archive/refs/tags/2023.11.14-2.tar.gz"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
@ -168,6 +168,7 @@ username = api
|
|||||||
elif action == 'test':
|
elif action == 'test':
|
||||||
os.environ['CI'] = 'true'
|
os.environ['CI'] = 'true'
|
||||||
os.environ['OPENSSL_MODULES'] = os.path.join(SW, 'lib', 'ossl-modules')
|
os.environ['OPENSSL_MODULES'] = os.path.join(SW, 'lib', 'ossl-modules')
|
||||||
|
os.environ['PIPER_TTS_DIR'] = os.path.join(SW, 'piper')
|
||||||
if ismacos:
|
if ismacos:
|
||||||
os.environ['SSL_CERT_FILE'] = os.path.abspath(
|
os.environ['SSL_CERT_FILE'] = os.path.abspath(
|
||||||
'resources/mozilla-ca-certs.pem')
|
'resources/mozilla-ca-certs.pem')
|
||||||
|
@ -505,3 +505,18 @@ def bundled_binaries_dir() -> str:
|
|||||||
if (islinux or isbsd) and getattr(sys, 'frozen', False):
|
if (islinux or isbsd) and getattr(sys, 'frozen', False):
|
||||||
return os.path.join(sys.executables_location, 'bin')
|
return os.path.join(sys.executables_location, 'bin')
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
|
@lru_cache(2)
|
||||||
|
def piper_cmdline() -> tuple[str, ...]:
|
||||||
|
ext = '.exe' if iswindows else ''
|
||||||
|
if bbd := bundled_binaries_dir():
|
||||||
|
# TODO: Add path to espeak-ng-data with --
|
||||||
|
return (os.path.join(bbd, 'piper' + ext),)
|
||||||
|
if pd := os.environ.get('PIPER_TTS_DIR'):
|
||||||
|
return (os.path.join(pd, 'piper' + ext),)
|
||||||
|
import shutil
|
||||||
|
exe = shutil.which('piper-tts')
|
||||||
|
if exe:
|
||||||
|
return (exe,)
|
||||||
|
return ()
|
||||||
|
@ -29,9 +29,9 @@ from qt.core import (
|
|||||||
sip,
|
sip,
|
||||||
)
|
)
|
||||||
|
|
||||||
from calibre.constants import cache_dir, is_debugging
|
from calibre.constants import cache_dir, is_debugging, piper_cmdline
|
||||||
from calibre.gui2 import error_dialog
|
from calibre.gui2 import error_dialog
|
||||||
from calibre.gui2.tts.types import EngineSpecificSettings, Quality, TTSBackend, Voice, piper_cmdline, widget_parent
|
from calibre.gui2.tts.types import EngineSpecificSettings, Quality, TTSBackend, Voice, widget_parent
|
||||||
from calibre.spell.break_iterator import PARAGRAPH_SEPARATOR, split_into_sentences_for_tts
|
from calibre.spell.break_iterator import PARAGRAPH_SEPARATOR, split_into_sentences_for_tts
|
||||||
from calibre.utils.localization import canonicalize_lang, get_lang
|
from calibre.utils.localization import canonicalize_lang, get_lang
|
||||||
from calibre.utils.resources import get_path as P
|
from calibre.utils.resources import get_path as P
|
||||||
|
@ -9,7 +9,7 @@ from typing import Literal, NamedTuple
|
|||||||
|
|
||||||
from qt.core import QApplication, QLocale, QObject, QTextToSpeech, QVoice, QWidget, pyqtSignal
|
from qt.core import QApplication, QLocale, QObject, QTextToSpeech, QVoice, QWidget, pyqtSignal
|
||||||
|
|
||||||
from calibre.constants import bundled_binaries_dir, islinux, ismacos, iswindows
|
from calibre.constants import islinux, ismacos, iswindows, piper_cmdline
|
||||||
from calibre.utils.config import JSONConfig
|
from calibre.utils.config import JSONConfig
|
||||||
from calibre.utils.config_base import tweaks
|
from calibre.utils.config_base import tweaks
|
||||||
from calibre.utils.localization import canonicalize_lang
|
from calibre.utils.localization import canonicalize_lang
|
||||||
@ -21,20 +21,6 @@ def load_config() -> JSONConfig:
|
|||||||
return JSONConfig(CONFIG_NAME)
|
return JSONConfig(CONFIG_NAME)
|
||||||
|
|
||||||
|
|
||||||
@lru_cache(2)
|
|
||||||
def piper_cmdline() -> tuple[str, ...]:
|
|
||||||
ext = '.exe' if iswindows else ''
|
|
||||||
if bbd := bundled_binaries_dir():
|
|
||||||
# TODO: Add path to espeak-ng-data with --
|
|
||||||
return (os.path.join(bbd, 'piper' + ext),)
|
|
||||||
import shutil
|
|
||||||
exe = shutil.which('piper-tts')
|
|
||||||
if exe:
|
|
||||||
return (exe,)
|
|
||||||
return ()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TrackingCapability(Enum):
|
class TrackingCapability(Enum):
|
||||||
NoTracking: int = auto()
|
NoTracking: int = auto()
|
||||||
WordByWord: int = auto()
|
WordByWord: int = auto()
|
||||||
|
@ -123,6 +123,15 @@ class BuildTest(unittest.TestCase):
|
|||||||
from speechd.client import SSIPClient
|
from speechd.client import SSIPClient
|
||||||
del SSIPClient
|
del SSIPClient
|
||||||
|
|
||||||
|
@unittest.skipUnless(islinux, 'Piper only used on Linux')
|
||||||
|
def test_piper(self):
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
from calibre.constants import piper_cmdline
|
||||||
|
self.assertTrue(piper_cmdline())
|
||||||
|
raw = subprocess.check_output(piper_cmdline() + ('-h',), stderr=subprocess.STDOUT).decode()
|
||||||
|
self.assertIn('--sentence_silence', raw)
|
||||||
|
|
||||||
def test_zeroconf(self):
|
def test_zeroconf(self):
|
||||||
import ifaddr
|
import ifaddr
|
||||||
import zeroconf as z
|
import zeroconf as z
|
||||||
|
Loading…
x
Reference in New Issue
Block a user