|
|
|
@ -188,8 +188,10 @@ class MeetingHomeController extends GetxController { |
|
|
|
Directory("${appDir.path}/DestAudio/"), |
|
|
|
]; |
|
|
|
|
|
|
|
// 目标目录:LocalAudio |
|
|
|
final destDir = Directory("${appDir.path}/LocalAudio/"); |
|
|
|
if (!await destDir.exists()) { |
|
|
|
// 检查目标目录是否存在 |
|
|
|
await destDir.create(recursive: true); |
|
|
|
} |
|
|
|
|
|
|
|
@ -335,9 +337,14 @@ class MeetingHomeController extends GetxController { |
|
|
|
EasyLoading.show(status: 'importing'.tr); // 对应中文:正在导入... |
|
|
|
String fileName = ""; |
|
|
|
bool isParamProvided = filePath != null; // 更清晰的变量名 |
|
|
|
String audioType = 'IMPORT'; // 默认类型为IMPORT |
|
|
|
if (filePath != null) { |
|
|
|
// 正确截取文件名(跨平台安全方式) |
|
|
|
fileName = path.basename(filePath); |
|
|
|
// 检查是否来自翻译模块 |
|
|
|
if (filePath.contains('/TranslatAudio/')) { |
|
|
|
audioType = 'TRANSLAT'; // 设置为翻译音频类型 |
|
|
|
} |
|
|
|
} else { |
|
|
|
FilePickerResult? result = await FilePicker.platform.pickFiles( |
|
|
|
withData: false, |
|
|
|
@ -368,7 +375,8 @@ class MeetingHomeController extends GetxController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
final meetingId = await insertMeetingAudio(fileName, filePath); |
|
|
|
final meetingId = |
|
|
|
await insertMeetingAudio(fileName, filePath, type: audioType); |
|
|
|
|
|
|
|
if (isParamProvided) { |
|
|
|
Get.toNamed(Routes.meetingDetails, arguments: { |
|
|
|
@ -382,13 +390,14 @@ class MeetingHomeController extends GetxController { |
|
|
|
String fileName, |
|
|
|
String filePath, { |
|
|
|
bool isUpload = true, |
|
|
|
String type = 'IMPORT', //添加type参数,默认为'IMPORT' |
|
|
|
}) async { |
|
|
|
await _audioPlayer.setAudioSource(AudioSource.file(filePath)); |
|
|
|
int seconds = _audioPlayer.duration?.inSeconds ?? 0; |
|
|
|
int creationTime = DateTime.now().millisecondsSinceEpoch; |
|
|
|
Map<String, Object?> data = { |
|
|
|
'title': fileName, |
|
|
|
'type': 'IMPORT', |
|
|
|
'type': type, // 使用传入的type参数 |
|
|
|
'seconds': seconds, |
|
|
|
'filepath': filePath, |
|
|
|
'audiourl': '', |
|
|
|
|