-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Audio tool split and merge text by clip
- Loading branch information
1 parent
3b22374
commit fb5d559
Showing
4 changed files
with
73 additions
and
27 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
packages/lb-components/src/components/audioAnnotate/utils/dataTransform.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* @file Process audio tool data | ||
* @author lixinghua <lixinghua_vendor@sensetime.com> | ||
* @date 2024.05.14 | ||
*/ | ||
|
||
import { IAudioTimeSlice, ITextConfigItem } from '@labelbee/lb-utils'; | ||
import _ from 'lodash'; | ||
|
||
export default class DataTransform { | ||
// clip tool get text by config | ||
public static getClipTextByConfig = ( | ||
region: IAudioTimeSlice, | ||
clipTextList: ITextConfigItem[], | ||
isClear = false, | ||
) => { | ||
const newRegion = _.cloneDeep(region); | ||
clipTextList.forEach((i, index) => { | ||
// index === 0: Compatible with old data | ||
if (index === 0) { | ||
Object.assign(newRegion, { text: isClear ? '' : region[i.key] }); | ||
} else { | ||
Object.assign(newRegion, { [i.key]: isClear ? '' : region[i.key] }); | ||
} | ||
}); | ||
return newRegion; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters