1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
import uuidv1 from 'uuid/v1'
import socket from '../../socket'
import types from '../../types'
import * as datasetLoader from '../../dataset/dataset.loader'
import actions from '../../actions'
import util from '../../util'
import pix2wavModule from './pix2wav.module'
export const load_directories = (id) => (dispatch) => {
const module = pix2wavModule.name
util.allProgress([
datasetLoader.load(module),
// actions.socket.list_directory({ module, dir: 'datasets' }),
// actions.socket.list_directory({ module, dir: 'results' }),
// actions.socket.list_directory({ module, dir: 'output' }),
// actions.socket.disk_usage({ module, dir: 'datasets' }),
], (percent, i, n) => {
dispatch({ type: types.app.load_progress, progress: { i, n }})
}).then(res => {
const [datasetApiReport] = res //, datasets, results, output, datasetUsage, lossReport] = res
const {
folderLookup,
fileLookup,
datasetLookup,
folders,
files,
unsortedFolder,
} = datasetApiReport
dispatch({
type: types.dataset.load,
data: {
module,
folderLookup,
fileLookup,
datasetLookup,
folders, files,
},
})
if (id) {
console.log('folder id', id)
dispatch({
type: types.dataset.set_folder,
data: {
folder_id: id,
module
},
})
}
}).catch(e => {
console.error(e)
})
}
|