From 79a13c20e1f2ce3f1838f500802d5355dce90446 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 20 Jun 2018 13:17:29 +0200 Subject: crazy.. --- app/client/common/fileList.component.js | 4 ++ app/client/modules/pix2pixhd/pix2pixhd.actions.js | 3 +- app/client/modules/pix2pixhd/pix2pixhd.reducer.js | 6 ++ .../modules/pix2pixhd/views/pix2pixhd.results.js | 68 ++++++++++++++-------- app/relay/runner.js | 4 ++ 5 files changed, 60 insertions(+), 25 deletions(-) diff --git a/app/client/common/fileList.component.js b/app/client/common/fileList.component.js index 1108dbf..688e325 100644 --- a/app/client/common/fileList.component.js +++ b/app/client/common/fileList.component.js @@ -64,6 +64,7 @@ export const FileRow = props => { const size = util.hush_size(file.size) const date = file.date || file.created_at const epoch = file.epoch || file.epochs || 0 + const count = file.count || 0 let name; let key; @@ -111,6 +112,9 @@ export const FileRow = props => { {fields.has('size') &&
{size[1]}
} + {fields.has('count') && +
{count > 0 ? 'f. ' + count : ''}
+ } {(fields.has('activity') || fields.has('module')) &&
{fields.has('activity') && file.activity} diff --git a/app/client/modules/pix2pixhd/pix2pixhd.actions.js b/app/client/modules/pix2pixhd/pix2pixhd.actions.js index 1b22616..caf6b45 100644 --- a/app/client/modules/pix2pixhd/pix2pixhd.actions.js +++ b/app/client/modules/pix2pixhd/pix2pixhd.actions.js @@ -140,7 +140,7 @@ export const load_results = (id) => (dispatch) => { console.log('hi') const module = pix2pixhdModule.name util.allProgress([ - actions.file.index({ module, generated: true }), + actions.file.index({ module, generated: 1 }), actions.socket.list_sequences({ module, dir: 'results' }), actions.socket.list_directory({ module, dir: 'renders' }), ], (percent, i, n) => { @@ -152,6 +152,7 @@ export const load_results = (id) => (dispatch) => { dispatch({ type: types.pix2pixhd.load_results, results: { + files, results, renders, } diff --git a/app/client/modules/pix2pixhd/pix2pixhd.reducer.js b/app/client/modules/pix2pixhd/pix2pixhd.reducer.js index a21f4d5..b6264ed 100644 --- a/app/client/modules/pix2pixhd/pix2pixhd.reducer.js +++ b/app/client/modules/pix2pixhd/pix2pixhd.reducer.js @@ -7,6 +7,7 @@ const pix2pixhdInitialState = { error: null, folder_id: 0, data: null, + results: null, } const pix2pixhdReducer = (state = pix2pixhdInitialState, action) => { @@ -15,6 +16,11 @@ const pix2pixhdReducer = (state = pix2pixhdInitialState, action) => { } switch (action.type) { + case types.pix2pixhd.load_results: + return { + ...state, + results: action.results, + } default: return state } diff --git a/app/client/modules/pix2pixhd/views/pix2pixhd.results.js b/app/client/modules/pix2pixhd/views/pix2pixhd.results.js index cf0bdf7..ac0bb74 100644 --- a/app/client/modules/pix2pixhd/views/pix2pixhd.results.js +++ b/app/client/modules/pix2pixhd/views/pix2pixhd.results.js @@ -16,37 +16,57 @@ class Pix2pixHDResults extends Component { if (!props.pix2pixhd.results) props.actions.load_results() } render(){ - if (this.props.pix2pixhd.loading) return - // const { folderLookup, fileLookup, datasetLookup } = this.props.samplernn.data - - // console.log(bestRenders.map(r => r.epoch)) - // const path = folder.name === 'unsorted' - // ? "/samplernn/import/" - // : "/samplernn/datasets/" + folder.id + "/" - // return ( - //
- //

{folder.name}

- // { - // e.preventDefault() - // e.stopPropagation() - // console.log('picked a file', file) - // this.handlePick(file) - // }} - // /> - //
- // ) + if (! this.props.pix2pixhd.results) return + const { results, renders, files } = this.props.pix2pixhd.results +console.log(results) return (

Pix2PixHD Results

+ +

results

+ { + e.preventDefault() + e.stopPropagation() + console.log('picked a result', file) + this.handlePick(file) + }} + /> + +

renders

+ { + e.preventDefault() + e.stopPropagation() + console.log('picked a result', file) + this.handlePick(file) + }} + /> + +

files

+ { + e.preventDefault() + e.stopPropagation() + console.log('picked a result', file) + this.handlePick(file) + }} + /> +
) diff --git a/app/relay/runner.js b/app/relay/runner.js index 06fa85e..705d0c1 100644 --- a/app/relay/runner.js +++ b/app/relay/runner.js @@ -212,7 +212,11 @@ export function list_sequence(opt, f, root_dir) { count: 0, } readdir(path.join(root_dir, f.name)).then(files => { + if (! files.length) { + return resolve(sequence) + } const middle_file = files[Math.floor(files.length/2)] + if (! middle_file) return resolve(sequence) sequence.frame = { prefix: middle_file.split('_')[0], } -- cgit v1.2.3-70-g09d2