From: Cedric Godin Date: Wed, 31 Jan 2018 13:36:03 +0000 (-0500) Subject: Added display of "in progress" recordings. (fuzzy) X-Git-Url: http://kyz.pub/gitweb/?a=commitdiff_plain;h=7fb7210467f139f744eb669af0271de282594b85;p=yn%2Fyn-odasweb.git Added display of "in progress" recordings. (fuzzy) --- diff --git a/recordings.js b/recordings.js index fe18067..7b6fb3d 100644 --- a/recordings.js +++ b/recordings.js @@ -111,6 +111,7 @@ class AudioRecorder { let filename = path.join(workspacePath, `ODAS_${id}_${new Date().toLocaleString()}.wav`) this.writer = new wav.FileWriter(filename,{channels:1, sampleRate:sampleRate, bitDepth:bitNumber}) + odasStudio.recordingsWindow.webContents.send('fuzzy-recording', filename) } } diff --git a/ressources/js/recordings_model.js b/ressources/js/recordings_model.js index 23ce491..5421f41 100644 --- a/ressources/js/recordings_model.js +++ b/ressources/js/recordings_model.js @@ -5,6 +5,16 @@ const fs = require('fs') const info = require('wav-file-info') const dialog = require('electron').remote.dialog +// Fuzzy recording class +class FuzzyRecording { + constructor(fullPath) { + + this.filename = path.basename(fullPath) + this.path = fullPath + this.timestamp = new Date() + } +} + // Single recording class class Recording { @@ -85,6 +95,7 @@ const RecordingsModel = new Vue({ el: '#recordings-table', data: { recordings: [], + fuzzyRecordings: [], workspacePath: localStorage.workspacePath, recordingEnabled: false }, @@ -158,6 +169,14 @@ const recordControl = function() { ipcRenderer.on('add-recording', (event, filename) => { RecordingsModel.recordings.unshift(new Recording(filename)) + RecordingsModel.fuzzyRecordings = RecordingsModel.fuzzyRecordings.filter((recording) => { + return recording.path !== filename + }) +}) + +ipcRenderer.on('fuzzy-recording', (event, filename) => { + + RecordingsModel.fuzzyRecordings.unshift(new FuzzyRecording(filename)) }) // Close window and stop recording diff --git a/views/recordings.html b/views/recordings.html index 7b25868..d65ff71 100644 --- a/views/recordings.html +++ b/views/recordings.html @@ -59,6 +59,13 @@ + + + {{recording.timestamp.toLocaleString()}} + + {{recording.filename}} + +