This commit is contained in:
Tommy Mikkelsen 2022-05-11 23:01:50 +02:00
parent e8cf4f576a
commit c255284758
5 changed files with 64 additions and 41 deletions

View file

@ -1,5 +1,18 @@
# ![Logo](https://github.com/WebTools-NG/WebTools-NG/blob/master/src/assets/WebTools-48x48.png) WebTools-ng Change log # ![Logo](https://github.com/WebTools-NG/WebTools-NG/blob/master/src/assets/WebTools-48x48.png) WebTools-ng Change log
## V0.3.17 (Not Yet Released)
**Note**: This version is a Beta version
**Note 2**: 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**:
* [#486 ET Modules Year on shows not working](https://github.com/WebTools-NG/WebTools-NG/issues/486)
## V0.3.16 (20220511) ## V0.3.16 (20220511)
**Note**: This version is a Beta version **Note**: This version is a Beta version

View file

@ -1,7 +1,7 @@
{ {
"name": "webtools-ng", "name": "webtools-ng",
"productName": "WebTools-NG", "productName": "WebTools-NG",
"version": "0.3.16", "version": "0.3.17",
"description": "WebTools Next Generation 4 Plex", "description": "WebTools Next Generation 4 Plex",
"author": "dane22 & CPSO", "author": "dane22 & CPSO",
"license": "MPL-2.0", "license": "MPL-2.0",

View file

@ -78,7 +78,6 @@
"Include": { "Include": {
"Level 1": "", "Level 1": "",
"Level 2": "", "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": "" "all": ""
} }
}, },

View file

@ -12,7 +12,8 @@
"Summary", "Summary",
"Audience Rating", "Audience Rating",
"Content Rating", "Content Rating",
"Studio" "Studio",
"Year"
], ],
"all": [ "all": [
"Added", "Added",

View file

@ -62,7 +62,7 @@ function setQualifier( {str:str})
{ {
result = `${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.debug(`etHelper (setQualifier) - Got: _WTNG_${str}_WTNG_ and returning ${result}`); log.debug(`[etHelper.js] (setQualifier) - Got: _WTNG_${str}_WTNG_ and returning ${result}`);
return result; return result;
} }
@ -71,7 +71,7 @@ function setQualifier( {str:str})
function cleanupSuggestedFile( tmpFileName ) function cleanupSuggestedFile( tmpFileName )
{ {
const unWantedChars = '.-*_[](){}'; const unWantedChars = '.-*_[](){}';
log.verbose(`etHelper (cleanupSuggestedFile) - starting Param: ${tmpFileName}`); log.verbose(`[ethelper.js] (cleanupSuggestedFile) - starting Param: ${tmpFileName}`);
// Now replace square brackets if present with a dot // Now replace square brackets if present with a dot
tmpFileName = tmpFileName.replaceAll("[", "."); tmpFileName = tmpFileName.replaceAll("[", ".");
tmpFileName = tmpFileName.replaceAll("]", "."); tmpFileName = tmpFileName.replaceAll("]", ".");
@ -93,7 +93,7 @@ function cleanupSuggestedFile( tmpFileName )
// Now delete empty brackets // Now delete empty brackets
tmpFileName = tmpFileName.replaceAll("()", ""); tmpFileName = tmpFileName.replaceAll("()", "");
tmpFileName = tmpFileName.replaceAll("{}", ""); tmpFileName = tmpFileName.replaceAll("{}", "");
log.verbose(`etHelper (cleanupSuggestedFile) - Returning: ${tmpFileName}`); log.verbose(`[ethelper.js] (cleanupSuggestedFile) - Returning: ${tmpFileName}`);
return tmpFileName; return tmpFileName;
} }
@ -126,8 +126,8 @@ function getSuggestedYear( data )
// Returns a suggested id for a media // Returns a suggested id for a media
function getSuggestedId( data ) function getSuggestedId( data )
{ {
log.verbose(`etHelper (getSuggestedId) - Started. To see Param, switch to Silly logging`); log.verbose(`[ethelper.js] (getSuggestedId) - Started. To see Param, switch to Silly logging`);
log.silly(`etHelper (getSuggestedId) - Starting with param: ${JSON.stringify(data)}`); log.silly(`[ethelper.js] (getSuggestedId) - Starting with param: ${JSON.stringify(data)}`);
let imdb = String(JSONPath({path: "$.data.Guid[?(@.id.startsWith('imdb'))].id", json: data})); let imdb = String(JSONPath({path: "$.data.Guid[?(@.id.startsWith('imdb'))].id", json: data}));
let tmdb = String(JSONPath({path: "$.data.Guid[?(@.id.startsWith('tmdb'))].id", json: data})); let tmdb = String(JSONPath({path: "$.data.Guid[?(@.id.startsWith('tmdb'))].id", json: data}));
let tvdb = String(JSONPath({path: "$.data.Guid[?(@.id.startsWith('tvdb'))].id", json: data})); let tvdb = String(JSONPath({path: "$.data.Guid[?(@.id.startsWith('tvdb'))].id", json: data}));
@ -153,9 +153,9 @@ function getSuggestedId( data )
{ {
selId = wtconfig.get("ET.SelectedShowsID", "tmdb"); selId = wtconfig.get("ET.SelectedShowsID", "tmdb");
} }
log.silly(`etHelper (getSuggestedId) - imdb ID: ${imdb}`); log.silly(`[ethelper.js] (getSuggestedId) - imdb ID: ${imdb}`);
log.silly(`etHelper (getSuggestedId) - tmdb ID: ${tmdb}`); log.silly(`[ethelper.js] (getSuggestedId) - tmdb ID: ${tmdb}`);
log.silly(`etHelper (getSuggestedId) - tvdb ID: ${tvdb}`); log.silly(`[ethelper.js] (getSuggestedId) - tvdb ID: ${tvdb}`);
let Id; let Id;
switch(selId) { switch(selId) {
@ -183,7 +183,7 @@ function getSuggestedId( data )
} }
break; break;
} }
log.debug(`etHelper (getSuggestedId) - Returning: "imdb": ${imdb}, "tmdb": ${tmdb}, "tvdb": ${tvdb}, "selId": ${Id}`); log.debug(`[ethelper.js] (getSuggestedId) - Returning: "imdb": ${imdb}, "tmdb": ${tmdb}, "tvdb": ${tvdb}, "selId": ${Id}`);
return {"imdb": imdb, "tmdb": tmdb, "tvdb": tvdb, "selId": Id}; return {"imdb": imdb, "tmdb": tmdb, "tvdb": tvdb, "selId": Id};
} }
@ -195,19 +195,19 @@ function stripYearFromFileName( tmpFileName, year ){
// Returns a string stripped for ID's // Returns a string stripped for ID's
function stripIdFromFileName( param ){ function stripIdFromFileName( param ){
log.debug(`etHelper (stripIdFromFileName) - starting function with param as: ${JSON.stringify(param)}`); log.debug(`[ethelper.js] (stripIdFromFileName) - starting function with param as: ${JSON.stringify(param)}`);
let tmpFileName = param.tmpFileName; let tmpFileName = param.tmpFileName;
let re; let re;
const imdb = param.imdb.slice(7); const imdb = param.imdb.slice(7);
const tmdb = param.tmdb.slice(7); const tmdb = param.tmdb.slice(7);
const tvdb = param.tvdb.slice(7); const tvdb = param.tvdb.slice(7);
// Remove IMDB id // Remove IMDB id
log.debug(`etHelper (stripIdFromFileName) - Imdb string is : ${imdb}`); log.debug(`[ethelper.js] (stripIdFromFileName) - Imdb string is : ${imdb}`);
re = new RegExp(`\\b${imdb}\\b`, 'gi'); re = new RegExp(`\\b${imdb}\\b`, 'gi');
tmpFileName = tmpFileName.replace(re, ""); tmpFileName = tmpFileName.replace(re, "");
log.debug(`etHelper (stripIdFromFileName) - After imdb id is removed: ${tmpFileName}`); log.debug(`[ethelper.js] (stripIdFromFileName) - After imdb id is removed: ${tmpFileName}`);
tmpFileName = tmpFileName.replace(/imdb-/i, ''); tmpFileName = tmpFileName.replace(/imdb-/i, '');
log.debug(`etHelper (stripIdFromFileName) - After imdb string is removed: ${tmpFileName}`); log.debug(`[ethelper.js] (stripIdFromFileName) - After imdb string is removed: ${tmpFileName}`);
// Remove TMDB id // Remove TMDB id
re = new RegExp(`\\b${tmdb}\\b`, 'gi'); re = new RegExp(`\\b${tmdb}\\b`, 'gi');
tmpFileName = tmpFileName.replace(re, ""); tmpFileName = tmpFileName.replace(re, "");
@ -264,7 +264,7 @@ function stripTitleFromFileName( tmpFileName, title )
// Strip parts from a filename, and return multiple values // Strip parts from a filename, and return multiple values
function stripPartsFromFileName( tmpFileName, title ) { function stripPartsFromFileName( tmpFileName, title ) {
log.verbose(`etHelper (stripPartsFromFileName) - looking at ${tmpFileName}`); log.verbose(`[ethelper.js] (stripPartsFromFileName) - looking at ${tmpFileName}`);
let partName = ''; let partName = '';
// Find stacked item if present // Find stacked item if present
etHelper.StackedFilesName.forEach(element => { etHelper.StackedFilesName.forEach(element => {
@ -275,7 +275,7 @@ function stripPartsFromFileName( tmpFileName, title ) {
// Got a stacked identifier, so make sure next character is a number in [1-8] range // Got a stacked identifier, so make sure next character is a number in [1-8] range
const numStacked = tmpFileName.charAt(idx + element.length); const numStacked = tmpFileName.charAt(idx + element.length);
if (isNaN(numStacked)) { if (isNaN(numStacked)) {
log.info(`etHelper (stripPartsFromFileName) - for the media with the title: "${title}" looking at the string: "${tmpFileName}" for stacked element: "${element}" but found next character not a number so ignorring`) log.info(`[ethelper.js] (stripPartsFromFileName) - for the media with the title: "${title}" looking at the string: "${tmpFileName}" for stacked element: "${element}" but found next character not a number so ignorring`)
} }
else else
{ {
@ -286,8 +286,8 @@ function stripPartsFromFileName( tmpFileName, title ) {
} }
else else
{ {
log.warn(`etHelper (stripPartsFromFileName) - for the media with the title: "${title}" looking at the string: "${tmpFileName}" for stacked element: "${element}" but found entry not in range [1-8] so ignorring`) log.warn(`[ethelper.js] (stripPartsFromFileName) - for the media with the title: "${title}" looking at the string: "${tmpFileName}" for stacked element: "${element}" but found entry not in range [1-8] so ignorring`)
log.warn(`etHelper (stripPartsFromFileName) - See: https://support.plex.tv/articles/naming-and-organizing-your-movie-media-files/`) log.warn(`[ethelper.js] (stripPartsFromFileName) - See: https://support.plex.tv/articles/naming-and-organizing-your-movie-media-files/`)
} }
} }
} }
@ -308,7 +308,7 @@ function stripPartsFromFileName( tmpFileName, title ) {
tmpFileName = ''; tmpFileName = '';
} }
} }
log.verbose(`etHelper (stripPartsFromFileName) - Returning tmpFileName as: ${tmpFileName} *** Returning partName as: ${partName}`); log.verbose(`[ethelper.js] (stripPartsFromFileName) - Returning tmpFileName as: ${tmpFileName} *** Returning partName as: ${partName}`);
return { return {
fileName: tmpFileName, fileName: tmpFileName,
partName: partName partName: partName
@ -439,8 +439,8 @@ const etHelper = new class ETHELPER {
/// This will return a suggested foldername, following Plex naming std /// This will return a suggested foldername, following Plex naming std
async getSuggestedFolderName( data ) async getSuggestedFolderName( data )
{ {
log.verbose(`etHelper (getSuggestedFolderName) - Starting function. To see param, use Silly log level`); log.verbose(`[ethelper.js] (getSuggestedFolderName) - Starting function. To see param, use Silly log level`);
log.silly(`etHelper (getSuggestedFolderName) - Data pased over as: ${JSON.stringify(data)}`); log.silly(`[ethelper.js] (getSuggestedFolderName) - Data pased over as: ${JSON.stringify(data)}`);
const title = getSuggestedTitle( data ); const title = getSuggestedTitle( data );
const year = getSuggestedYear( data ); const year = getSuggestedYear( data );
const Id = getSuggestedId( data ).selId; const Id = getSuggestedId( data ).selId;
@ -448,7 +448,7 @@ const etHelper = new class ETHELPER {
const curFolderName = path.basename(path.dirname(String(JSONPath({path: "$.data.Media[0].Part[0].file", json: data})))) const curFolderName = path.basename(path.dirname(String(JSONPath({path: "$.data.Media[0].Part[0].file", json: data}))))
// Compute suggested foldername // Compute suggested foldername
let foldername = `${title} (${year}) ${Id}`; let foldername = `${title} (${year}) ${Id}`;
log.debug(`etHelper (getSuggestedFolderName) - Suggested folderName is: ${foldername}`); log.debug(`[ethelper.js] (getSuggestedFolderName) - Suggested folderName is: ${foldername}`);
if (curFolderName === foldername) { if (curFolderName === foldername) {
return i18n.t("Modules.ET.FolderNameOK") return i18n.t("Modules.ET.FolderNameOK")
} }
@ -542,7 +542,7 @@ const etHelper = new class ETHELPER {
suggestedFileName = suggestedFileName.replaceAll(" ", " "); suggestedFileName = suggestedFileName.replaceAll(" ", " ");
const fileNameExt = path.parse(String(JSONPath({path: '$.data.Media[0].Part[0].file', json: data}))).ext; const fileNameExt = path.parse(String(JSONPath({path: '$.data.Media[0].Part[0].file', json: data}))).ext;
suggestedFileName = `${suggestedFileName}${fileNameExt}`; suggestedFileName = `${suggestedFileName}${fileNameExt}`;
log.debug(`etHelper (getSuggestedFileName) - returning ${suggestedFileName}`); log.debug(`[ethelper.js] (getSuggestedFileName) - returning ${suggestedFileName}`);
if (curFileName === path.parse(suggestedFileName).name) { if (curFileName === path.parse(suggestedFileName).name) {
return i18n.t("Modules.ET.FileNameOK") return i18n.t("Modules.ET.FileNameOK")
} }
@ -564,9 +564,9 @@ const etHelper = new class ETHELPER {
} }
async postProcess( {name, val, title="", data} ){ async postProcess( {name, val, title="", data} ){
log.debug(`[ETHelper] (postProcess) - Val is: ${JSON.stringify(val)}`); log.debug(`[ethelper.js] (postProcess) - Val is: ${JSON.stringify(val)}`);
log.debug(`[ETHelper] (postProcess) - name is: ${name}`); log.debug(`[ethelper.js] (postProcess) - name is: ${name}`);
log.debug(`[ETHelper] (postProcess) - title is: ${title}`); log.debug(`[ethelper.js] (postProcess) - title is: ${title}`);
let retArray = []; let retArray = [];
let guidArr; let guidArr;
let x, retVal, start, strStart, end, result; let x, retVal, start, strStart, end, result;
@ -616,9 +616,9 @@ const etHelper = new class ETHELPER {
case "Original Title": case "Original Title":
if (wtconfig.get('ET.OrgTitleNull')) if (wtconfig.get('ET.OrgTitleNull'))
{ {
log.debug(`We need to override Original Titel, if not avail`); log.debug(`[ethelper.js] (postProcess) We need to override Original Titel, if not avail`);
log.debug(`Got Original title as: ${val}`); log.debug(`[ethelper.js] (postProcess) Got Original title as: ${val}`);
log.debug(`Alternative might be title as: ${title}`); log.debug(`[ethelper.js] (postProcess) Alternative might be title as: ${title}`);
// Override with title if not found // Override with title if not found
if (val == wtconfig.get('ET.NotAvail')) if (val == wtconfig.get('ET.NotAvail'))
{ {
@ -630,7 +630,7 @@ const etHelper = new class ETHELPER {
{ {
retVal = val; retVal = val;
} }
log.debug(`Original Title returned as: ${retVal}`) log.debug(`[ethelper.js] (postProcess) Original Title returned as: ${retVal}`)
break; break;
case "Sort title": case "Sort title":
if (wtconfig.get('ET.SortTitleNull')) if (wtconfig.get('ET.SortTitleNull'))
@ -851,12 +851,12 @@ const etHelper = new class ETHELPER {
retVal = path.join('Metadata', libTypeName, sha1[0], sha1.slice(1) + '.bundle'); retVal = path.join('Metadata', libTypeName, sha1[0], sha1.slice(1) + '.bundle');
break; break;
default: default:
log.error(`[ETHelper] (postProcess) no hit for: ${name}`) log.error(`[ethelper.js] (postProcess) no hit for: ${name}`)
break; break;
} }
} catch (error) { } catch (error) {
retVal = 'ERROR' retVal = 'ERROR'
log.error(`[ETHelper] (postProcess) - We had an error as: ${error} . So postProcess retVal set to ERROR`); log.error(`[ethelper.js] (postProcess) - We had an error as: ${error} . So postProcess retVal set to ERROR`);
} }
return await retVal; return await retVal;
} }
@ -864,7 +864,7 @@ const etHelper = new class ETHELPER {
async addRowToTmp( { data }) { async addRowToTmp( { data }) {
this.Settings.currentItem +=1; this.Settings.currentItem +=1;
status.updateStatusMsg( status.RevMsgType.Items, i18n.t('Common.Status.Msg.ProcessItem_0_1', {count: this.Settings.count, total: this.Settings.endItem})); status.updateStatusMsg( status.RevMsgType.Items, i18n.t('Common.Status.Msg.ProcessItem_0_1', {count: this.Settings.count, total: this.Settings.endItem}));
log.debug(`Start addRowToTmp item ${this.Settings.currentItem} (Switch to Silly log to see contents)`) log.debug(`[ethelper.js] (addRowToTmp) Start addRowToTmp item ${this.Settings.currentItem} (Switch to Silly log to see contents)`)
log.silly(`[ethelper.js] (addRowToTmp) Data is: ${JSON.stringify(data)}`) log.silly(`[ethelper.js] (addRowToTmp) Data is: ${JSON.stringify(data)}`)
let name, key, type, subType, subKey, doPostProc; let name, key, type, subType, subKey, doPostProc;
let date, year, month, day, hours, minutes, seconds; let date, year, month, day, hours, minutes, seconds;
@ -931,7 +931,7 @@ const etHelper = new class ETHELPER {
} }
break; break;
default: default:
log.error('NO ARRAY HIT (addRowToSheet-array)') log.error('[ethelper.js] (addRowToTmp) NO ARRAY HIT (addRowToSheet-array)')
} }
valArray.push(valArrayVal) valArray.push(valArrayVal)
} }
@ -986,7 +986,7 @@ const etHelper = new class ETHELPER {
if ( doPostProc ) if ( doPostProc )
{ {
const title = JSONPath({path: String('$.title'), json: data})[0]; const title = JSONPath({path: String('$.title'), json: data})[0];
log.debug(`[ETHelper] (addRowToTmp doPostProc) - Name is: ${name} - Title is: ${title} - Val is: ${val}`) log.debug(`[ethelper.js] (addRowToTmp doPostProc) - Name is: ${name} - Title is: ${title} - Val is: ${val}`)
val = await this.postProcess( {name: name, val: val, title: title, data: data} ); val = await this.postProcess( {name: name, val: val, title: title, data: data} );
} }
// Here we add qualifier, if not a number // Here we add qualifier, if not a number
@ -1012,13 +1012,23 @@ const etHelper = new class ETHELPER {
async getItemDetails( { key }) async getItemDetails( { key })
{ {
const url = this.Settings.baseURL + key + '?' + this.getIncludeInfo(); var include = await this.getIncludeInfo();
// Special case for shows export of level all, do not go for /children
if ( ( this.Settings.libTypeSec === this.ETmediaType.Show) && ( this.Settings.levelName === 'all') ){
key = key.toString().slice(0, -9);
}
let url = `${this.Settings.baseURL}${key}`;
if ( include ){
url = `${url}?${include}`;
}
this.PMSHeader["X-Plex-Token"] = this.Settings.accessToken; this.PMSHeader["X-Plex-Token"] = this.Settings.accessToken;
log.verbose(`Calling url in getItemDetails: ${url}`) log.verbose(`[ethelper.js] (getItemDetails) Calling url in getItemDetails: ${url}`)
let response = await fetch(url, { method: 'GET', headers: this.PMSHeader}); let response = await fetch(url, { method: 'GET', headers: this.PMSHeader});
let resp = await response.json(); let resp = await response.json();
resp = JSONPath({path: '$.MediaContainer.Metadata.*', json: resp})[0]; resp = JSONPath({path: '$.MediaContainer.Metadata.*', json: resp})[0];
log.debug(`Response in getItemDetails: ${JSON.stringify(resp)}`); log.debug(`[ethelper.js] (getItemDetails) Response in getItemDetails: ${JSON.stringify(resp)}`);
return resp return resp
} }
@ -1144,7 +1154,7 @@ const etHelper = new class ETHELPER {
} }
idx = Number(idx) + Number(step); idx = Number(idx) + Number(step);
} while (this.Settings.count < this.Settings.endItem); } while (this.Settings.count < this.Settings.endItem);
log.info('[etHelper] (populateExpFiles) - Populating export files ended'); log.info('[ethelper.js] (populateExpFiles) - Populating export files ended');
} }
async getSectionSize() async getSectionSize()