@oxiaom/adoremix 1.0.54 → 1.0.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxiaom/adoremix",
3
- "version": "1.0.54",
3
+ "version": "1.0.56",
4
4
  "description": "AdoreMix broadcast server - cross-platform installer, runner and service manager",
5
5
  "bin": {
6
6
  "adoremix": "./bin/adoremix.js"
@@ -41,7 +41,8 @@
41
41
  "templates",
42
42
  "tts",
43
43
  "webui",
44
- "config-manager"
44
+ "config-manager",
45
+ "audio8-assets"
45
46
  ],
46
47
  "keywords": [
47
48
  "adoremix",
@@ -211,6 +211,13 @@ function buildSystemdUnit() {
211
211
  try { execSync('command -v python3.11 2>/dev/null', { shell: '/bin/bash', stdio: 'pipe' }); return 'python3.11'; }
212
212
  catch (e) { return 'python3'; }
213
213
  })();
214
+ // systemd 不展开 ~,必须用绝对路径(root 下 $HOME=/root)
215
+ const home = (function(){
216
+ try { return execSync('/bin/bash -c "echo $HOME"', { shell: '/bin/bash', stdio: 'pipe', encoding: 'utf8' }).trim() || '/root'; }
217
+ catch (e) { return '/root'; }
218
+ })();
219
+ const deployDir = AUDIO8_DEPLOY_DIR.replace(/^~/, home);
220
+ const venvDir = AUDIO8_VENV_DIR.replace(/^~/, home);
214
221
  return `[Unit]
215
222
  Description=Audio8 TTS (AdoreMix)
216
223
  After=network.target
@@ -218,9 +225,9 @@ After=network.target
218
225
  [Service]
219
226
  Type=simple
220
227
  User=root
221
- WorkingDirectory=${AUDIO8_DEPLOY_DIR}/onnx_runtime
222
- Environment=PATH=${AUDIO8_VENV_DIR}/bin:/usr/bin:/bin
223
- ExecStart=${AUDIO8_VENV_DIR}/bin/${pyBin} -m arktts_runtime.service --model-dir ./model --voices-dir ./model/voices --port ${AUDIO8_DEFAULT_PORT}
228
+ WorkingDirectory=${deployDir}/onnx_runtime
229
+ Environment=PATH=${venvDir}/bin:/usr/bin:/bin
230
+ ExecStart=${venvDir}/bin/${pyBin} -m arktts_runtime.service --model-dir ./model --voices-dir ./model/voices --port ${AUDIO8_DEFAULT_PORT}
224
231
  Restart=on-failure
225
232
  RestartSec=5
226
233
 
@@ -289,7 +296,8 @@ function install(opts) {
289
296
  // 检查 config.ini 是否有预托管模型(audio8_model_dir)
290
297
  let modelDir = '';
291
298
  try {
292
- const cfg = require(path.join(__dirname, '..', 'src', 'config'));
299
+ // 从主包内置 src/config 读取(避免 tts/src/config 这种错误路径)
300
+ const cfg = require(path.join(__dirname, '..', '..', 'src', 'config'));
293
301
  const wd = opts.workdir || process.env.ADOREMIX_WORKDIR || path.join(os.homedir(), '.local', 'share', 'adoremix');
294
302
  modelDir = cfg.getConfigValue(wd, 'TTS.audio8_model_dir') || '';
295
303
  } catch (e) {}
@@ -304,30 +312,45 @@ function install(opts) {
304
312
  }
305
313
  }
306
314
 
307
- // 拉 Audio8_TTS 源码:先试 git clone(多个镜像),全失败再走 codeload tarball(最后备选)
308
- const MIRRORS = [
309
- AUDIO8_REPO, // 官方 https
310
- 'https://ghproxy.cn/https://github.com/Audio8-AI/Audio8_TTS.git', // 国内代理
311
- 'https://hub.fastgit.xyz/Audio8-AI/Audio8_TTS.git' // fastgit 镜像
312
- ];
315
+ // 拉 Audio8_TTS 源码:先试内置 tarball(主包 audio8-assets/audio8-tts.tgz,离线),再 git 镜像,最后 codeload
313
316
  let cloned = false;
314
- for (let attempt = 1; attempt <= 2; attempt++) {
315
- for (const url of MIRRORS) {
316
- try {
317
- logger.log(`=== 克隆 Audio8_TTS(第 ${attempt} 次尝试): ${url} ===`);
318
- execSync(`rm -rf ~/audio8_temp && git clone --depth=1 "${url}" ~/audio8_temp 2>&1 | tail -3`, { stdio: 'inherit', shell: '/bin/bash' });
319
- execSync(`bash -c "cd ~/audio8_temp && (shopt -s dotglob; mv -- * ~/audio8/ 2>/dev/null || true)"`, { stdio: 'inherit', shell: '/bin/bash' });
320
- execSync('rm -rf ~/audio8_temp', { stdio: 'ignore', shell: '/bin/bash' });
321
- cloned = true;
322
- break;
323
- } catch (e) {
324
- logger.warn(`克隆失败(${url.slice(0, 60)}...): ${String(e.message).slice(0, 100)}`);
317
+ // 1) 主包内置 tarball(最稳,完全离线)
318
+ const BUNDLED_TARBALL = path.join(__dirname, '..', '..', 'audio8-assets', 'audio8-tts.tgz');
319
+ if (fs.existsSync(BUNDLED_TARBALL)) {
320
+ try {
321
+ logger.log('=== 使用主包内置 Audio8_TTS tarball(离线) ===');
322
+ execSync(`rm -rf ~/audio8 && mkdir -p ~/audio8 && tar xzf "${BUNDLED_TARBALL}" --strip-components=1 -C ~/audio8 && ls ~/audio8 | head -3`, { stdio: 'inherit', shell: '/bin/bash' });
323
+ cloned = true;
324
+ } catch (e) {
325
+ logger.warn('内置 tarball 解压失败:' + e.message);
326
+ }
327
+ } else {
328
+ logger.warn(`主包内置 tarball 不存在:${BUNDLED_TARBALL}`);
329
+ }
330
+ // 2) Git 镜像(fallback)
331
+ if (!cloned) {
332
+ const MIRRORS = [
333
+ AUDIO8_REPO,
334
+ 'https://ghproxy.cn/https://github.com/Audio8-AI/Audio8_TTS.git',
335
+ 'https://hub.fastgit.xyz/Audio8-AI/Audio8_TTS.git'
336
+ ];
337
+ for (let attempt = 1; attempt <= 2 && !cloned; attempt++) {
338
+ for (const url of MIRRORS) {
339
+ try {
340
+ logger.log(`=== 克隆 Audio8_TTS(第 ${attempt} 次): ${url} ===`);
341
+ execSync(`rm -rf ~/audio8_temp && git clone --depth=1 "${url}" ~/audio8_temp 2>&1 | tail -3`, { stdio: 'inherit', shell: '/bin/bash' });
342
+ execSync(`bash -c "cd ~/audio8_temp && (shopt -s dotglob; mv -- * ~/audio8/ 2>/dev/null || true)"`, { stdio: 'inherit', shell: '/bin/bash' });
343
+ execSync('rm -rf ~/audio8_temp', { stdio: 'ignore', shell: '/bin/bash' });
344
+ cloned = true;
345
+ break;
346
+ } catch (e) {
347
+ logger.warn(`克隆失败:${String(e.message).slice(0, 100)}`);
348
+ }
325
349
  }
350
+ if (!cloned) execSync('sleep 5', { stdio: 'ignore', shell: '/bin/bash' });
326
351
  }
327
- if (cloned) break;
328
- execSync('sleep 5', { stdio: 'ignore', shell: '/bin/bash' });
329
352
  }
330
- // 备选:codeload 直接下 master 分支 tarball(绕过 git,HTTP 而已,国内更稳定)
353
+ // 3) codeload tarball(最后备选)
331
354
  if (!cloned) {
332
355
  try {
333
356
  logger.log('=== 备选:codeload github tarball ===');
@@ -338,8 +361,8 @@ function install(opts) {
338
361
  }
339
362
  }
340
363
  if (!cloned) {
341
- logger.error('所有镜像和重试都失败,无法克隆 Audio8_TTS 仓库');
342
- logger.warn('解决:手动在 ~/audio8 下放好 Audio8_TTS 源码再重试 install(跳过 git clone 步骤)');
364
+ logger.error('所有源都失败,无法获取 Audio8_TTS 源码');
365
+ logger.warn('解决:手动在 ~/audio8 下放好 Audio8_TTS 源码再重试 install');
343
366
  return 1;
344
367
  }
345
368