Added display of "in progress" recordings. (fuzzy)
authorCedric Godin <cedric.godin@usherbrooke.ca>
Wed, 31 Jan 2018 13:36:03 +0000 (08:36 -0500)
committerCedric Godin <cedric.godin@usherbrooke.ca>
Wed, 31 Jan 2018 13:36:03 +0000 (08:36 -0500)
recordings.js
ressources/js/recordings_model.js
views/recordings.html

index fe18067a53c5d72111bda9a7e819b372b9f24511..7b6fb3d3897e1f779344f4b20ba561f5a74737d2 100644 (file)
@@ -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)
     }
   }
 
index 23ce491b7926ddb9e1d64fa987847822858ad02e..5421f41919cf811516cf625f9d1682f747e3a141 100644 (file)
@@ -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
index 7b25868aa3468a4c7c6078b1f9f1e4ebaa889d88..d65ff7145c484f604e5afda67a35a8689c9a20d4 100644 (file)
                     </tr>
                   </thead>
                   <tbody>
+                    <tr v-for = "recording in fuzzyRecordings">
+                      <td><span class="glyphicon glyphicon-record text-danger"></span></td>
+                      <td>{{recording.timestamp.toLocaleString()}}</td>
+                      <td></td>
+                      <td>{{recording.filename}}</td>
+                      <td></td>
+                    </tr>
                     <tr v-for = "recording in recordings" v-on:mouseleave = "recording.deleting = 'hidden'">
                       <td>
                         <span v-if="!recording.isPlaying" class="control glyphicon glyphicon-play" v-on:click = "recording.play()"></span>