Add mimic3-download tool
This commit is contained in:
parent
d949b1c118
commit
824783b05a
2 changed files with 83 additions and 1 deletions
77
docker/mimic3-download
Executable file
77
docker/mimic3-download
Executable file
|
|
@ -0,0 +1,77 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright 2022 Mycroft AI Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# Run mimic3-download --update to update Docker image
|
||||
|
||||
args=()
|
||||
repo='mycroftai/mimic3'
|
||||
tag='latest'
|
||||
docker='docker'
|
||||
|
||||
while [[ -n "$1" ]]; do
|
||||
if [[ "$1" == '--update' ]]; then
|
||||
# Update Docker image
|
||||
update='1'
|
||||
args+=("$1")
|
||||
else
|
||||
args+=("$1")
|
||||
fi
|
||||
|
||||
shift 1
|
||||
done
|
||||
|
||||
if [[ -n "${update}" ]]; then
|
||||
docker pull "${repo}:${tag}"
|
||||
fi
|
||||
|
||||
docker_run_args=()
|
||||
|
||||
if [[ -d /etc/ssl/certs ]]; then
|
||||
# This directory seems to usually have symlinks to other directories
|
||||
docker_run_args+=('-v' '/etc/ssl/certs:/etc/ssl/certs:ro')
|
||||
|
||||
# Create temp file with all certificate directories found
|
||||
cert_dirs_file="$(mktemp)"
|
||||
function finish {
|
||||
rm -rf "${cert_dirs_file}"
|
||||
}
|
||||
trap finish EXIT
|
||||
|
||||
while read -r cert_path; do
|
||||
# Follow symlinks and record directory paths
|
||||
cert_path="$(readlink -f "${cert_path}")"
|
||||
cert_dir="$(dirname "${cert_path}")"
|
||||
echo $cert_dir >> "${cert_dirs_file}"
|
||||
done < <(find /etc/ssl/certs -name '*.pem' -type l)
|
||||
|
||||
# Map unique certificate directories
|
||||
while read -r cert_dir; do
|
||||
docker_run_args+=('-v' "${cert_dir}:${cert_dir}:ro")
|
||||
done < <(sort < "${cert_dirs_file}" | uniq)
|
||||
fi
|
||||
|
||||
"${docker}" run \
|
||||
-i \
|
||||
-e "HOME=${HOME}" \
|
||||
-v "$HOME:${HOME}" \
|
||||
-w "${PWD}" \
|
||||
--device /dev/snd:/dev/snd \
|
||||
--user "$(id -u):$(id -g)" "${docker_run_args[@]}" \
|
||||
--entrypoint '/home/mimic3/app/.venv/bin/python3' \
|
||||
"${repo}:${tag}" \
|
||||
-m mimic3_download \
|
||||
"${args[@]}"
|
||||
|
|
@ -84,7 +84,12 @@ setup(
|
|||
package_data={"mimic3_tts": ["VERSION", "py.typed", "voices.json"]},
|
||||
install_requires=requirements,
|
||||
extras_require={':python_version<"3.9"': ["importlib_resources"], **extras_require},
|
||||
entry_points={"console_scripts": ["mimic3 = mimic3_cli.__main__:main"]},
|
||||
entry_points={
|
||||
"console_scripts": [
|
||||
"mimic3 = mimic3_tts.__main__:main",
|
||||
"mimic3-download = mimic3_tts.download:main",
|
||||
]
|
||||
},
|
||||
classifiers=[
|
||||
"Development Status :: 3 - Alpha",
|
||||
"Intended Audience :: Developers",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue