Merge pull request #427 from WebTools-NG/#71

#71
This commit is contained in:
Tommy Mikkelsen 2021-12-21 01:42:04 +01:00 committed by GitHub
commit f7bb0a8a4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 1310 additions and 1205 deletions

View file

@ -9,6 +9,7 @@
**Note 3**: In this version, the following is disabled:
* Export to xlsx format ([See #331](https://github.com/WebTools-NG/WebTools-NG/issues/331))
* Photo export
**Changes**:
@ -24,6 +25,10 @@
* [#420 ET Refactor Movies Verify all fields are quoted correctly](https://github.com/WebTools-NG/WebTools-NG/issues/420)
* [#404 Exporting issues with delimiters under windows](https://github.com/WebTools-NG/WebTools-NG/issues/404)
* [#408 Poster export stops when no poster attached to a Plex movie](https://github.com/WebTools-NG/WebTools-NG/issues/408)
* Removed `YEAR` from Episode, since not avail
* Added `Item Counts` to Shows Export
* [#425 ET Level 1 Export progress](https://github.com/WebTools-NG/WebTools-NG/issues/425)
* [#426 Replace format chars in text fields](https://github.com/WebTools-NG/WebTools-NG/issues/426)
## V0.3.12 (20210709)

2035
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -152,7 +152,12 @@
"Posters_Dimensions": "Poster width * height",
"Posters_Dimensions_TT": "Poster width*height, If 'Export Posters' is a field in the export. Can be separated by a comma, for multiple exports, like `75*75, 1024*768`. Note: dimensions might be altered slightly in order to preserve the aspect ratio of the poster",
"Art_Dimensions": "Art width * height",
"Art_Dimensions_TT": "Art width*height, If 'Export Art' is a field in the export. Can be seperated by a comma, for multiple exports, like `75*75, 1024*768`. Note: dimensions might be altered slightly in order to preserve the aspect ratio of the art"
"Art_Dimensions_TT": "Art width*height, If 'Export Art' is a field in the export. Can be seperated by a comma, for multiple exports, like `75*75, 1024*768`. Note: dimensions might be altered slightly in order to preserve the aspect ratio of the art",
"ChReturn": "Replace Return character with",
"ChReturn_TT": "Leave blank to not replace",
"ChNewLine": "Replace NewLine character with",
"ChNewLine_TT": "Leave blank to not replace"
},
"LevelInfo": "Export level determines which data are going to be exported.",
"SelectLevel": "Select level",

View file

@ -267,10 +267,9 @@
var fields = def['fields'];
// Release def memory again
def = null;
//const revSelMediaType = et.getLibTypeName(this.selMediaType);
//const levelFields = wtconfig.get(`ET.CustomLevels.${revSelMediaType}.level.${this.selCustLevel}`);
const levelFields = wtconfig.get(`ET.CustomLevels.${this.selMediaType}.level.${this.selCustLevel}`);
let curLevel = 0;
let includeFields = '';
levelFields.forEach(function (item) {
// Get field level
var count = fields[item]['call'];
@ -278,9 +277,24 @@
{
curLevel = count;
}
// Get Include
var includeField = fields[item]['include'];
if ( typeof includeField !== 'undefined' && includeField )
{
if ( includeFields == '')
{
includeFields = includeField;
}
else if ( !includeFields.includes(includeField))
{
includeFields = includeFields + '&' + includeField;
}
}
});
log.info(`LevelCount for "${this.selCustLevel}" of the type "${this.selMediaType}" was calculated as:${curLevel}`);
wtconfig.set(`ET.CustomLevels.${this.selMediaType}.LevelCount.${this.selCustLevel}`, curLevel);
log.info(`includeFields for "${this.selCustLevel}" of the type "${this.selMediaType}" was calculated as:${includeFields}`);
wtconfig.set(`ET.CustomLevels.${this.selMediaType}.Include.${this.selCustLevel}`, includeFields);
},
changeType: function() {
// Triggers when lib type is changed

View file

@ -27,6 +27,18 @@
</b-tooltip>
<b-form-input id="ArtDim" name="ArtDim" type="text" class="form-control" v-model="ArtDim" :disabled=false @change="setArt_Dimensions()"></b-form-input>
</b-input-group>
<b-input-group id="ChReturn" :prepend="$t('Modules.ET.Settings.ChReturn')" class="mt-3">
<b-tooltip target="ChReturn" triggers="hover">
{{ $t('Modules.ET.Settings.ChReturn_TT') }}
</b-tooltip>
<b-form-input id="ChReturn" name="ChReturn" type="text" class="form-control" v-model="ChReturn" :disabled=false @change="setChReturn()"></b-form-input>
</b-input-group>
<b-input-group id="ChNewLine" :prepend="$t('Modules.ET.Settings.ChNewLine')" class="mt-3">
<b-tooltip target="ChNewLine" triggers="hover">
{{ $t('Modules.ET.Settings.ChNewLine_TT') }}
</b-tooltip>
<b-form-input id="ChNewLine" name="ChNewLine" type="text" class="form-control" v-model="ChNewLine" :disabled=false @change="setChNewLine()"></b-form-input>
</b-input-group>
<b-form-group id="b-form-group">
<b-form-checkbox-group
stacked
@ -72,7 +84,9 @@
{ text: i18n.t('Modules.ET.Settings.ExportToExcel'), value: 'ExpXLSX', disabled: true },
{ text: i18n.t('Modules.ET.Settings.OrgTitleNull'), value: 'OrgTitleNull' },
{ text: i18n.t('Modules.ET.Settings.SortTitleNull'), value: 'SortTitleNull' }
]
],
ChReturn: wtconfig.get('ET.ChReturn', '<RETURN>'),
ChNewLine: wtconfig.get('ET.ChNewLine', '<NEWLINE>')
};
},
methods: {
@ -117,6 +131,12 @@
setArraySep: function(){
wtconfig.set('ET.ArraySep', this.ArraySep)
},
setChReturn: function(){
wtconfig.set('ET.ChReturn', this.ChReturn)
},
setChNewLine: function(){
wtconfig.set('ET.ChNewLine', this.ChNewLine)
},
setTextQualifierCSV: function(){
wtconfig.set('ET.TextQualifierCSV', this.TextQualifierCSV)
},

View file

@ -164,8 +164,7 @@
"Video Stream Title",
"Video Stream Width",
"View Count",
"Writers",
"Year"
"Writers"
]
}
}

View file

@ -263,7 +263,8 @@
"call": 2,
"type": "array",
"subtype": "string",
"subkey": "$.requiredBandwidths"
"subkey": "$.requiredBandwidths",
"include": "includeBandwidths=1"
},
"Audio Stream Sampling Rate":
{
@ -319,13 +320,15 @@
{
"key": "$..Chapter[*]",
"call": 2,
"type": "array-count"
"type": "array-count",
"include": "includeChapters=1"
},
"Chapter Source":
{
"key": "$.chapterSource",
"call": 2,
"type": "string"
"type": "string",
"include": "includeChapters=1"
},
"Chapter Title":
{
@ -333,7 +336,8 @@
"call": 2,
"type": "array",
"subtype": "string",
"subkey": "$.tag"
"subkey": "$.tag",
"include": "includeChapters=1"
},
"Collections":
{
@ -435,61 +439,71 @@
{
"key": "$.Extras.size",
"call": 2,
"type": "int"
"type": "int",
"include": "includeExtras=1"
},
"Extras-behindthescenes":
{
"key": "$..Extras.Metadata[?(@.subtype=='behindTheScenes')].ratingKey",
"call": 2,
"type": "array-count"
"type": "array-count",
"include": "includeExtras=1"
},
"Extras-deleted":
{
"key": "$..Extras.Metadata[?(@.subtype=='deleted')].ratingKey",
"call": 2,
"type": "array-count"
"type": "array-count",
"include": "includeExtras=1"
},
"Extras-featurette":
{
"key": "$..Extras.Metadata[?(@.subtype=='featurette')].ratingKey",
"call": 2,
"type": "array-count"
"type": "array-count",
"include": "includeExtras=1"
},
"Extras-interview":
{
"key": "$..Extras.Metadata[?(@.subtype=='interview')].ratingKey",
"call": 2,
"type": "array-count"
"type": "array-count",
"include": "includeExtras=1"
},
"Extras-music video":
{
"key": "$..Extras.Metadata[?(@.subtype=='musicVideo')].ratingKey",
"call": 2,
"type": "array-count"
"type": "array-count",
"include": "includeExtras=1"
},
"Extras-scene":
{
"key": "$..Extras.Metadata[?(@.subtype=='scene')].ratingKey",
"call": 2,
"type": "array-count"
"type": "array-count",
"include": "includeExtras=1"
},
"Extras-sceneOrSample":
{
"key": "$..Extras.Metadata[?(@.subtype=='sceneOrSample')].ratingKey",
"call": 2,
"type": "array-count"
"type": "array-count",
"include": "includeExtras=1"
},
"Extras-short":
{
"key": "$..Extras.Metadata[?(@.subtype=='short')].ratingKey",
"call": 2,
"type": "array-count"
"type": "array-count",
"include": "includeExtras=1"
},
"Extras-trailer":
{
"key": "$..Extras.Metadata[?(@.subtype=='trailer')].ratingKey",
"call": 2,
"type": "array-count"
"type": "array-count",
"include": "includeExtras=1"
},
"Filters":
{
@ -819,7 +833,8 @@
"call": 2,
"type": "array",
"subtype": "string",
"subkey": "$.accessible"
"subkey": "$.accessible",
"include": "checkFiles=1"
},
"Part Container":
{
@ -852,7 +867,8 @@
"call": 2,
"type": "array",
"subtype": "string",
"subkey": "$.exists"
"subkey": "$.exists",
"include": "checkFiles=1"
},
"Part File":
{
@ -926,7 +942,8 @@
"call": 2,
"type": "array",
"subtype": "string",
"subkey": "$.requiredBandwidths"
"subkey": "$.requiredBandwidths",
"include": "includeBandwidths=1"
},
"Part Size":
{
@ -1159,7 +1176,8 @@
"call": 2,
"type": "array",
"subtype": "string",
"subkey": "requiredBandwidths"
"subkey": "requiredBandwidths",
"include": "includeBandwidths=1"
},
"Subtitle Stream Selected":
{
@ -1466,7 +1484,8 @@
"call": 2,
"type": "array",
"subtype": "string",
"subkey": "requiredBandwidths"
"subkey": "requiredBandwidths",
"include": "includeBandwidths=1"
},
"Video Stream Scan Type":
{

View file

@ -36,6 +36,11 @@
"Level 2": 1,
"All": 2,
"all": 2
},
"Include": {
"Level 1": "",
"Level 2": "",
"all": "checkFiles=1&includeExtras=1&includeBandwidths=1&includeChapters=1"
}
},
"1" : {
@ -49,7 +54,15 @@
"Level 2": 1,
"All": 2,
"all": 2
},
"Include": {
"Level 11": "",
"Level 21": "",
"all": "checkFiles=1&includeExtras=1&includeBandwidths=1&includeChapters=1",
"Missing1": "includeAllConcerts=1&includeChildren=1&includeConcerts=1&includeFields=1&includeGeolocation=1&includeLoudnessRamps=1&includeMarkers=1&includeOnDeck=1&includePopularLeaves=1&includePreferences=1&includeRelated=1&includeRelatedCount=1&includeReviews=1&includeStations=1",
"Everything1": "checkFiles=1&includeAllConcerts=1&includeBandwidths=1&includeChapters=1&includeChildren=1&includeConcerts=1&includeExtras=1&includeFields=1&includeGeolocation=1&includeLoudnessRamps=1&includeMarkers=1&includeOnDeck=1&includePopularLeaves=1&includePreferences=1&includeRelated=1&includeRelatedCount=1&includeReviews=1&includeStations=1"
}
},
"2": {
"levels": {
@ -62,6 +75,12 @@
"Level 2": 1,
"All": 2,
"all": 2
},
"Include": {
"Level 1": "",
"Level 2": "",
"1all": "checkFiles=1&includeExtras=1&includeBandwidths=1&includeChapters=1,includeAllConcerts=1&includeChildren=1&includeConcerts=1&includeFields=1&includeGeolocation=1&includeLoudnessRamps=1&includeMarkers=1&includeOnDeck=1&includePopularLeaves=1&includePreferences=1&includeRelated=1&includeRelatedCount=1&includeReviews=1&includeStations=1",
"all": ""
}
},
"10": {

View file

@ -36,6 +36,7 @@
"Genre",
"IMDB ID",
"IMDB Link",
"Item Counts",
"Key",
"Labels",
"Location",

View file

@ -4,7 +4,7 @@ var defFields = JSON.parse(JSON.stringify(require('./../defs/def-Fields.json')))
const log = require('electron-log');
console.log = log.log;
const defpostURI = '?checkFiles=1&includeRelated=0&includeExtras=1&includeBandwidths=1&includeChapters=1'
//const defpostURI = '?checkFiles=1&includeRelated=0&includeExtras=1&includeBandwidths=1&includeChapters=1'
import {wtconfig, wtutils} from '../../General/wtutils';
@ -157,7 +157,7 @@ const et = new class ET {
this.StartTime = null,
this.EndTime = null,
this.OutFile = null,
this.revRawMsgType = {
this.revRawMsgTypeOLDDELGED = {
1: 'Status',
2: 'Info',
3: 'Chuncks',
@ -165,10 +165,10 @@ const et = new class ET {
5: 'OutFile',
6: 'StartTime',
7: 'EndTime',
8: 'TimeElapsed',
8: '1TimeElapsed',
9: 'RunningTime'
},
this.msgType = {
this.msgTypeOLDDELGED = {
1: i18n.t("Modules.ET.Status.Names.Status"),
2: i18n.t("Modules.ET.Status.Names.Info"),
3: i18n.t("Modules.ET.Status.Names.Chuncks"),
@ -229,22 +229,11 @@ const et = new class ET {
log.debug(`Pushed chunk as ${JSON.stringify(chuncks)}`)
idx = idx + step;
} while (size > 1);
log.silly(`SectionData to return is:`);
log.silly(JSON.stringify(sectionData));
log.debug(`SectionData to return is:`);
log.debug(JSON.stringify(sectionData));
return sectionData;
}
async GEDOLD_getItemData({baseURL, accessToken, element, postURI=defpostURI})
{
const url = baseURL + element + postURI;
this.PMSHeader["X-Plex-Token"] = accessToken;
log.verbose(`etHelper (getItemData): Calling url in getItemData: ${url}`)
let response = await fetch(url, { method: 'GET', headers: this.PMSHeader});
let resp = await response.json();
log.silly(`etHelper (getItemData): Response in getItemData: ${JSON.stringify(resp)}`)
return resp
}
getRealLevelName(level, libType) {
// First get the real name of the level, and not just the display name
let levelName

View file

@ -29,8 +29,8 @@ function isEmptyObj(obj) {
function setQualifier( {str:str})
{
const validQ = ["`", "'", "\""];
log.silly(`etHelper (setQualifier): String is: ${str}`);
if (str.indexOf(wtconfig.get('ET.TextQualifierCSV', 'N/A')) >= 0)
let result = wtconfig.get('ET.TextQualifierCSV', 'N/A');
if (str.indexOf(wtconfig.get('ET.TextQualifierCSV', 'N/A')) > -1)
{
let selectedQ;
for(const val of validQ) {
@ -40,19 +40,27 @@ function setQualifier( {str:str})
break;
}
}
log.silly(`etHelper (setQualifier) string contained Qualifier`);
str = str.replaceAll(wtconfig.get('ET.TextQualifierCSV'), selectedQ);
}
if (wtconfig.get('ET.TextQualifierCSV', 'N/A') == '"')
{
str = `"${str}"`
result = str.replaceAll(wtconfig.get('ET.TextQualifierCSV', 'N/A'), selectedQ);
// Now remove fancy Return
const ChReturn = wtconfig.get('ET.ChReturn', '');
if ( ChReturn != '')
{
result = result.replaceAll('\r', ChReturn);
}
// Now remove fancy NewLine
const ChNewLine = wtconfig.get('ET.ChNewLine', '');
if ( ChNewLine != '')
{
result = result.replaceAll('\r', ChNewLine);
}
result = result.replaceAll('\n', wtconfig.get('ET.ChNewLine', '<NEWLINE>'));
}
else
{
str = `${wtconfig.get('ET.TextQualifierCSV', 'N/A')}${str}${wtconfig.get('ET.TextQualifierCSV', 'N/A')}`
result = `${wtconfig.get('ET.TextQualifierCSV', 'N/A')}${str}${wtconfig.get('ET.TextQualifierCSV', 'N/A')}`
}
log.silly(`etHelper (setQualifier): Returning: ${str}`);
return str;
log.debug(`etHelper (setQualifier): Got: _WTNG_${str}_WTNG_ and returning ${result}`);
return result;
}
//#endregion
@ -200,10 +208,11 @@ const etHelper = new class ETHELPER {
}
async postProcess( {name, val, title=""} ){
log.silly(`ETHelper(postProcess): Val is: ${JSON.stringify(val)}`);
log.silly(`ETHelper(postProcess): name is: ${name}`);
log.silly(`ETHelper(postProcess): title is: ${title}`);
log.debug(`ETHelper(postProcess): Val is: ${JSON.stringify(val)}`);
log.debug(`ETHelper(postProcess): name is: ${name}`);
log.debug(`ETHelper(postProcess): title is: ${title}`);
let retArray = [];
let guidArr;
let x, retVal, start, strStart, end, result;
try {
const valArray = val.split(wtconfig.get('ET.ArraySep', ' * '));
@ -245,9 +254,9 @@ const etHelper = new class ETHELPER {
case "Original Title":
if (wtconfig.get('ET.OrgTitleNull'))
{
log.silly(`We need to override Original Titel, if not avail`);
log.silly(`Got Original title as: ${val}`);
log.silly(`Alternative might be title as: ${title}`);
log.debug(`We need to override Original Titel, if not avail`);
log.debug(`Got Original title as: ${val}`);
log.debug(`Alternative might be title as: ${title}`);
// Override with title if not found
if (val == wtconfig.get('ET.NotAvail'))
{
@ -378,31 +387,14 @@ const etHelper = new class ETHELPER {
}
break;
case "TVDB ID":
if (val == wtconfig.get('ET.NotAvail'))
{
retVal = val;
break;
retVal = wtconfig.get('ET.NotAvail');
guidArr = val.split(wtconfig.get('ET.ArraySep'));
for(const item of guidArr) {
if ( item.startsWith("tvdb://") )
{
retVal = item.substring(7);
}
}
start = val.indexOf("tvdb://");
if (start == -1)
{
retVal = wtconfig.get('ET.NotAvail');
break;
}
strStart = val.substring(start);
end = strStart.indexOf(wtconfig.get('ET.ArraySep'));
result = ''
if (end == -1)
{ result = strStart.substring(7) }
else
{
result = strStart.substring(7, end)
}
if (result.endsWith(wtconfig.get('ET.TextQualifierCSV')))
{
result = result.slice(0,-1);
}
retVal = setQualifier( {str:result} );
break;
case "TVDB ID (Legacy)":
if (val == wtconfig.get('ET.NotAvail'))
@ -439,55 +431,24 @@ const etHelper = new class ETHELPER {
}
break;
case "TMDB ID":
if (val == wtconfig.get('ET.NotAvail'))
{
retVal = val;
break;
retVal = wtconfig.get('ET.NotAvail');
guidArr = val.split(wtconfig.get('ET.ArraySep'));
for(const item of guidArr) {
if ( item.startsWith("tmdb://") )
{
retVal = item.substring(7);
}
}
start = val.indexOf("tmdb://");
if (start == -1)
{
retVal = wtconfig.get('ET.NotAvail');
break;
}
strStart = val.substring(start);
end = strStart.indexOf(wtconfig.get('ET.ArraySep'));
result = ''
if (end == -1)
{
result = strStart.substring(7);
}
else
{
result = strStart.substring(7, end)
}
if (result.endsWith(wtconfig.get('ET.TextQualifierCSV')))
{
result = result.slice(0,-1);
}
retVal = setQualifier( {str:result} );
break;
case "TMDB Link":
if (val == wtconfig.get('ET.NotAvail'))
{
retVal = val;
break;
retVal = wtconfig.get('ET.NotAvail');
guidArr = val.split(wtconfig.get('ET.ArraySep'));
for(const item of guidArr) {
if ( item.startsWith("tmdb://") )
{
retVal = result = 'https://www.themoviedb.org/movie/' + item.substring(7);
}
}
start = val.indexOf("tmdb://");
strStart = val.substring(start);
end = strStart.indexOf(wtconfig.get('ET.ArraySep'));
result = ''
if (end == -1)
{ result = strStart.substring(7) }
else
{ result = strStart.substring(7, end) }
result = 'https://www.themoviedb.org/movie/' + result;
if (result.endsWith(wtconfig.get('ET.TextQualifierCSV')))
{
result = result.slice(0,-1);
}
retVal = setQualifier( {str:result} );
break;
default:
log.error(`postProcess no hit for: ${name}`)
@ -504,7 +465,7 @@ const etHelper = new class ETHELPER {
this.Settings.currentItem +=1;
this.updateStatusMsg(this.RawMsgType.Items, i18n.t('Modules.ET.Status.ProcessItem', {count: this.Settings.count, total: this.Settings.endItem}));
log.debug(`Start addRowToTmp item ${this.Settings.currentItem} (Switch to Silly log to see contents)`)
log.silly(`Data is: ${JSON.stringify(data)}`)
log.debug(`Data is: ${JSON.stringify(data)}`)
let name, key, type, subType, subKey, doPostProc;
let date, year, month, day, hours, minutes, seconds;
let val, array, i, valArray, valArrayVal
@ -630,7 +591,7 @@ const etHelper = new class ETHELPER {
if ( doPostProc )
{
const title = JSONPath({path: String('$.title'), json: data})[0];
log.silly(`ETHelper(addRowToTmp doPostProc): Name is: ${name} - Title is: ${title} - Val is: ${val}`)
log.debug(`ETHelper(addRowToTmp doPostProc): Name is: ${name} - Title is: ${title} - Val is: ${val}`)
val = await this.postProcess( {name: name, val: val, title: title} );
}
// Here we add qualifier, if not a number
@ -649,24 +610,20 @@ const etHelper = new class ETHELPER {
// Remove last internal separator
str = str.substring(0,str.length-etHelper.intSep.length);
str = str.replaceAll(this.intSep, wtconfig.get("ET.ColumnSep", '|'));
this.updateStatusMsg( this.RawMsgType.TimeElapsed, await this.getRunningTimeElapsed());
log.silly(`etHelper (addRowToTmp) returned: ${JSON.stringify(str)}`);
log.debug(`etHelper (addRowToTmp) returned: ${JSON.stringify(str)}`);
return str;
}
async getItemDetails( { key })
{
const url = this.Settings.baseURL + key + this.#_defpostURI;
const url = this.Settings.baseURL + key + '?' + this.getIncludeInfo();
this.PMSHeader["X-Plex-Token"] = this.Settings.accessToken;
log.verbose(`Calling url in getItemDetails: ${url}`)
let response = await fetch(url, { method: 'GET', headers: this.PMSHeader});
let resp = await response.json();
resp = JSONPath({path: '$.MediaContainer.Metadata.*', json: resp})[0];
log.silly(`Response in getItemData: ${JSON.stringify(resp)}`);
log.debug(`Response in getItemDetails: ${JSON.stringify(resp)}`);
return resp
}
@ -732,15 +689,14 @@ const etHelper = new class ETHELPER {
let chunck; // placeholder for items fetched
let chunckItems; // Array of items in the chunck
this.Settings.element = this.getElement();
let postURI = this.getPostURI();
// let postURI = this.getPostURI();
// Get the fields for this level
do // Walk section in steps
{
chunck = await this.getItemData({
postURI: postURI + idx});
//chunck = await this.getItemData({postURI: postURI + idx});
chunck = await this.getSectionData();
size = JSONPath({path: '$.MediaContainer.size', json: chunck});
log.silly(`etHelper(populateExpFiles): Fetched a chunck with number of items as ${size} and contained: ${JSON.stringify(chunck)}`);
log.debug(`etHelper(populateExpFiles): Fetched a chunck with number of items as ${size} and contained: ${JSON.stringify(chunck)}`);
if ( this.Settings.libType == this.ETmediaType.Libraries)
{
chunckItems = JSONPath({path: '$.MediaContainer.Directory.*', json: chunck});
@ -753,6 +709,7 @@ const etHelper = new class ETHELPER {
// Walk each item retrieved
for (var item in chunckItems)
{
//ProcessItem
if (parseInt(this.Settings.call, 10) === 1)
{
// Let's get the needed row
@ -797,8 +754,8 @@ const etHelper = new class ETHELPER {
async getSectionSize()
{
log.silly(`etHelper (getItemData): selType: ${this.Settings.selType}`)
log.silly(`etHelper (getItemData): libTypeSec: ${this.Settings.libTypeSec}`)
log.debug(`etHelper (getSectionSize): selType: ${this.Settings.selType}`)
log.debug(`etHelper (getSectionSize): libTypeSec: ${this.Settings.libTypeSec}`)
let url = '';
switch(this.Settings.selType) {
case this.ETmediaType.Playlist_Video:
@ -838,19 +795,32 @@ const etHelper = new class ETHELPER {
let response = await fetch(url, { method: 'GET', headers: this.PMSHeader});
let resp = await response.json();
var totalSize = JSONPath({path: '$..totalSize', json: resp})[0];
log.silly(`Response in getSectionSize: ${totalSize}`);
log.debug(`Response in getSectionSize: ${totalSize}`);
return totalSize;
}
async getItemData({ postURI=this.#_defpostURI })
async getSectionData()
{
log.silly(`etHelper (getItemData): Element is: ${this.Settings.element}`)
log.debug(`etHelper (getSectionData): Element is: ${this.Settings.element}`)
//const url = this.Settings.baseURL + this.Settings.element + '?' + this.getPostURI() + this.Settings.count;
const url = this.Settings.baseURL + this.Settings.element + this.getPostURI() + this.Settings.count;
this.PMSHeader["X-Plex-Token"] = this.Settings.accessToken;
log.verbose(`etHelper (getSectionData): Calling url in getSectionData: ${url}`)
let response = await fetch(url, { method: 'GET', headers: this.PMSHeader});
let resp = await response.json();
log.debug(`etHelper (getSectionData): Response in getSectionData: ${JSON.stringify(resp)}`)
return resp
}
async OLDDELGed_getItemData({ postURI=this.#_defpostURI })
{
log.debug(`etHelper (getItemData): Element is: ${this.Settings.element}`)
const url = this.Settings.baseURL + this.Settings.element + postURI;
this.PMSHeader["X-Plex-Token"] = this.Settings.accessToken;
log.verbose(`etHelper (getItemData): Calling url in getItemData: ${url}`)
let response = await fetch(url, { method: 'GET', headers: this.PMSHeader});
let resp = await response.json();
log.silly(`etHelper (getItemData): Response in getItemData: ${JSON.stringify(resp)}`)
log.debug(`etHelper (getItemData): Response in getItemData: ${JSON.stringify(resp)}`)
return resp
}
@ -1171,11 +1141,34 @@ const etHelper = new class ETHELPER {
return element;
}
getIncludeInfo(){
console.log('Ged 33-0: ' + this.Settings.libTypeSec + ' -*- ' + this.Settings.levelName)
let includeInfo;
try {
includeInfo = defLevels[this.Settings.libTypeSec]['Include'][this.Settings.levelName];
}
catch (error) {
includeInfo = ''
}
if (includeInfo == 'undefined')
{
includeInfo = ''
}
if (includeInfo == null)
{
includeInfo = ''
}
log.debug(`etHelper (getInclude): returning: ${includeInfo}`);
return includeInfo;
}
getPostURI(){
let postURI;
let postURI, includeInfo;
// Find LibType steps
const step = wtconfig.get("PMS.ContainerSize." + this.Settings.libType, 20);
log.debug(`Got Step size as: ${step}`);
log.debug(`etHelper (getPostURI): Got Step size as: ${step}`);
log.debug(`etHelper (getPostURI): libType is: ${this.Settings.libType}`);
log.debug(`etHelper (getPostURI): libTypeSec is: ${this.Settings.libTypeSec}`);
switch (this.Settings.libType) {
case this.ETmediaType.Photo:
postURI = `?addedAt>>=-2208992400&X-Plex-Container-Size=${step}&type=${this.Settings.libTypeSec}&${this.uriParams}&X-Plex-Container-Start=`;
@ -1199,9 +1192,18 @@ const etHelper = new class ETHELPER {
postURI = `?X-Plex-Container-Size=${step}&X-Plex-Container-Start=`
break;
default:
postURI = `?X-Plex-Container-Size=${step}&type=${this.Settings.libTypeSec}&${this.uriParams}&X-Plex-Container-Start=`;
includeInfo = this.getIncludeInfo();
log.debug(`etHelper (getPostURI): includeInfo is: ${includeInfo}`);
if (includeInfo != '')
{
postURI = `?X-Plex-Container-Size=${step}&type=${this.Settings.libTypeSec}&${includeInfo}&X-Plex-Container-Start=`;
}
else
{
postURI = `?X-Plex-Container-Size=${step}&type=${this.Settings.libTypeSec}&X-Plex-Container-Start=`;
}
}
log.debug(`Got postURI as ${postURI}`);
log.debug(`etHelper (getPostURI): Got postURI as ${postURI}`);
return postURI;
}
@ -1214,17 +1216,15 @@ const etHelper = new class ETHELPER {
{
this.Settings.libType = etHelper.Settings.libTypeSec;
}
log.silly(`etHelper (getLevelFields) libType is: ${this.Settings.libType}`);
log.debug(`etHelper (getLevelFields) libTypeSec is: ${this.Settings.libTypeSec}`);
// We need to load fields and defs into def var
switch(this.Settings.libType) {
switch(this.Settings.libTypeSec) {
case etHelper.ETmediaType.Movie:
// code block
def = JSON.parse(JSON.stringify(require('./../defs/def-Movie.json')));
break;
def = JSON.parse(JSON.stringify(require('./../defs/def-Movie.json')));
break;
case etHelper.ETmediaType.Episode:
// code block
def = JSON.parse(JSON.stringify(require('./../defs/def-Episode.json')));
break;
def = JSON.parse(JSON.stringify(require('./../defs/def-Episode.json')));
break;
case etHelper.ETmediaType.Show:
// code block
def = JSON.parse(JSON.stringify(require('./../defs/def-Show.json')));
@ -1275,18 +1275,19 @@ const etHelper = new class ETHELPER {
{
this.Settings.Level = 'all';
}
let levels = def[this.Settings.libType.toString()]['level'][this.Settings.Level];
//let levels = def[this.Settings.libType.toString()]['level'][this.Settings.levelName];
let levels = def[this.Settings.libTypeSec.toString()]['level'][this.Settings.Level];
if (levels == undefined)
{
// We are dealing with a custom level
levels = wtconfig.get(`ET.CustomLevels.${this.Settings.libTypeSec}.level.${this.Settings.levelName}`);
log.silly(`etHelper (getLevelFields) Custom level detected as: ${JSON.stringify(levels)}`);
log.debug(`etHelper (getLevelFields) Custom level detected as: ${JSON.stringify(levels)}`);
}
Object.keys(levels).forEach(function(key) {
//out.push(wtconfig.get(`ET.TextQualifierCSV`, "\"") + levels[key] + wtconfig.get(`ET.TextQualifierCSV`, "\""))
out.push(levels[key])
// Skip picture export fields
if ( !["Export Art", "Export Posters"].includes(levels[key]) )
{
out.push(levels[key])
}
});
resolve(out);
});
@ -1322,7 +1323,7 @@ const etHelper = new class ETHELPER {
// Public methode to get the Header
async getFieldHeader() {
log.info('FieldHeader requested');
log.info('etHelper (getFieldHeader): FieldHeader requested');
try{
if (isEmptyObj(this.#_FieldHeader))
{

View file

@ -291,6 +291,12 @@ const wtutils = new class WTUtils {
wtconfig.set('PMS.ContainerSize.3001', 20)
}
// ET Settings
if ( wtconfig.get('ET.ChReturn', 'N/A') == 'N/A' ){
wtconfig.set('ET.ChReturn', '<RETURN>')
}
if ( wtconfig.get('ET.ChNewLine', 'N/A') == 'N/A' ){
wtconfig.set('ET.ChNewLine', '<NEWLINE>')
}
if ( wtconfig.get('ET.TextQualifierCSV', 'N/A') == 'N/A' ){
wtconfig.set('ET.TextQualifierCSV', '"')
}

View file

@ -312,6 +312,18 @@
case "20Mb":
size = "20971520";
break;
case "40Mb":
size = "41943040";
break;
case "60Mb":
size = "62914560";
break;
case "100Mb":
size = "104857600";
break;
case "200Mb":
size = "209715200";
break;
default:
size = "1048576"
}
@ -329,7 +341,7 @@
return options;
},
LogLevelSizes: function() {
const options = ['1Mb', '2Mb', '4Mb', '8Mb', '10Mb', '20Mb'];
const options = ['1Mb', '2Mb', '4Mb', '8Mb', '10Mb', '20Mb', '40Mb', '60Mb', '100Mb', '200Mb'];
return options;
},
BetaLevels: function() {

View file

@ -45,54 +45,12 @@ const mutations = {
};
const actions = {
async fetchSections({ commit, getters }) {
log.info("fetchSections called")
var baseURL = getters.getSelectedServerAddress
var accessToken = getters.getSelectedServerToken
commit('UPDATE_SECTIONS', await et.getSections(baseURL, accessToken))
}
/*
,
exportMedias({ getters }) {
var baseURL = getters.getSelectedServerAddress;
var accessToken = getters.getSelectedServerToken;
var libType = getters.getLibType;
var pListType = getters.getSelectedLibTypeSec;
let levelName;
var libName = et.getLibDisplayName(getters.getSelectedSection, getters.getPmsSections);
if ([ et.ETmediaType.Libraries, et.ETmediaType.Playlists].indexOf(libType) > -1)
{
levelName = 'All'
}
else
{
levelName = et.getLevelDisplayName(getters.getSelectedExportLevel, libType);
} */
/*
excel2.createOutFile( {
libName: libName,
level: levelName,
libType: libType,
baseURL: baseURL,
accessToken: accessToken,
exType: libType,
pListType: pListType,
libTypeSec: getters.getSelectedLibTypeSec
} );
*/
/*
etHelper.createOutFile({
libName: libName,
level: levelName,
libType: libType,
baseURL: baseURL,
accessToken: accessToken,
exType: libType,
pListType: pListType,
libTypeSec: getters.getSelectedLibTypeSec
} );
} */
async fetchSections({ commit, getters }) {
log.info("fetchSections called")
var baseURL = getters.getSelectedServerAddress
var accessToken = getters.getSelectedServerToken
commit('UPDATE_SECTIONS', await et.getSections(baseURL, accessToken))
}
}
const getters = {