Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tts): configure tts via settings dialog #154

Merged
merged 31 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e4a58fc
feat(tts): wip: interface for tts configuration
marisademeglio Sep 4, 2023
fd4593f
chore: gh build troubleshooting
marisademeglio Sep 7, 2023
b2e4c31
chore: gh build troubleshooting
marisademeglio Sep 7, 2023
0247087
chore: gh build troubleshooting
marisademeglio Sep 7, 2023
468a456
chore: update test.yml
marisademeglio Sep 8, 2023
a994600
chore: update test.yml
marisademeglio Sep 8, 2023
e64b15c
chore: update package.json
marisademeglio Sep 8, 2023
b849444
Merge branch 'tts-config' of https://github.com/daisy/pipeline-ui int…
marisademeglio Sep 8, 2023
dd47322
chore: update test.yml
marisademeglio Sep 8, 2023
3fc1794
chore: update test.yml
marisademeglio Sep 8, 2023
aeedc07
feat(tts): persist tts config in settings
marisademeglio Sep 10, 2023
219c5e1
feat(tts): serialize tts preferences as xml
marisademeglio Sep 10, 2023
68ab3ba
feat(tts): offer the user a choice of using the tts preferences or th…
marisademeglio Sep 10, 2023
b11c9c2
Merge branch 'tts-config' of https://github.com/daisy/pipeline-ui int…
marisademeglio Sep 10, 2023
1f942a0
feat(tts): style of form controls for tts
marisademeglio Sep 10, 2023
24c8ab0
feat(tts): store the file at the filepath from settings
marisademeglio Sep 10, 2023
0f03d03
chore: gh build action troubleshooting
marisademeglio Sep 15, 2023
686b1b9
chore: gh build troubleshooting
marisademeglio Sep 16, 2023
a0280c5
chore: gh build troubleshooting
marisademeglio Sep 18, 2023
893a579
fix: gh actions workflow file typo
marisademeglio Sep 18, 2023
4430c6d
chore: gh build
marisademeglio Sep 18, 2023
3dc35d9
Merge branch 'main' into tts-config
marisademeglio Sep 22, 2023
95589b1
feat(tts): use new voices API and adjust dialog
marisademeglio Sep 23, 2023
13dd2b4
chore: version bump
marisademeglio Sep 23, 2023
c37b27d
chore: build and skip notarization
marisademeglio Sep 23, 2023
0e757b3
Revert "chore: version bump"
marisademeglio Sep 25, 2023
12342ac
chore: version bump
marisademeglio Sep 25, 2023
2befaa6
fix: typo
marisademeglio Sep 25, 2023
8deab3e
fix: style
marisademeglio Sep 25, 2023
3b4825d
feat(tts): preferred voices are sorted first in tts settings dialog
marisademeglio Sep 25, 2023
8fb662e
Update engine (enable snapshots repo)
bertfrees Sep 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 148 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# this is pre-set to run on a specific revision, for troubleshooting purposes
name: Test copy of Build macOS/Windows distributions

on:
workflow_dispatch:
inputs:
refToBuild:
description: 'Branch, tag or commit SHA1 to build'
required: true
type: string
push:
tags:
- '*'

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [macos-latest, windows-latest]

steps:
- name: Check out Git repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.refToBuild }}

- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 16

- name: Install Java and Maven
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'

- name: Check out submodule
run: git submodule update --init --recursive

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache downloaded Maven dependencies
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Cache downloaded JRE
uses: actions/cache@v3
with:
path: engine/src/main/jre
# always update cache using this trick:
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
key: ${{ runner.os }}-jre-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-jre-
- name: Install GNU Make on macOS
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew update
brew install make
- name: Build DMG if on macOS
if: ${{ matrix.os == 'macos-latest' }}
run: gmake dmg

- name: Build EXE if on Windows
if: ${{ matrix.os == 'windows-latest' }}
shell: cmd
run: engine\\make.exe exe

