mirror of
https://github.com/WebTools-NG/WebTools-NG
synced 2024-11-22 02:53:05 +00:00
#552 fixed
This commit is contained in:
parent
fd9adf6335
commit
06b954c42b
4 changed files with 35 additions and 15 deletions
|
@ -10,6 +10,8 @@
|
|||
**Changes**:
|
||||
|
||||
* [#547 Add link to Library Map on FM Settings page](https://github.com/WebTools-NG/WebTools-NG/issues/547) (Enhancement)
|
||||
* [#552 Export posters and art in original size](https://github.com/WebTools-NG/WebTools-NG/issues/552) (Enhancement)
|
||||
* [#550 Export posters for Seasons and Shows](https://github.com/WebTools-NG/WebTools-NG/issues/550) (Enhancement)
|
||||
|
||||
## V1.0.0 First Official Release (20220724)
|
||||
|
||||
|
|
|
@ -208,6 +208,7 @@
|
|||
"Name": "ExportTools",
|
||||
"ErrorServer": "No server",
|
||||
"Settings": {
|
||||
"ArtPostersOrigen": "Export Art and Posters in original size",
|
||||
"Settings": "Settings",
|
||||
"Description": "Here you can define the settings for @:Modules.ET.Name",
|
||||
"ArraySep": "Delimiter for multiple info in same field",
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
ArtDim: wtconfig.get('ET.Art_Dimensions', '75*75'),
|
||||
cbSelected: [],
|
||||
cbOptions: [
|
||||
{ text: i18n.t('Modules.ET.Settings.ArtPostersOrigen'), value: 'ArtPostersOrigen' },
|
||||
{ text: i18n.t('Modules.ET.Settings.ExportToCSV'), value: 'ExpCSV' },
|
||||
{ text: i18n.t('Modules.ET.Settings.ExportToExcel'), value: 'ExpXLSX', disabled: true },
|
||||
{ text: i18n.t('Modules.ET.Settings.OrgTitleNull'), value: 'OrgTitleNull' },
|
||||
|
@ -92,7 +93,7 @@
|
|||
dialog.ShowMsg( i18n.t("Modules.ET.Name"), i18n.t("Common.Ok"), i18n.t("Common.AppName"), 'For this version, export to XLSX is currently disabled', 'info');
|
||||
},
|
||||
getDefaults(){
|
||||
const cbItems = ["ExpCSV","ExpXLSX", "OrgTitleNull", "SortTitleNull", "suggestedFileNoExtra", "suggestedUseOrigenTitle", "NoTimeStamp", "NoItemRange"];
|
||||
const cbItems = ["ExpCSV","ExpXLSX", "OrgTitleNull", "SortTitleNull", "suggestedFileNoExtra", "suggestedUseOrigenTitle", "NoTimeStamp", "NoItemRange", "ArtPostersOrigen"];
|
||||
for(let i = 0; i < cbItems.length; i++){
|
||||
if (wtconfig.get("ET." + cbItems[i], false)){
|
||||
this.cbSelected.push(cbItems[i]);
|
||||
|
@ -105,7 +106,7 @@
|
|||
},
|
||||
filterTable(){
|
||||
this.$nextTick(()=>{console.log(this.cbSelected);})
|
||||
for( var cbItem of ["ExpCSV","ExpXLSX","OrgTitleNull", "SortTitleNull", "AutoXLSCol", "AutoXLSRow", "suggestedFileNoExtra", "suggestedUseOrigenTitle", "NoTimeStamp", "NoItemRange"]){
|
||||
for( var cbItem of ["ExpCSV","ExpXLSX","OrgTitleNull", "SortTitleNull", "AutoXLSCol", "AutoXLSRow", "suggestedFileNoExtra", "suggestedUseOrigenTitle", "NoTimeStamp", "NoItemRange", "ArtPostersOrigen"]){
|
||||
wtconfig.set("ET." + cbItem, (this.cbSelected.includes(cbItem)))
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1378,36 +1378,52 @@ const etHelper = new class ETHELPER {
|
|||
{
|
||||
log.error(`[etHelper] (exportPics) Exception in exportPics is: ${error}`);
|
||||
}
|
||||
log.verbose(`[etHelper] (exportPics) picUrl is: ${picUrl}`);
|
||||
log.verbose(`[etHelper] (exportPics) resolutions is: ${JSON.stringify(resolutions)}`);
|
||||
log.verbose(`[etHelper] (exportPics) ExpDir is: ${ExpDir}`);
|
||||
// Create export dir
|
||||
var fs = require('fs');
|
||||
if (!fs.existsSync(ExpDir)){
|
||||
fs.mkdirSync(ExpDir, { recursive: true });
|
||||
}
|
||||
log.verbose(`[etHelper] (exportPics) picUrl is: ${picUrl}`);
|
||||
log.verbose(`[etHelper] (exportPics) resolutions is: ${JSON.stringify(resolutions)}`);
|
||||
const ArtPostersOrigen = wtconfig.get('ET.ArtPostersOrigen', false);
|
||||
log.verbose(`[etHelper] (exportPics) resolutions as orginal: ${ArtPostersOrigen}`);
|
||||
log.verbose(`[etHelper] (exportPics) ExpDir is: ${ExpDir}`);
|
||||
let key = String(JSONPath({path: '$.ratingKey', json: data})[0]);
|
||||
let title = String(JSONPath({path: '$.title', json: data})[0]);
|
||||
// Get resolutions to export as
|
||||
for(let res of resolutions) {
|
||||
const fileName = key + '_' + title.replace(/[/\\?%*:|"<>]/g, ' ').trim() + '_' + res.trim().replace("*", "x") + '.jpg';
|
||||
if ( ArtPostersOrigen ){ // Export at original size
|
||||
const fileName = key + '_' + title.replace(/[/\\?%*:|"<>]/g, ' ').trim() + '.jpg';
|
||||
let outFile = path.join(
|
||||
ExpDir,
|
||||
fileName
|
||||
);
|
||||
// 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=';
|
||||
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} );
|
||||
}
|
||||
else { // Get resolutions to export as
|
||||
for(let res of resolutions) {
|
||||
const fileName = key + '_' + title.replace(/[/\\?%*:|"<>]/g, ' ').trim() + '_' + res.trim().replace("*", "x") + '.jpg';
|
||||
let outFile = path.join(
|
||||
ExpDir,
|
||||
fileName
|
||||
);
|
||||
// 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;
|
||||
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} );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async createOutFile()
|
||||
|
|
Loading…
Reference in a new issue