* file.db: file_user_rating: Table for tracking average user rating of a file
* Default filter order to descending * File rating support including in search/filter * Default to passing submitted form data (if any) @ prevMenu() * Fix issues with byte/size formatting for 0 * Allow action keys for prompts * use MenuModule.pausePrompt() in various places * Add quick search to file area * Display dupes, if any @ upload
This commit is contained in:
@@ -99,8 +99,7 @@ exports.getModule = class AbracadabraModule extends MenuModule {
|
||||
|
||||
if(_.isString(self.config.tooManyArt)) {
|
||||
theme.displayThemeArt( { client : self.client, name : self.config.tooManyArt }, function displayed() {
|
||||
// :TODO: Use MenuModule.pausePrompt()
|
||||
theme.displayThemedPause( { client : self.client }, function keyPressed() {
|
||||
self.pausePrompt( () => {
|
||||
callback(new Error('Too many active instances'));
|
||||
});
|
||||
});
|
||||
@@ -108,7 +107,7 @@ exports.getModule = class AbracadabraModule extends MenuModule {
|
||||
self.client.term.write('\nToo many active instances. Try again later.\n');
|
||||
|
||||
// :TODO: Use MenuModule.pausePrompt()
|
||||
theme.displayThemedPause( { client : self.client }, function keyPressed() {
|
||||
self.pausePrompt( () => {
|
||||
callback(new Error('Too many active instances'));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ exports.getModule = class FileAreaFilterEdit extends MenuModule {
|
||||
},
|
||||
newFilter : (formData, extraArgs, cb) => {
|
||||
this.currentFilterIndex = this.filtersArray.length; // next avail slot
|
||||
this.clearForm(true); // true=reset focus
|
||||
this.clearForm(MciViewIds.editor.searchTerms);
|
||||
return cb(null);
|
||||
},
|
||||
deleteFilter : (formData, extraArgs, cb) => {
|
||||
@@ -115,10 +115,12 @@ exports.getModule = class FileAreaFilterEdit extends MenuModule {
|
||||
}
|
||||
|
||||
// update UI
|
||||
this.updateActiveLabel();
|
||||
|
||||
if(this.filtersArray.length > 0) {
|
||||
this.loadDataForFilter(this.currentFilterIndex);
|
||||
} else {
|
||||
this.clearForm(true); // true=reset focus
|
||||
this.clearForm();
|
||||
}
|
||||
return cb(null);
|
||||
});
|
||||
@@ -203,7 +205,7 @@ exports.getModule = class FileAreaFilterEdit extends MenuModule {
|
||||
}
|
||||
}
|
||||
|
||||
clearForm(setFocus) {
|
||||
clearForm(newFocusId) {
|
||||
[ MciViewIds.editor.searchTerms, MciViewIds.editor.tags, MciViewIds.editor.filterName ].forEach(mciId => {
|
||||
this.setText(mciId, '');
|
||||
});
|
||||
@@ -212,7 +214,9 @@ exports.getModule = class FileAreaFilterEdit extends MenuModule {
|
||||
this.setFocusItemIndex(mciId, 0);
|
||||
});
|
||||
|
||||
if(setFocus) {
|
||||
if(newFocusId) {
|
||||
this.viewControllers.editor.switchFocus(newFocusId);
|
||||
} else {
|
||||
this.viewControllers.editor.resetInitialFocus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,9 +78,17 @@ exports.getModule = class FileAreaList extends MenuModule {
|
||||
|
||||
this.dlQueue = new DownloadQueue(this.client);
|
||||
|
||||
this.filterCriteria = this.filterCriteria || {
|
||||
// :TODO: set area tag - all in current area by default
|
||||
};
|
||||
if(!this.filterCriteria) {
|
||||
this.filterCriteria = FileBaseFilters.getActiveFilter(this.client);
|
||||
}
|
||||
|
||||
if(_.isString(this.filterCriteria)) {
|
||||
this.filterCriteria = JSON.parse(this.filterCriteria);
|
||||
}
|
||||
|
||||
if(_.has(options, 'lastMenuResult.value')) {
|
||||
this.lastMenuResultValue = options.lastMenuResult.value;
|
||||
}
|
||||
|
||||
this.menuMethods = {
|
||||
nextFile : (formData, extraArgs, cb) => {
|
||||
@@ -116,7 +124,7 @@ exports.getModule = class FileAreaList extends MenuModule {
|
||||
},
|
||||
showWebDownloadLink : (formData, extraArgs, cb) => {
|
||||
return this.fetchAndDisplayWebDownloadLink(cb);
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -128,11 +136,46 @@ exports.getModule = class FileAreaList extends MenuModule {
|
||||
super.leave();
|
||||
}
|
||||
|
||||
getSaveState() {
|
||||
return {
|
||||
fileList : this.fileList,
|
||||
fileListPosition : this.fileListPosition,
|
||||
};
|
||||
}
|
||||
|
||||
restoreSavedState(savedState) {
|
||||
if(savedState) {
|
||||
this.fileList = savedState.fileList;
|
||||
this.fileListPosition = savedState.fileListPosition;
|
||||
}
|
||||
}
|
||||
|
||||
updateFileEntryWithMenuResult(cb) {
|
||||
if(!this.lastMenuResultValue) {
|
||||
return cb(null);
|
||||
}
|
||||
|
||||
if(_.isNumber(this.lastMenuResultValue.rating)) {
|
||||
const fileId = this.fileList[this.fileListPosition];
|
||||
FileEntry.persistUserRating(fileId, this.client.user.userId, this.lastMenuResultValue.rating, err => {
|
||||
if(err) {
|
||||
this.client.log.warn( { error : err.message, fileId : fileId }, 'Failed to persist file rating' );
|
||||
}
|
||||
return cb(null);
|
||||
});
|
||||
} else {
|
||||
return cb(null);
|
||||
}
|
||||
}
|
||||
|
||||
initSequence() {
|
||||
const self = this;
|
||||
|
||||
async.series(
|
||||
[
|
||||
function preInit(callback) {
|
||||
return self.updateFileEntryWithMenuResult(callback);
|
||||
},
|
||||
function beforeArt(callback) {
|
||||
return self.beforeArt(callback);
|
||||
},
|
||||
@@ -165,11 +208,12 @@ exports.getModule = class FileAreaList extends MenuModule {
|
||||
fileName : currEntry.fileName,
|
||||
desc : currEntry.desc || '',
|
||||
descLong : currEntry.descLong || '',
|
||||
userRating : currEntry.userRating,
|
||||
uploadTimestamp : moment(currEntry.uploadTimestamp).format(uploadTimestampFormat),
|
||||
hashTags : Array.from(currEntry.hashTags).join(hashTagsSep),
|
||||
isQueued : this.dlQueue.isQueued(this.currentFileEntry) ? isQueuedIndicator : isNotQueuedIndicator,
|
||||
webDlLink : '', // :TODO: fetch web any existing web d/l link
|
||||
webDlExpire : '', // :TODO: fetch web d/l link expire time
|
||||
webDlExpire : '', // :TODO: fetch web d/l link expire time
|
||||
};
|
||||
|
||||
//
|
||||
@@ -196,7 +240,7 @@ exports.getModule = class FileAreaList extends MenuModule {
|
||||
// create a rating string, e.g. "**---"
|
||||
const userRatingTicked = config.userRatingTicked || '*';
|
||||
const userRatingUnticked = config.userRatingUnticked || '';
|
||||
entryInfo.userRating = entryInfo.userRating || 0; // be safe!
|
||||
entryInfo.userRating = ~~Math.round(entryInfo.userRating) || 0; // be safe!
|
||||
entryInfo.userRatingString = new Array(entryInfo.userRating + 1).join(userRatingTicked);
|
||||
if(entryInfo.userRating < 5) {
|
||||
entryInfo.userRatingString += new Array( (5 - entryInfo.userRating) + 1).join(userRatingUnticked);
|
||||
@@ -297,7 +341,7 @@ exports.getModule = class FileAreaList extends MenuModule {
|
||||
if(self.fileList) {
|
||||
return callback(null);
|
||||
}
|
||||
return self.loadFileIds(callback);
|
||||
return self.loadFileIds(false, callback); // false=do not force
|
||||
},
|
||||
function loadCurrentFileInfo(callback) {
|
||||
self.currentFileEntry = new FileEntry();
|
||||
@@ -566,14 +610,13 @@ exports.getModule = class FileAreaList extends MenuModule {
|
||||
);
|
||||
}
|
||||
|
||||
loadFileIds(cb) {
|
||||
this.fileListPosition = 0;
|
||||
const activeFilter = FileBaseFilters.getActiveFilter(this.client);
|
||||
|
||||
FileEntry.findFiles(activeFilter, (err, fileIds) => {
|
||||
this.fileList = fileIds;
|
||||
return cb(err);
|
||||
});
|
||||
loadFileIds(force, cb) {
|
||||
if(force || (_.isUndefined(this.fileList) || _.isUndefined(this.fileListPosition))) {
|
||||
this.fileListPosition = 0;
|
||||
FileEntry.findFiles(this.filterCriteria, (err, fileIds) => {
|
||||
this.fileList = fileIds;
|
||||
return cb(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
119
mods/file_base_search.js
Normal file
119
mods/file_base_search.js
Normal file
@@ -0,0 +1,119 @@
|
||||
/* jslint node: true */
|
||||
'use strict';
|
||||
|
||||
// ENiGMA½
|
||||
const MenuModule = require('../core/menu_module.js').MenuModule;
|
||||
const ViewController = require('../core/view_controller.js').ViewController;
|
||||
const getSortedAvailableFileAreas = require('../core/file_base_area.js').getSortedAvailableFileAreas;
|
||||
const FileBaseFilters = require('../core/file_base_filter.js');
|
||||
|
||||
// deps
|
||||
const async = require('async');
|
||||
|
||||
exports.moduleInfo = {
|
||||
name : 'File Base Search',
|
||||
desc : 'Module for quickly searching the file base',
|
||||
author : 'NuSkooler',
|
||||
};
|
||||
|
||||
const MciViewIds = {
|
||||
search : {
|
||||
searchTerms : 1,
|
||||
search : 2,
|
||||
tags : 3,
|
||||
area : 4,
|
||||
orderBy : 5,
|
||||
sort : 6,
|
||||
advSearch : 7,
|
||||
}
|
||||
};
|
||||
|
||||
exports.getModule = class FileBaseSearch extends MenuModule {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
|
||||
this.menuMethods = {
|
||||
search : (formData, extraArgs, cb) => {
|
||||
const isAdvanced = formData.submitId === MciViewIds.search.advSearch;
|
||||
return this.searchNow(formData, isAdvanced, cb);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
mciReady(mciData, cb) {
|
||||
super.mciReady(mciData, err => {
|
||||
if(err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
const self = this;
|
||||
const vc = self.addViewController( 'search', new ViewController( { client : this.client } ) );
|
||||
|
||||
async.series(
|
||||
[
|
||||
function loadFromConfig(callback) {
|
||||
return vc.loadFromMenuConfig( { callingMenu : self, mciMap : mciData.menu }, callback);
|
||||
},
|
||||
function populateAreas(callback) {
|
||||
self.availAreas = [ { name : '-ALL-' } ].concat(getSortedAvailableFileAreas(self.client) || []);
|
||||
|
||||
const areasView = vc.getView(MciViewIds.search.area);
|
||||
if(areasView) {
|
||||
areasView.setItems( self.availAreas.map( a => a.name ) );
|
||||
}
|
||||
|
||||
return callback(null);
|
||||
}
|
||||
],
|
||||
err => {
|
||||
return cb(err);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
getSelectedAreaTag(index) {
|
||||
if(0 === index) {
|
||||
return ''; // -ALL-
|
||||
}
|
||||
const area = this.availAreas[index];
|
||||
if(!area) {
|
||||
return '';
|
||||
}
|
||||
return area.areaTag;
|
||||
}
|
||||
|
||||
getOrderBy(index) {
|
||||
return FileBaseFilters.OrderByValues[index] || FileBaseFilters.OrderByValues[0];
|
||||
}
|
||||
|
||||
getSortBy(index) {
|
||||
return FileBaseFilters.SortByValues[index] || FileBaseFilters.SortByValues[0];
|
||||
}
|
||||
|
||||
getFilterValuesFromFormData(formData, isAdvanced) {
|
||||
const areaIndex = isAdvanced ? formData.value.areaIndex : 0;
|
||||
const orderByIndex = isAdvanced ? formData.value.orderByIndex : 0;
|
||||
const sortByIndex = isAdvanced ? formData.value.sortByIndex : 0;
|
||||
|
||||
return {
|
||||
areaTag : this.getSelectedAreaTag(areaIndex),
|
||||
terms : formData.value.searchTerms,
|
||||
tags : isAdvanced ? formData.value.tags : '',
|
||||
order : this.getOrderBy(orderByIndex),
|
||||
sort : this.getSortBy(sortByIndex),
|
||||
};
|
||||
}
|
||||
|
||||
searchNow(formData, isAdvanced, cb) {
|
||||
const filterCriteria = this.getFilterValuesFromFormData(formData, isAdvanced);
|
||||
|
||||
const menuOpts = {
|
||||
extraArgs : {
|
||||
filterCriteria : filterCriteria,
|
||||
}
|
||||
};
|
||||
|
||||
return this.gotoMenu(this.menuConfig.config.fileBaseListEntriesMenu || 'fileBaseListEntries', menuOpts, cb);
|
||||
}
|
||||
};
|
||||
@@ -6,7 +6,6 @@ const MenuModule = require('../core/menu_module.js').MenuModule;
|
||||
const ViewController = require('../core/view_controller.js').ViewController;
|
||||
const messageArea = require('../core/message_area.js');
|
||||
const displayThemeArt = require('../core/theme.js').displayThemeArt;
|
||||
const displayThemedPause = require('../core/theme.js').displayThemedPause;
|
||||
const resetScreen = require('../core/ansi_term.js').resetScreen;
|
||||
const stringFormat = require('../core/string_format.js');
|
||||
|
||||
@@ -76,8 +75,7 @@ exports.getModule = class MessageAreaListModule extends MenuModule {
|
||||
if(_.has(area, 'options.pause') && false === area.options.pause) {
|
||||
return self.prevMenuOnTimeout(1000, cb);
|
||||
} else {
|
||||
// :TODO: Use MenuModule.pausePrompt()
|
||||
displayThemedPause( { client : self.client }, () => {
|
||||
self.pausePrompt( () => {
|
||||
return self.prevMenu(cb);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ const MenuModule = require('../core/menu_module.js').MenuModule;
|
||||
const ViewController = require('../core/view_controller.js').ViewController;
|
||||
const messageArea = require('../core/message_area.js');
|
||||
const displayThemeArt = require('../core/theme.js').displayThemeArt;
|
||||
const displayThemedPause = require('../core/theme.js').displayThemedPause;
|
||||
const resetScreen = require('../core/ansi_term.js').resetScreen;
|
||||
const stringFormat = require('../core/string_format.js');
|
||||
|
||||
@@ -63,8 +62,7 @@ exports.getModule = class MessageConfListModule extends MenuModule {
|
||||
if(_.has(conf, 'options.pause') && false === conf.options.pause) {
|
||||
return self.prevMenuOnTimeout(1000, cb);
|
||||
} else {
|
||||
// :TODO: Use MenuModule.pausePrompt()
|
||||
displayThemedPause( { client : self.client }, () => {
|
||||
self.pausePrompt( () => {
|
||||
return self.prevMenu(cb);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,8 +1,34 @@
|
||||
{
|
||||
/*
|
||||
./\/\.' ENiGMA½ Prompt Configuration -/--/-------- - -- -
|
||||
|
||||
_____________________ _____ ____________________ __________\_ /
|
||||
\__ ____/\_ ____ \ /____/ / _____ __ \ / ______/ // /___jp!
|
||||
// __|___// | \// |// | \// | | \// \ /___ /_____
|
||||
/____ _____| __________ ___|__| ____| \ / _____ \
|
||||
---- \______\ -- |______\ ------ /______/ ---- |______\ - |______\ /__/ // ___/
|
||||
/__ _\
|
||||
<*> ENiGMA½ // HTTPS://GITHUB.COM/NUSKOOLER/ENIGMA-BBS <*> /__/
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
This configuration is in HJSON (http://hjson.org/) format. Strict to-spec
|
||||
JSON is also perfectly valid. Use 'hjson' from npm to convert to/from JSON.
|
||||
|
||||
See http://hjson.org/ for more information and syntax.
|
||||
|
||||
|
||||
If you haven't yet, copy the conents of this file to something like
|
||||
sick_board_prompt.hjson. Point to it via config.hjson using the
|
||||
'general.promptFile' key:
|
||||
|
||||
general: { promptFile: "sick_board_prompt.hjson" }
|
||||
|
||||
*/
|
||||
// :TODO: this entire file needs cleaned up a LOT
|
||||
// :TODO: Convert all of this to HJSON
|
||||
"prompts" : {
|
||||
"userCredentials" : {
|
||||
prompts: {
|
||||
userCredentials: {
|
||||
"art" : "usercred",
|
||||
"mci" : {
|
||||
"ET1" : {
|
||||
@@ -106,6 +132,25 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// File Base Related
|
||||
fileBaseRateEntryPrompt: {
|
||||
art: RATEFILE
|
||||
mci: {
|
||||
SM1: {
|
||||
argName: rating
|
||||
items: [ "-----", "*----", "**---", "***--", "****-", "*****" ]
|
||||
}
|
||||
}
|
||||
|
||||
actionKeys: [
|
||||
{
|
||||
keys: [ "escape" ]
|
||||
action: @systemMethod:prevMenu
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Standard / Required
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
117
mods/upload.js
117
mods/upload.js
@@ -7,11 +7,14 @@ const stringFormat = require('../core/string_format.js');
|
||||
const getSortedAvailableFileAreas = require('../core/file_base_area.js').getSortedAvailableFileAreas;
|
||||
const getAreaDefaultStorageDirectory = require('../core/file_base_area.js').getAreaDefaultStorageDirectory;
|
||||
const scanFile = require('../core/file_base_area.js').scanFile;
|
||||
const getFileAreaByTag = require('../core/file_base_area.js').getFileAreaByTag;
|
||||
const ansiGoto = require('../core/ansi_term.js').goto;
|
||||
const moveFileWithCollisionHandling = require('../core/file_util.js').moveFileWithCollisionHandling;
|
||||
const pathWithTerminatingSeparator = require('../core/file_util.js').pathWithTerminatingSeparator;
|
||||
const Log = require('../core/logger.js').log;
|
||||
const Errors = require('../core/enig_error.js').Errors;
|
||||
const FileEntry = require('../core/file_entry.js');
|
||||
const enigmaToAnsi = require('../core/color_codes.js').enigmaToAnsi;
|
||||
|
||||
// deps
|
||||
const async = require('async');
|
||||
@@ -30,7 +33,7 @@ const FormIds = {
|
||||
options : 0,
|
||||
processing : 1,
|
||||
fileDetails : 2,
|
||||
|
||||
dupes : 3,
|
||||
};
|
||||
|
||||
const MciViewIds = {
|
||||
@@ -56,6 +59,10 @@ const MciViewIds = {
|
||||
estYear : 3,
|
||||
accept : 4, // accept fields & continue
|
||||
customRangeStart : 10, // 10+ = customs
|
||||
},
|
||||
|
||||
dupes : {
|
||||
dupeList : 1,
|
||||
}
|
||||
};
|
||||
|
||||
@@ -161,17 +168,6 @@ exports.getModule = class UploadModule extends MenuModule {
|
||||
}
|
||||
}
|
||||
|
||||
leave() {
|
||||
// remove any temp files - only do this when
|
||||
if(this.isFileTransferComplete()) {
|
||||
temptmp.cleanup( paths => {
|
||||
Log.debug( { paths : paths, sessionId : temptmp.sessionId }, 'Temporary files cleaned up' );
|
||||
});
|
||||
}
|
||||
|
||||
super.leave();
|
||||
}
|
||||
|
||||
performUpload(cb) {
|
||||
temptmp.mkdir( { prefix : 'enigul-' }, (err, tempRecvDirectory) => {
|
||||
if(err) {
|
||||
@@ -341,6 +337,12 @@ exports.getModule = class UploadModule extends MenuModule {
|
||||
});
|
||||
}
|
||||
|
||||
cleanupTempFiles() {
|
||||
temptmp.cleanup( paths => {
|
||||
Log.debug( { paths : paths, sessionId : temptmp.sessionId }, 'Temporary files cleaned up' );
|
||||
});
|
||||
}
|
||||
|
||||
moveAndPersistUploadsToDatabase(newEntries) {
|
||||
|
||||
const areaStorageDir = getAreaDefaultStorageDirectory(this.areaInfo);
|
||||
@@ -370,6 +372,11 @@ exports.getModule = class UploadModule extends MenuModule {
|
||||
return nextEntry(null); // still try next file
|
||||
});
|
||||
});
|
||||
}, () => {
|
||||
//
|
||||
// Finally, we can remove any temp files that we may have created
|
||||
//
|
||||
self.cleanupTempFiles();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -401,6 +408,75 @@ exports.getModule = class UploadModule extends MenuModule {
|
||||
});
|
||||
}
|
||||
|
||||
displayDupesPage(dupes, cb) {
|
||||
//
|
||||
// If we have custom art to show, use it - else just dump basic info.
|
||||
// Pause at the end in either case.
|
||||
//
|
||||
const self = this;
|
||||
|
||||
async.waterfall(
|
||||
[
|
||||
function prepArtAndViewController(callback) {
|
||||
self.prepViewControllerWithArt(
|
||||
'dupes',
|
||||
FormIds.dupes,
|
||||
{ clearScreen : true, trailingLF : false },
|
||||
err => {
|
||||
if(err) {
|
||||
self.client.term.pipeWrite('|00|07Duplicate upload(s) found:\n');
|
||||
return callback(null, null);
|
||||
}
|
||||
|
||||
const dupeListView = self.viewControllers.dupes.getView(MciViewIds.dupes.dupeList);
|
||||
return callback(null, dupeListView);
|
||||
}
|
||||
);
|
||||
},
|
||||
function prepDupeObjects(dupeListView, callback) {
|
||||
// update dupe objects with additional info that can be used for formatString() and the like
|
||||
async.each(dupes, (dupe, nextDupe) => {
|
||||
FileEntry.loadBasicEntry(dupe.fileId, dupe, err => {
|
||||
if(err) {
|
||||
return nextDupe(err);
|
||||
}
|
||||
|
||||
const areaInfo = getFileAreaByTag(dupe.areaTag);
|
||||
if(areaInfo) {
|
||||
dupe.areaName = areaInfo.name;
|
||||
dupe.areaDesc = areaInfo.desc;
|
||||
}
|
||||
return nextDupe(null);
|
||||
});
|
||||
}, err => {
|
||||
return callback(err, dupeListView);
|
||||
});
|
||||
},
|
||||
function populateDupeInfo(dupeListView, callback) {
|
||||
const dupeInfoFormat = self.menuConfig.config.dupeInfoFormat || '{fileName} @ {areaName}';
|
||||
|
||||
dupes.forEach(dupe => {
|
||||
const formatted = stringFormat(dupeInfoFormat, dupe);
|
||||
if(dupeListView) {
|
||||
// dupesInfoFormatX
|
||||
dupeListView.addText(enigmaToAnsi(formatted));
|
||||
} else {
|
||||
self.client.term.pipeWrite(`${formatted}\n`);
|
||||
}
|
||||
});
|
||||
|
||||
return callback(null);
|
||||
},
|
||||
function pause(callback) {
|
||||
return self.pausePrompt( { row : self.client.term.termHeight }, callback);
|
||||
}
|
||||
],
|
||||
err => {
|
||||
return cb(err);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
processUploadedFiles() {
|
||||
//
|
||||
// For each file uploaded, we need to process & gather information
|
||||
@@ -437,15 +513,16 @@ exports.getModule = class UploadModule extends MenuModule {
|
||||
|
||||
self.pausePrompt( () => {
|
||||
return callback(null, scanResults);
|
||||
});
|
||||
});
|
||||
},
|
||||
function displayDupes(scanResults, callback) {
|
||||
if(0 === scanResults.dupes.length) {
|
||||
return callback(null, scanResults);
|
||||
}
|
||||
|
||||
// :TODO: display dupe info
|
||||
return callback(null, scanResults);
|
||||
return self.displayDupesPage(scanResults.dupes, () => {
|
||||
return callback(null, scanResults);
|
||||
});
|
||||
},
|
||||
function prepDetails(scanResults, callback) {
|
||||
return self.prepDetailsForUpload(scanResults, callback);
|
||||
@@ -463,6 +540,7 @@ exports.getModule = class UploadModule extends MenuModule {
|
||||
err => {
|
||||
if(err) {
|
||||
self.client.log.warn('File upload error encountered', { error : err.message } );
|
||||
self.cleanupTempFiles(); // normally called after moveAndPersistUploadsToDatabase() is completed.
|
||||
}
|
||||
|
||||
return self.prevMenu();
|
||||
@@ -565,13 +643,16 @@ exports.getModule = class UploadModule extends MenuModule {
|
||||
|
||||
tagsView.setText( Array.from(fileEntry.hashTags).join(',') ); // :TODO: optional 'hashTagsSep' like file list/browse
|
||||
yearView.setText(fileEntry.meta.est_release_year || '');
|
||||
|
||||
|
||||
if(self.fileEntryHasDetectedDesc(fileEntry)) {
|
||||
descView.setText(fileEntry.desc);
|
||||
descView.setPropertyValue('mode', 'preview');
|
||||
self.viewControllers.fileDetails.switchFocus(MciViewIds.fileDetails.tags);
|
||||
descView.setText(fileEntry.desc);
|
||||
descView.acceptsFocus = false;
|
||||
self.viewControllers.fileDetails.switchFocus(MciViewIds.fileDetails.tags);
|
||||
} else {
|
||||
descView.setPropertyValue('mode', 'edit');
|
||||
descView.setText('');
|
||||
descView.acceptsFocus = true;
|
||||
self.viewControllers.fileDetails.switchFocus(MciViewIds.fileDetails.desc);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user