Skip to content

TagSpaces is an offline, open source, document manager with tagging support

audio recorder - update 0.1.2

kristiyandd713c8da8ffcd
diff --git a/data/js/audiorecorder.ui.js b/data/js/audiorecorder.ui.js
index c1b43ad98..277d70cb1 100644
--- a/data/js/audiorecorder.ui.js
+++ b/data/js/audiorecorder.ui.js
@@ -7,19 +7,20 @@ define(function(require, exports, module) {
'use strict';
console.log('Loading audiorecorder.ui.js ...');
var TSCORE = require('tscore');
-
+ require("webaudiorecording");
var fileContent;
var fileType;
var initUI = function() {
$('#audioRecordingConfirmButton').click(function() {
- saveAudioVideoFile();
+ saveRecording();
});
};
- function saveAudioVideoFile(event, blob) {
+ function saveAudioVideoFile(blob) {
+ console.debug(blob);
var fileTags = '';
var rawTags = $('#newFileNameTagsAudioRecorder').val().split(',');
rawTags.forEach(function(value, index) {
@@ -39,8 +40,9 @@ define(function(require, exports, module) {
if (fileTags.length > 0) {
fileTags = TSCORE.TagUtils.beginTagContainer + fileTags + TSCORE.TagUtils.endTagContainer;
}
+
var filePath = TSCORE.currentPath + TSCORE.dirSeparator + $('#newFileNameAudioRecorder').val() + fileTags + '.' + fileType;
- TSCORE.IO.saveBinaryFilePromise(filePath, content, false).then(function() {
+ TSCORE.IO.saveBinaryFilePromise(filePath, blob).then(function() {
TSCORE.showSuccessDialog("File saved successfully.");
}, function(error) {
@@ -296,7 +298,7 @@ define(function(require, exports, module) {
$('#audioRecordingUrl').attr('src', url);
$('#deleteAudioRecording').prop('recording', url);
- fileContent = TSCORE.Config.getNewTextFileContent();
+ //fileContent = TSCORE.Config.getNewTextFileContent();
// Default new file in text file
fileType = 'wav' || 'ogg';
$('#newFileNameTagsAudioRecorder').select2('data', null);
@@ -326,12 +328,35 @@ define(function(require, exports, module) {
$('#audioRecordingDialog').on('shown.bs.modal', function() {
$('#newFileNameAudioRecorder').select2().focus();
});
- $('#audioRecordingDialog').modal({
- backdrop: 'static',
- show: true
+ console.debug(blob);
+ var fileTags = '';
+ var rawTags = $('#newFileNameTagsAudioRecorder').val().split(',');
+ rawTags.forEach(function(value, index) {
+ if (index === 0) {
+ fileTags = value;
+ } else {
+ fileTags = fileTags + TSCORE.Config.getTagDelimiter() + value;
+ }
});
- $('#audioRecordingDialog').draggable({
- handle: ".modal-header"
+ //if ($('#tagWithCurrentDate').prop('checked')) {
+ // if (fileTags.length < 1) {
+ // fileTags = TSCORE.TagUtils.formatDateTime4Tag(new Date());
+ // } else {
+ // fileTags = fileTags + TSCORE.Config.getTagDelimiter() + TSCORE.TagUtils.formatDateTime4Tag(new Date());
+ // }
+ //}
+ if (fileTags.length > 0) {
+ fileTags = TSCORE.TagUtils.beginTagContainer + fileTags + TSCORE.TagUtils.endTagContainer;
+ }
+
+ var filePath = TSCORE.currentPath + TSCORE.dirSeparator + $('#newFileNameAudioRecorder').val() + fileTags + '.' + fileType;
+ TSCORE.IO.saveBinaryFilePromise(filePath, blob).then(function() {
+ TSCORE.showSuccessDialog("File saved successfully.");
+
+ }, function(error) {
+ TSCORE.hideLoadingAnimation();
+ TSCORE.showAlertDialog("Saving " + filePath + " failed.");
+ console.error("Save to file " + filePath + " failed " + error);
});
}
diff --git a/data/js/core.ui.js b/data/js/core.ui.js
index 9e35c5e15..ccdf06678 100644
--- a/data/js/core.ui.js
+++ b/data/js/core.ui.js
@@ -861,7 +861,7 @@ define(function(require, exports, module) {
}
function showAudioRecordingDialog() {
- require("audiorecorder");
+ require("webaudiorecording");
$('#audioRecordingDialog').modal({
backdrop: 'static',
show: true
diff --git a/data/libs/audio-record/AudioRecorder.js b/data/libs/audio-record/AudioRecorder.js
deleted file mode 100644
index f9cad67d1..000000000
--- a/data/libs/audio-record/AudioRecorder.js
+++ /dev/null
@@ -1,3 +0,0 @@
-define(function(require, exports, module) {
- require("webaudiorecording");
-});
\ No newline at end of file
diff --git a/data/loader.js b/data/loader.js
index ba715cdc4..0364a9b70 100644
--- a/data/loader.js
+++ b/data/loader.js
@@ -107,7 +107,6 @@ var isWin = navigator.appVersion.indexOf("Win")!==-1;
noty: 'libs/noty/js/noty/packaged/jquery.noty.packaged.min',
marked: 'libs/marked/marked.min',
webaudiorecording: 'libs/audio-record/WebAudioRecorder',
- audiorecorder: 'libs/audio-record/AudioRecorder',
tscore: 'js/core.api',
tssetting: 'js/settings.api',