#461 Metadata now done

This commit is contained in:
Tommy Mikkelsen 2022-05-10 23:00:48 +02:00
parent 190f16da2d
commit 71fbd33531
9 changed files with 54 additions and 17 deletions

View file

@ -22,6 +22,7 @@
* [#478 Refactor time and status for ET Module](https://github.com/WebTools-NG/WebTools-NG/issues/478)
* [#463 plex.tv add friendly name](https://github.com/WebTools-NG/WebTools-NG/issues/463)
* [#398 Playlists imported from music.app doesn't show](https://github.com/WebTools-NG/WebTools-NG/issues/398)
* [#461 Playlists imported from music.app doesn't show](https://github.com/WebTools-NG/WebTools-NG/issues/461)
## V0.3.15 (20220413)

View file

@ -106,7 +106,7 @@
{ text: i18n.t('Modules.ET.Custom.optCustExpType.Movies'), value: et.ETmediaType.Movie, disabled: false },
{ text: i18n.t('Modules.ET.Custom.optCustExpType.TVSeries'), value: et.ETmediaType.Show, disabled: false },
{ text: i18n.t('Modules.ET.Custom.optCustExpType.TVEpisodes'), value: et.ETmediaType.Episode, disabled: false },
{ text: i18n.t('Modules.ET.Custom.optCustExpType.AudioArtist'), value: et.ETmediaType.Album, disabled: false },
{ text: i18n.t('Modules.ET.Custom.optCustExpType.AudioArtist'), value: et.ETmediaType.Artist, disabled: false },
{ text: i18n.t('Modules.ET.Custom.optCustExpType.AudioAlbum'), value: et.ETmediaType.Album, disabled: false },
{ text: i18n.t('Modules.ET.Custom.optCustExpType.AudioTrack'), value: et.ETmediaType.Track, disabled: false },
{ text: i18n.t('Modules.ET.Custom.optCustExpType.Photos'), value: et.ETmediaType.Photo, disabled: false },
@ -291,9 +291,9 @@
}
}
});
log.info(`LevelCount for "${this.selCustLevel}" of the type "${this.selMediaType}" was calculated as:${curLevel}`);
log.info(`[custom.vue] (updateLevelCount) 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}`);
log.info(`[custom.vue] (updateLevelCount) 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() {

View file

@ -32,6 +32,7 @@
"Locked Fields",
"Loudness Analysis Version",
"Mood",
"PMS Metadata Path",
"Poster url",
"Rating",
"Release Date",

View file

@ -38,6 +38,7 @@
"Locked Fields",
"Mood",
"Original Title",
"PMS Metadata Path",
"Poster url",
"Release Date",
"Similar",

View file

@ -106,6 +106,7 @@
"Part Size as Bytes",
"Part Size",
"Part Video Profile",
"PMS Metadata Path",
"Poster url",
"Rating",
"Release Date",

View file

@ -1012,6 +1012,13 @@
"call": 1,
"type": "string"
},
"PMS Metadata Path":
{
"key": "$.guid",
"call": 1,
"type": "string",
"postProcess": true
},
"Poster url":
{
"key": "$.thumb",

View file

@ -123,6 +123,7 @@
"Part Size",
"Part Size as Bytes",
"Part Video Profile",
"PMS Metadata Path",
"Poster url",
"Rating",
"Release Date",

View file

@ -44,6 +44,7 @@
"Locked Fields",
"Original Title",
"Part Duration",
"PMS Metadata Path",
"Poster url",
"Rating",
"Release Date",

View file

@ -552,9 +552,9 @@ const etHelper = new class ETHELPER {
}
async postProcess( {name, val, title="", data} ){
log.debug(`ETHelper(postProcess) - Val is: ${JSON.stringify(val)}`);
log.debug(`ETHelper(postProcess) - name is: ${name}`);
log.debug(`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;
@ -796,17 +796,46 @@ const etHelper = new class ETHELPER {
for(const item of guidArr) {
if ( item.startsWith("tmdb://") )
{
retVal = result = 'https://www.themoviedb.org/movie/' + item.substring(7);
retVal = 'https://www.themoviedb.org/movie/' + item.substring(7);
}
}
break;
case "PMS Metadata Path":
retVal = wtconfig.get('ET.NotAvail');
var libTypeName;
switch ( String(this.RevETmediaType[this.Settings.libTypeSec]) ){
case "Movie":
libTypeName = 'Movies';
break;
case "Show":
libTypeName = 'TV Shows';
break;
case "Episode":
libTypeName = 'TV Shows';
// We need another guid sadly
val = JSONPath({path: '$..grandparentGuid', json: data})[0];
break;
case "Album":
libTypeName = 'Albums';
break;
case "Artist":
libTypeName = 'Artists';
break;
}
var crypto = require('crypto');
var shasum = crypto.createHash('sha1');
shasum.update(val);
var sha1 = shasum.digest('hex');
var path = require('path');
retVal = path.join('Metadata', libTypeName, sha1[0], sha1.slice(1) + '.bundle');
break;
default:
log.error(`postProcess no hit for: ${name}`)
log.error(`[ETHelper] (postProcess) no hit for: ${name}`)
break;
}
} catch (error) {
retVal = 'ERROR'
log.error(`ETHelper(postProcess) - We had an error as: ${error} . So postProcess retVal set to ERROR`);
log.error(`[ETHelper] (postProcess) - We had an error as: ${error} . So postProcess retVal set to ERROR`);
}
return await retVal;
}
@ -815,7 +844,7 @@ const etHelper = new class ETHELPER {
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}));
log.debug(`Start addRowToTmp item ${this.Settings.currentItem} (Switch to Silly log to see contents)`)
log.silly(`Data is: ${JSON.stringify(data)}`)
log.silly(`[ethelper.js] (addRowToTmp) 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
@ -845,12 +874,10 @@ const etHelper = new class ETHELPER {
val = wtconfig.get('ET.NotAvail', 'N/A');
}
val = etHelper.isEmpty( { "val": val } );
// val = setQualifier( {str: val} );
break;
case "array":
array = JSONPath({path: key, json: data});
if (array === undefined || array.length == 0) {
// val = setQualifier( {str: wtconfig.get('ET.NotAvail', 'N/A')} );
val = wtconfig.get('ET.NotAvail', 'N/A');
}
else
@ -887,8 +914,7 @@ const etHelper = new class ETHELPER {
}
valArray.push(valArrayVal)
}
val = valArray.join(wtconfig.get('ET.ArraySep', ' * '))
// val = setQualifier( {str: val} );
val = valArray.join(wtconfig.get('ET.ArraySep', ' * '));
}
break;
case "array-count":
@ -912,7 +938,6 @@ const etHelper = new class ETHELPER {
{
val = wtconfig.get('ET.NotAvail', 'N/A')
}
// val = setQualifier( {str: val} );
break;
case "datetime":
//val = JSONPath({path: String(lookup), json: data});
@ -935,13 +960,12 @@ const etHelper = new class ETHELPER {
{
val = wtconfig.get('ET.NotAvail', 'N/A')
}
// val = setQualifier( {str: val} );
break;
}
if ( doPostProc )
{
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] (addRowToTmp doPostProc) - Name is: ${name} - Title is: ${title} - Val is: ${val}`)
val = await this.postProcess( {name: name, val: val, title: title, data: data} );
}
// Here we add qualifier, if not a number