- name: Upload the DMG
if: ${{ matrix.os == 'macos-latest' }}
uses: actions/upload-artifact@v3
with:
name: "daisy-pipeline.dmg"
path: dist/*.dmg

- name: Upload the EXE
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/upload-artifact@v3
with:
name: "daisy-pipeline.exe"
path: dist/*.exe

# # This is a basic workflow that is manually triggered

# name: Test build workflow

# on:
# workflow_dispatch:

# env:
# GH_TOKEN: ${{ secrets.GH_PIPELINE_TOKEN }}

# # A workflow run is made up of one or more jobs that can run sequentially or in parallel
# jobs:
# build:
# runs-on: ${{ matrix.os }}

# strategy:
# matrix:
# os: [macos-latest]

# steps:
# - name: Check out Git repository
# uses: actions/checkout@v1

# - name: Install Node.js, NPM and Yarn
# uses: actions/setup-node@v1
# with:
# node-version: 16

# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: echo "::set-output name=dir::$(yarn cache dir)"
# - name: Cache yarn
# uses: actions/cache@v3
# with:
# path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-yarn-

# - name: Run install
# uses: borales/actions-yarn@v4
# with:
# cmd: install # will run `yarn install` command

# - name: Run build
# uses: borales/actions-yarn@v4
# with:
# cmd: dist-mac-dev
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ENGINE_VERSION := $(shell println(xpath(new File("engine/pom.xml"), "/*/*[local-
.PHONY : dmg
dmg : src/resources/daisy-pipeline src/resources/icons/[email protected]
exec("yarn");
exec("yarn", "dist", "--mac");
exec("yarn", "dist-mac-dev", "--mac");

.PHONY : exe
exe : src/resources/daisy-pipeline
Expand Down Expand Up @@ -48,3 +48,5 @@ clean :
rm("src/resources/daisy-pipeline");
rm("node_modules/.dev-temp-build");
exec("$(MAKE)", "-C", "engine", "clean");


4 changes: 4 additions & 0 deletions buildtools/notarize.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ exports.default = async function notarizing(context) {
)
return
}
if (process.env.SKIP_NOTARIZATION) {
console.log('skipped notarizing: SKIP_NOTARIZATION=true')
return
}

const appName = context.packager.appInfo.productFilename

Expand Down
2 changes: 1 addition & 1 deletion engine
Submodule engine updated 1 files
+1 −1 .mvn/settings.xml
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"displayName": "DAISY Pipeline (2023)",
"name": "pipeline-ui",
"description": "User interface for the DAISY Pipeline",
"version": "1.1.0",
"version": "1.2.0-BETA",
"main": "./node_modules/.dev-temp-build/main.js",
"devTempBuildFolder": "./node_modules/.dev-temp-build",
"devServer": "http://localhost:4927",
Expand Down Expand Up @@ -46,7 +46,7 @@
"pipeline:refresh": "node ./bin/modules/prebuild/pipeline.js --refresh",
"nodemon:start": "nodemon --watch src/main --watch src/renderer/bridge --watch src/shared --ignore src/resources --ext \"*\" --exec yarn dev:main",
"predist": "yarn build",
"dist": "./node_modules/.bin/electron-builder",
"dist": "./node_modules/.bin/electron-builder --publish never",
"release": "electron-builder --publish always",
"clean": "rimraf dist",
"prepare": "husky install",
Expand Down
6 changes: 6 additions & 0 deletions src/main/data/apis/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
jobXmlToJson,
scriptsXmlToJson,
scriptXmlToJson,
voicesToJson,
} from 'shared/parser/pipelineXmlConverter'
import {
Datatype,
Expand Down Expand Up @@ -122,4 +123,9 @@ export const pipelineAPI = {
(ws) => `${baseurl(ws)}/alive`,
(text) => aliveXmlToJson(text)
),
fetchVoices: () =>
createPipelineFetchFunction(
(ws) => `${baseurl(ws)}/voices`,
(text) => voicesToJson(text)
),
}
7 changes: 7 additions & 0 deletions src/main/data/middlewares/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
removeJobs,
selectVisibleJobs,
setAlive,
setVoices,
} from 'shared/data/slices/pipeline'

