This commit is contained in:
UKDTOM 2021-12-02 13:23:00 +01:00
parent bde21bcb3d
commit bebabfd287
2 changed files with 26 additions and 32 deletions

View file

@ -22,6 +22,7 @@
* [#413 Translations should be in it's own branch](https://github.com/WebTools-NG/WebTools-NG/issues/413) * [#413 Translations should be in it's own branch](https://github.com/WebTools-NG/WebTools-NG/issues/413)
* [#418 If selected qualifier in string things break](https://github.com/WebTools-NG/WebTools-NG/issues/418) * [#418 If selected qualifier in string things break](https://github.com/WebTools-NG/WebTools-NG/issues/418)
* [#386 When exporting using ExportTools, the ' is missing from the Column "Part File Combined"](https://github.com/WebTools-NG/WebTools-NG/issues/386) * [#386 When exporting using ExportTools, the ' is missing from the Column "Part File Combined"](https://github.com/WebTools-NG/WebTools-NG/issues/386)
* [#420 ET Refactor Movies Verify all fields are quoted correctly](https://github.com/WebTools-NG/WebTools-NG/issues/420)
## V0.3.12 (20210709) ## V0.3.12 (20210709)

View file

@ -168,7 +168,6 @@ const etHelper = new class ETHELPER {
'TimeElapsed': 8, 'TimeElapsed': 8,
'RunningTime': 9 'RunningTime': 9
}; };
} }
resetETHelper() { resetETHelper() {
@ -213,43 +212,37 @@ const etHelper = new class ETHELPER {
switch ( String(name) ){ switch ( String(name) ){
case "Audience Rating": case "Audience Rating":
{ {
let TextQualifierCSV = wtconfig.get('ET.TextQualifierCSV', ''); retVal = val.substring(0, 3);
retVal = TextQualifierCSV + val.replaceAll(TextQualifierCSV, '').substring(0, 3) + TextQualifierCSV;
break; break;
} }
case "Rating": case "Rating":
{ {
let TextQualifierCSV = wtconfig.get('ET.TextQualifierCSV', ''); retVal = val.substring(0, 3);
retVal = TextQualifierCSV + val.replaceAll(TextQualifierCSV, '').substring(0, 3) + TextQualifierCSV;
break; break;
} }
case "Part File": case "Part File":
for (x=0; x<valArray.length; x++) { for (x=0; x<valArray.length; x++) {
retArray.push(setQualifier( {str:path.basename(valArray[x]).slice(0, -1)})); retArray.push(path.basename(valArray[x]).slice(0, -1));
} }
retVal = retArray.join(wtconfig.get('ET.ArraySep', ' * ')) retVal = retArray.join(wtconfig.get('ET.ArraySep', ' * '))
break; break;
case "Part File Path": case "Part File Path":
for (x=0; x<valArray.length; x++) { for (x=0; x<valArray.length; x++) {
retArray.push(setQualifier( {str:path.dirname(valArray[x]).substring(1)})); retArray.push(path.dirname(valArray[x]).substring(1));
} }
retVal = retArray.join(wtconfig.get('ET.ArraySep', ' * ')); retVal = retArray.join(wtconfig.get('ET.ArraySep', ' * '));
break; break;
case "Part Size": case "Part Size":
for (x=0; x<valArray.length; x++) { for (x=0; x<valArray.length; x++) {
let theSize = valArray[x].replaceAll('"', '').replaceAll(wtconfig.get('ET.TextQualifierCSV'),'');
if (theSize.startsWith('"')){
theSize = theSize.slice(1,-1);
}
try{ try{
retArray.push(filesize(theSize)); retArray.push(filesize(valArray[x]));
} }
catch (error) catch (error)
{ {
log.error(`Error getting Part Size was ${error} for ${theSize}`); log.error(`Error getting Part Size was ${error} for ${valArray[x]}`);
} }
} }
retVal = setQualifier( {str:retArray.join(wtconfig.get('ET.ArraySep', ' * '))} ); retVal = retArray.join(wtconfig.get('ET.ArraySep', ' * '));
break; break;
case "Original Title": case "Original Title":
if (wtconfig.get('ET.OrgTitleNull')) if (wtconfig.get('ET.OrgTitleNull'))
@ -257,12 +250,10 @@ const etHelper = new class ETHELPER {
log.silly(`We need to override Original Titel, if not avail`); log.silly(`We need to override Original Titel, if not avail`);
log.silly(`Got Original title as: ${val}`); log.silly(`Got Original title as: ${val}`);
log.silly(`Alternative might be title as: ${title}`); log.silly(`Alternative might be title as: ${title}`);
let compNA = (wtconfig.get('ET.TextQualifierCSV') + wtconfig.get('ET.NotAvail') + wtconfig.get('ET.TextQualifierCSV')).trim();
log.silly(`compNA is: ${compNA}`);
// Override with title if not found // Override with title if not found
if (val == compNA) if (val == wtconfig.get('ET.NotAvail'))
{ {
retVal = setQualifier( {str:title} ); retVal = title;
} }
else { retVal = val; } else { retVal = val; }
} }
@ -276,8 +267,7 @@ const etHelper = new class ETHELPER {
if (wtconfig.get('ET.SortTitleNull')) if (wtconfig.get('ET.SortTitleNull'))
{ {
// Override with title if not found // Override with title if not found
let compNA = (wtconfig.get('ET.TextQualifierCSV') + wtconfig.get('ET.NotAvail') + wtconfig.get('ET.TextQualifierCSV')).trim(); if (val == wtconfig.get('ET.NotAvail'))
if (val == compNA)
{ {
retVal = title; retVal = title;
} }
@ -287,8 +277,7 @@ const etHelper = new class ETHELPER {
} }
else else
{ {
let compNA = (wtconfig.get('ET.TextQualifierCSV') + 'undefined' + wtconfig.get('ET.TextQualifierCSV')).trim(); if (val == 'undefined')
if (val == compNA)
{ {
retVal = wtconfig.get('ET.NotAvail'); retVal = wtconfig.get('ET.NotAvail');
} }
@ -351,8 +340,6 @@ const etHelper = new class ETHELPER {
{ {
retVal = wtconfig.get('ET.NotAvail'); retVal = wtconfig.get('ET.NotAvail');
} }
retVal = retVal.slice(0, -1);
retVal = setQualifier( {str:retVal} );
break; break;
case "IMDB Link": case "IMDB Link":
if (val == wtconfig.get('ET.NotAvail')) if (val == wtconfig.get('ET.NotAvail'))
@ -549,11 +536,12 @@ const etHelper = new class ETHELPER {
val = wtconfig.get('ET.NotAvail', 'N/A'); val = wtconfig.get('ET.NotAvail', 'N/A');
} }
val = etHelper.isEmpty( { "val": val } ); val = etHelper.isEmpty( { "val": val } );
val = setQualifier( {str: val} ); // val = setQualifier( {str: val} );
break; break;
case "array": case "array":
array = JSONPath({path: key, json: data}); array = JSONPath({path: key, json: data});
if (array === undefined || array.length == 0) { if (array === undefined || array.length == 0) {
// val = setQualifier( {str: wtconfig.get('ET.NotAvail', 'N/A')} );
val = wtconfig.get('ET.NotAvail', 'N/A'); val = wtconfig.get('ET.NotAvail', 'N/A');
} }
else else
@ -591,11 +579,7 @@ const etHelper = new class ETHELPER {
valArray.push(valArrayVal) valArray.push(valArrayVal)
} }
val = valArray.join(wtconfig.get('ET.ArraySep', ' * ')) val = valArray.join(wtconfig.get('ET.ArraySep', ' * '))
val = setQualifier( {str: val} ); // val = setQualifier( {str: val} );
/* if ( String(subType) == 'string')
{
val = textSep + val + textSep;
} */
} }
break; break;
case "array-count": case "array-count":
@ -619,7 +603,7 @@ const etHelper = new class ETHELPER {
{ {
val = wtconfig.get('ET.NotAvail', 'N/A') val = wtconfig.get('ET.NotAvail', 'N/A')
} }
val = setQualifier( {str: val} ); // val = setQualifier( {str: val} );
break; break;
case "datetime": case "datetime":
//val = JSONPath({path: String(lookup), json: data}); //val = JSONPath({path: String(lookup), json: data});
@ -642,7 +626,7 @@ const etHelper = new class ETHELPER {
{ {
val = wtconfig.get('ET.NotAvail', 'N/A') val = wtconfig.get('ET.NotAvail', 'N/A')
} }
val = setQualifier( {str: val} ); // val = setQualifier( {str: val} );
break; break;
} }
if ( doPostProc ) if ( doPostProc )
@ -651,6 +635,11 @@ const etHelper = new class ETHELPER {
log.silly(`ETHelper(addRowToTmp doPostProc): Name is: ${name} - Title is: ${title} - Val is: ${val}`) log.silly(`ETHelper(addRowToTmp doPostProc): Name is: ${name} - Title is: ${title} - Val is: ${val}`)
val = await this.postProcess( {name: name, val: val, title: title} ); val = await this.postProcess( {name: name, val: val, title: title} );
} }
// Here we add qualifier, if not a number
if (!['array-count', 'int'].includes(type))
{
val = setQualifier( {str: val} );
}
str += val + etHelper.intSep; str += val + etHelper.intSep;
} }
} }
@ -662,6 +651,10 @@ const etHelper = new class ETHELPER {
// Remove last internal separator // Remove last internal separator
str = str.substring(0,str.length-etHelper.intSep.length); str = str.substring(0,str.length-etHelper.intSep.length);
str = str.replaceAll(this.intSep, wtconfig.get("ET.ColumnSep", '|')); str = str.replaceAll(this.intSep, wtconfig.get("ET.ColumnSep", '|'));
this.updateStatusMsg( this.RawMsgType.TimeElapsed, await this.getRunningTimeElapsed()); this.updateStatusMsg( this.RawMsgType.TimeElapsed, await this.getRunningTimeElapsed());
log.silly(`etHelper (addRowToTmp) returned: ${JSON.stringify(str)}`); log.silly(`etHelper (addRowToTmp) returned: ${JSON.stringify(str)}`);
return str; return str;