diff --git a/src/components/modules/ExportTools/Custom/custom.vue b/src/components/modules/ExportTools/Custom/custom.vue
index cf759c7..cf2565d 100644
--- a/src/components/modules/ExportTools/Custom/custom.vue
+++ b/src/components/modules/ExportTools/Custom/custom.vue
@@ -172,16 +172,31 @@
log.debug(`Customlevel ${this.selCustLevel} selected`);
if (this.selCustLevel != 'NewLevel'){
// Get fields from config.json file
- let custLevel = wtconfig.get(`ET.CustomLevels.${this.selMediaType}.level.${this.selCustLevel}`)
+ let custLevel = wtconfig.get(`ET.CustomLevels.${this.selMediaType}.level.${this.selCustLevel}`);
+ // Do we need to export art?
+ if ( wtconfig.get(`ET.CustomLevels.${this.selMediaType}.Art.${this.selCustLevel}`, false) )
+ {
+ custLevel.push("Export Art");
+ }
+ // Do we need to export show art?
+ if ( wtconfig.get(`ET.CustomLevels.${this.selMediaType}.ShowArt.${this.selCustLevel}`, false) )
+ {
+ custLevel.push("Export Show Art");
+ }
// Do we need to export posters?
if ( wtconfig.get(`ET.CustomLevels.${this.selMediaType}.Posters.${this.selCustLevel}`, false) )
{
custLevel.push("Export Posters");
}
- // Do we need to export art?
- if ( wtconfig.get(`ET.CustomLevels.${this.selMediaType}.Art.${this.selCustLevel}`, false) )
+ // Do we need to export season posters?
+ if ( wtconfig.get(`ET.CustomLevels.${this.selMediaType}.SeasonPosters.${this.selCustLevel}`, false) )
{
- custLevel.push("Export Art");
+ custLevel.push("Export Season Posters");
+ }
+ // Do we need to export show posters?
+ if ( wtconfig.get(`ET.CustomLevels.${this.selMediaType}.ShowPosters.${this.selCustLevel}`, false) )
+ {
+ custLevel.push("Export Show Posters");
}
// Add to resultList
this.resultList = custLevel.map((name, index) => {
@@ -330,7 +345,10 @@
saveCustomLevel() {
let result = []
let bExportArt = false;
+ let bExportShowArt = false;
let bExportPosters = false;
+ let bExportSeasonPosters = false;
+ let bExportShowPosters = false;
for(var k in this.resultList) {
if (this.resultList[k].name == 'Export Posters')
{
@@ -340,13 +358,28 @@
{
bExportArt = true;
}
+ else if (this.resultList[k].name == 'Export Show Art')
+ {
+ bExportShowArt = true;
+ }
+ else if (this.resultList[k].name == 'Export Season Posters')
+ {
+ bExportSeasonPosters = true;
+ }
+ else if (this.resultList[k].name == 'Export Show Posters')
+ {
+ bExportShowPosters = true;
+ }
else
{
result.push(this.resultList[k].name);
}
}
wtconfig.set(`ET.CustomLevels.${this.selMediaType}.Posters.${this.selCustLevel}`, bExportPosters);
+ wtconfig.set(`ET.CustomLevels.${this.selMediaType}.SeasonPosters.${this.selCustLevel}`, bExportSeasonPosters);
+ wtconfig.set(`ET.CustomLevels.${this.selMediaType}.ShowPosters.${this.selCustLevel}`, bExportShowPosters);
wtconfig.set(`ET.CustomLevels.${this.selMediaType}.Art.${this.selCustLevel}`, bExportArt);
+ wtconfig.set(`ET.CustomLevels.${this.selMediaType}.ShowArt.${this.selCustLevel}`, bExportShowArt);
// Get current level names
let curLevel = wtconfig.get(`ET.CustomLevels.${this.selMediaType}.level`);
// Add new level to JSON
diff --git a/src/components/modules/ExportTools/Settings/settings.vue b/src/components/modules/ExportTools/Settings/settings.vue
index 5de0244..361fb58 100644
--- a/src/components/modules/ExportTools/Settings/settings.vue
+++ b/src/components/modules/ExportTools/Settings/settings.vue
@@ -12,13 +12,13 @@
{{ $t('Modules.ET.Settings.Posters_Dimensions_TT') }}
-
+
{{ $t('Modules.ET.Settings.Art_Dimensions_TT') }}
-
+
]/g, ' ').trim() + '.jpg';
- let outFile = path.join(
- ExpDir,
- fileName
- );
- let URL = this.Settings.baseURL;
- URL += picUrl;
- log.verbose(`[etHelper] (exportPics) Url for ${extype} is ${URL}`);
- log.verbose(`[etHelper] (exportPics) Outfile is ${outFile}`);
- URL += '&X-Plex-Token=' + this.Settings.accessToken;
- await this.forceDownload( { url:URL, target:outFile, title:title} );
+ if ( res ){
+ // Remove whitespace
+ res = res.replace(/\s/g, "");
+ fileName = `${key}_${title.replace(/[/\\?%*:|"<>]/g, ' ').trim()}_${res}`;
+ } else {
+ fileName = `${key}_${title.replace(/[/\\?%*:|"<>]/g, ' ').trim()}`;
}
- else { // Get resolutions to export as
+ let outFile = path.join(
+ ExpDir,
+ fileName + '.jpg'
+ );
+ log.debug(`[ethelper.js] (getExportPicsUrlandFileFileName) - Outfile is: ${outFile}`);
+ return outFile;
+ }
+
+ async getExportPicsUrlandFile( { type: extype, data: data} ) {
+ const ArtPostersOrigen = wtconfig.get('ET.ArtPostersOrigen', false);
+ let resp = [];
+ let picUrl = '';
+ let entry = {};
+ let resolutions;
+ switch ( extype ) {
+ case 'posters':
+ picUrl = String(JSONPath({path: '$.thumb', json: data})[0]);
+ resolutions = wtconfig.get('ET.Posters_Dimensions', '75*75').split(',');
+ break;
+ case 'arts':
+ picUrl = String(JSONPath({path: '$.art', json: data})[0]);
+ resolutions = wtconfig.get('ET.Art_Dimensions', '75*75').split(',');
+ break;
+ }
+ if ( ArtPostersOrigen ) { // Export in origen resolution
+ entry['url'] = `${this.Settings.baseURL}${picUrl}`;
+ entry['outFile'] = await this.getExportPicsUrlandFileFileName( { type: extype, data: data} );
+ resp.push(entry);
+ } else { // Export in defined resolutions
for(let res of resolutions) {
- const fileName = key + '_' + title.replace(/[/\\?%*:|"<>]/g, ' ').trim() + '_' + res.trim().replace("*", "x") + '.jpg';
- let outFile = path.join(
- ExpDir,
- fileName
- );
+ entry = {};
+ res = res.replace('*', 'x');
+ console.log('Ged 21-3', res)
// Build up pic url
- //const width = res.split('*')[1].trim();
- const hight = res.split('*')[1].trim();
- const width = res.split('*')[0].trim();
- let URL = this.Settings.baseURL + '/photo/:/transcode?width=';
- URL += width + '&height=' + hight;
- URL += '&minSize=1&url=';
- URL += picUrl;
+ const hight = res.split('x')[1].trim();
+ const width = res.split('x')[0].trim();
+ entry['url'] = `${this.Settings.baseURL}/photo/:/transcode?width=${width}&height=${hight}&minSize=1&url=${picUrl}`;
log.verbose(`[etHelper] (exportPics) Url for ${extype} is ${URL}`);
- log.verbose(`[etHelper] (exportPics) Outfile is ${outFile}`);
- URL += '&X-Plex-Token=' + this.Settings.accessToken;
- await this.forceDownload( { url:URL, target:outFile, title:title} );
+ entry['outFile'] = await this.getExportPicsUrlandFileFileName( { type: extype, data: data, res: res} );
+ resp.push(entry);
}
}
+ return resp;
+ }
+
+ async exportPics( { type: extype, data: data} ) {
+ let files = await this.getExportPicsUrlandFile( { type: extype, data: data} );
+ let title = String(JSONPath({path: '$.title', json: data})[0]);
+ for (var idx in files){
+ await this.forceDownload( { url:files[idx]['url'], target:files[idx]['outFile'], title:title} );
+ }
}
async createOutFile()
@@ -1831,7 +1830,7 @@ const etHelper = new class ETHELPER {
}
Object.keys(levels).forEach(function(key) {
// Skip picture export fields
- if ( !["Export Art", "Export Posters"].includes(levels[key]) )
+ if ( !["Export Art", "Export Posters", "Export Show Art", "Export Season Posters", "Export Show Posters"].includes(levels[key]) )
{
out.push(levels[key])
}