Skip to content

Commit

Permalink
Merge branch 'fetch-caching' of https://github.com/daisy/pipeline-ui
Browse files Browse the repository at this point in the history
…into fetch-caching
  • Loading branch information
marisademeglio committed Nov 8, 2024
2 parents 6c34e68 + 44914f9 commit 2e98dd5
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 22 deletions.
2 changes: 1 addition & 1 deletion engine
Submodule engine updated 1 files
+56 −26 Makefile
37 changes: 19 additions & 18 deletions src/main/data/middlewares/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,21 +443,21 @@ export function pipelineMiddleware({ getState, dispatch }) {
// dispatch to sync the properties
// in the engine
dispatch(setProperties(settingsTtsProperties))
return pipelineAPI.fetchTtsVoices(
selectTtsConfig(getState())
)(newWebservice)
})
.then((voices: Array<TtsVoice>) => {
// console.log('TTS Voices', voices)
dispatch(setTtsVoices(voices))
return pipelineAPI.fetchTtsEnginesState()(
newWebservice
)
})
.then((states) => {
console.log('tts states', states)
dispatch(setTtsEngineState(states))
// return pipelineAPI.fetchTtsVoices(
// selectTtsConfig(getState())
// )(newWebservice)
})
// .then((voices: Array<TtsVoice>) => {
// // console.log('TTS Voices', voices)
// dispatch(setTtsVoices(voices))
// return pipelineAPI.fetchTtsEnginesState()(
// newWebservice
// )
// })
// .then((states) => {
// //console.log('tts states', states)
// dispatch(setTtsEngineState(states))
// })
.catch((e) => {
error('useWebservice', e, e.parsedText)
if (e instanceof AbortError) {
Expand Down Expand Up @@ -667,9 +667,10 @@ export function pipelineMiddleware({ getState, dispatch }) {
)
//.then(() => pipelineAPI.fetchProperties()(webservice))
.then(() => {
// If any of the properties updated is a TTS engine key
// property, reload voice list
if (
// If voices list is not yet initialised
// or any of the properties updated is a TTS engine key
// property, reload voices list when properties are set
if (getState().pipeline.ttsVoices == null ||
newProperties.find(
(p) =>
p.name.indexOf('.tts.') >= 0 &&
Expand Down Expand Up @@ -749,7 +750,7 @@ export function pipelineMiddleware({ getState, dispatch }) {
)
})
.then((states) => {
console.log('tts states', states)
//console.log('tts states', states)
dispatch(setTtsEngineState(states))
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/TtsVoicesConfig/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ export function TtsVoicesConfigPane({
{
pipeline.ttsEnginesStates[
v.engine
].name
]?.name ?? v.engine
}
</td>
<td>{languageNames.of(v.lang)}</td>
Expand Down
13 changes: 13 additions & 0 deletions src/renderer/components/TtsVoicesConfig/voiceTransliterations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,17 @@ export const voicesTransliterations = {
曉臻: '曉臻 (Xiaozhen)',
雲哲: '雲哲 (Yunzhe)',
曉雨: '曉雨 (Xiaoy)',
"ᓯᕿᓂᖅ": "ᓯᕿᓂᖅ (Siqinic)",
"ᑕᖅᑭᖅ": "ᑕᖅᑭᖅ (Taqkic)",
"যাশিকা": "যাশিকা (Yashika)",
"প্ৰিয়ম": "প্ৰিয়ম (Priyom)",
"आरव ": "आरव (Arav)",
"अनन्या": "अनन्या (Ananya)",
"काव्या": "काव्या (Kavya)",
"कुनाल ": "कुनाल (Kunal)",
"रेहान": "रेहान (Rehan)",
"ସୁଭାସିନୀ": "ସୁଭାସିନୀ (Subhasini)",
"ସୁକାନ୍ତ": "ସୁକାନ୍ତ (Sukant)",
"ਓਜਸ": "ਓਜਸ (Ojas)",
"ਵਾਨੀ": "ਵਾਨੀ (Vani)",
}
4 changes: 2 additions & 2 deletions src/shared/data/slices/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const initialState = {
webservice: null,
scripts: [],
datatypes: [],
ttsVoices: [],
ttsVoices: null,
jobs: [],
internalJobCounter: 0,
selectedJobId: '',
Expand Down Expand Up @@ -416,7 +416,7 @@ export const selectors = {
),
selectScripts: (state: RootState) => state.pipeline.scripts,
selectDatatypes: (state: RootState) => state.pipeline.datatypes,
selectTtsVoices: (state: RootState) => state.pipeline.ttsVoices,
selectTtsVoices: (state: RootState) => state.pipeline.ttsVoices ?? [],
selectProperties: (state: RootState) => state.pipeline.properties,
newJob: (pipeline: PipelineState) =>
({
Expand Down

0 comments on commit 2e98dd5

Please sign in to comment.