Now user can't send file with length of 4 sec or less
This commit is contained in:
parent
29c4e5f6f7
commit
f7a1a489fe
@ -70,15 +70,23 @@ public class MainController implements Initializable {
|
||||
clipView.initPlayButtons(btnBackward, btnPlay, btnForward);
|
||||
clipView.setIconPlay(iconPlay);
|
||||
btnSend.setOnAction(event -> {
|
||||
btnSend.setDisable(true);
|
||||
final ClipPartData data = new ClipPartData();
|
||||
data.metadata = clipView.getMetadata();
|
||||
data.startTime = clipView.getClipPartStart();
|
||||
data.endTime = clipView.getClipPartEnd();
|
||||
CompletableFuture.completedFuture(data)
|
||||
.thenApplyAsync(new OpusConvertTask())
|
||||
.thenApplyAsync(new SendTelegramVoiceTask())
|
||||
.handleAsync(this::handleVoiceSend);
|
||||
if(data.endTime - data.startTime > 5.0) {
|
||||
btnSend.setDisable(true);
|
||||
CompletableFuture.completedFuture(data)
|
||||
.thenApplyAsync(new OpusConvertTask())
|
||||
.thenApplyAsync(new SendTelegramVoiceTask())
|
||||
.handleAsync(this::handleVoiceSend);
|
||||
} else {
|
||||
Alert alert = new Alert(Alert.AlertType.ERROR);
|
||||
alert.setTitle(Main.getResources().getString("error"));
|
||||
alert.setHeaderText(null);
|
||||
alert.setContentText(Main.getResources().getString("zero_file_length"));
|
||||
alert.showAndWait();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -17,3 +17,4 @@ unable_access_ffmpeg=Unable to access FFmpeg. Please install it or add to PATH e
|
||||
unable_fetch_metadata=Unable to fetch metadata
|
||||
unable_send_message=Unable to send message
|
||||
unable_build_waveform=Unable to build waveform
|
||||
zero_file_length=Selected audio is too short!
|
@ -17,3 +17,4 @@ unable_access_ffmpeg=\u041d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u04
|
||||
unable_fetch_metadata=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435
|
||||
unable_send_message=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435
|
||||
unable_build_waveform=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043e\u0441\u0446\u0438\u043b\u043e\u0433\u0440\u0430\u043c\u043c\u0443
|
||||
zero_file_length=\u0421\u043b\u0438\u0448\u043a\u043e\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u0432\u043e\u0439\u0441!
|
Loading…
Reference in New Issue
Block a user