Skip to content

Commit

Permalink
Fall back to source audio inside project directory when applicable (#…
Browse files Browse the repository at this point in the history
…1186)

* picks up source audio in project dir if applicable

* add note
  • Loading branch information
AnonymousWalker authored Sep 11, 2024
1 parent 4f26336 commit ac597d3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,13 @@ class ChunkingViewModel : ViewModel(), IMarkerViewModel {
private fun initializeSourceAudio(chapter: Int): Maybe<SourceAudio> {
return Maybe.fromCallable {
val workbook = workbookDataStore.workbook
ChunkAudioUseCase(directoryProvider, workbook.projectFilesAccessor)
.copySourceAudioToProject(sourceAudio.file)
workbook.sourceAudioAccessor.getUserMarkedChapter(chapter, workbook.target) // this first call is intentional. See https://github.com/Bible-Translation-Tools/Orature/pull/1186
?: let {
ChunkAudioUseCase(directoryProvider, workbook.projectFilesAccessor)
.copySourceAudioToProject(sourceAudio.file)

workbook.sourceAudioAccessor.getUserMarkedChapter(chapter, workbook.target)
workbook.sourceAudioAccessor.getUserMarkedChapter(chapter, workbook.target)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class ConsumeViewModel : ViewModel(), IMarkerViewModel {
Maybe
.fromCallable<SourceAudio> {
wb.sourceAudioAccessor.getChapter(chapter.sort, wb.target)
?: wb.sourceAudioAccessor.getUserMarkedChapter(chapter.sort, wb.target)
}
.subscribeOn(Schedulers.io())
.observeOnFx()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ class TranslationViewModel2 : ViewModel() {
Maybe
.fromCallable {
wb.sourceAudioAccessor.getChapter(chapter.sort, wb.target)
?: wb.sourceAudioAccessor.getUserMarkedChapter(chapter.sort, wb.target)
}
.subscribeOn(Schedulers.io())
.observeOnFx()
Expand Down

0 comments on commit ac597d3

Please sign in to comment.