import {
Expand All @@ -31,6 +32,7 @@ import {
PipelineStatus,
ResultFile,
Script,
Voice,
Webservice,
} from 'shared/types'

Expand Down Expand Up @@ -309,6 +311,11 @@ export function pipelineMiddleware({ getState, dispatch }) {
})
.then((datatypes) => {
dispatch(setDatatypes(datatypes))
return pipelineAPI.fetchVoices()(newWebservice)
})
.then((voices: Array<Voice>) => {
console.log('Voices', voices)
dispatch(setVoices(voices))
})
.catch((e) => {
error('useWebservice', e)
Expand Down
14 changes: 14 additions & 0 deletions src/main/data/middlewares/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { existsSync, readFileSync, writeFile } from 'fs'
import { resolve } from 'path'
import { ENVIRONMENT } from 'shared/constants'
import { save } from 'shared/data/slices/settings'
import { ttsConfigToXml } from 'shared/parser/pipelineXmlConverter/ttsConfigToXml'
import { ApplicationSettings } from 'shared/types'
import { RootState } from 'shared/types/store'
import { resolveUnpacked } from 'shared/utils'
Expand Down Expand Up @@ -45,6 +46,10 @@ export function readSettings() {
colorScheme: 'system',
appStateOnClosingMainWindow: undefined,
jobsStateOnClosingMainWindow: 'close',
ttsConfig: {
preferredVoices: [],
xmlFilepath: resolve(app.getPath('userData'), 'ttsConfig.xml'),
},
} as ApplicationSettings
try {
if (existsSync(settingsFile)) {
Expand All @@ -60,6 +65,10 @@ export function readSettings() {
...loaded?.localPipelineProps?.webservice,
},
},
ttsConfig: {
...settings.ttsConfig,
...loaded?.ttsConfig,
},
}
}
} catch (e) {
Expand Down Expand Up @@ -93,6 +102,11 @@ export function settingsMiddleware({ getState }) {
JSON.stringify(settings, null, 4),
() => {}
)
writeFile(
settings.ttsConfig.xmlFilepath,
ttsConfigToXml(settings.ttsConfig),
() => {}
)
break
default:
break
Expand Down
7 changes: 5 additions & 2 deletions src/renderer/components/Fields/FileOrFolderInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function FileOrFolderInput({
initialValue = '',
makeSlotForErrors = true,
labelledBy = '',
enabled = true,
}: {
dialogProperties: string[] // electron dialog properties for open or save, depending on which one you're doing (see 'type')
elemId: string // ID for the control widget
Expand All @@ -33,6 +34,7 @@ export function FileOrFolderInput({
required?: boolean
makeSlotForErrors?: boolean // create a span for error messages; if false, it is assumed that this will appear elsewhere
labelledBy?: string // id of the label for this element, if present use aria-labelledby, if absent, assume the label will have an htmlFor on it
enabled?: boolean // should the control be given the 'grayedout' classname
}) {
// the value is stored internally as it can be set 2 ways
// and also broadcast via onChange so that a parent component can subscribe
Expand Down Expand Up @@ -111,14 +113,15 @@ export function FileOrFolderInput({
tabIndex={0}
className={`filename ${
userInteracted ? 'interacted' : ''
}`}
} ${enabled ? '' : 'grayedout'}`}
value={value ?? ''}
onChange={(e) => onTextInput(e)}
id={elemId}
required={required}
aria-labelledby={labelledBy ?? ''}
disabled={!enabled}
></input>
<button type="button" onClick={(e) => onClick(e, name)}>
<button type="button" onClick={(e) => onClick(e, name)} disabled={!enabled} className={enabled ? '' : 'grayedout'}>
{buttonLabel}
</button>
</div>
Expand Down
Loading