Merge pull request #361 from WebTools-NG/#358-PMS-page-size

#358 pms page size
This commit is contained in:
Tommy Mikkelsen 2021-05-03 00:04:09 +02:00 committed by GitHub
commit b5bd6f4195
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 120 additions and 30 deletions

View file

@ -3,6 +3,7 @@
## V0.3.8
* [#357 Default "Original Title" to "Title", if empty](https://github.com/WebTools-NG/WebTools-NG/issues/357)
* [#358 PMS page size](https://github.com/WebTools-NG/WebTools-NG/issues/358)
## V0.3.7

View file

@ -273,7 +273,18 @@
"FactoryResetConfirmBody": "Doing a Factory Reset will erase all your settings, as it was when first installed",
"FactoryResetConfirmBody2": "After doing a Factory Reset, you must start {0} again",
"FactoryResetBtnCancel": "Cancel",
"FactoryResetBtnOk": "Do a Factory Reset"
"FactoryResetBtnOk": "Do a Factory Reset",
"TTContainerSize": "Amount of items to fetch from the server. Warning: Increasing this will add stress to the server",
"ContainerSizeMovie": "Amount of movies (Default: 30)",
"ContainerSizeShow": "Amount of shows (Default: 30)",
"ContainerSizeEpisode": "Amount of episodes (Default: 30)",
"ContainerSizeArtist": "Amount of artists (Default: 30)",
"ContainerSizeAlbum": "Amount of albums (Default: 30)",
"ContainerSizeTrack": "Amount of tracks (Default: 30)",
"ContainerSizePhoto": "Amount of photos (Default: 30)",
"ContainerSizePlaylist": "Amount of playlists (Default: 30)",
"ContainerSizeLibraries": "Amount of libraries (Default: 30)",
"ContainerSizePlaylists": "Amount of playlists (Default: 30)"
},
"PMS": {
"Name": "Plex Media Server",

View file

@ -848,23 +848,19 @@ const excel2 = new class Excel {
break;
}
start = val.indexOf("imdb://");
console.log('Ged2 start', start)
if (start == -1)
{
retVal = wtconfig.get('ET.NotAvail');
break;
}
strStart = val.substring(start);
console.log('Ged3 strStart', strStart)
end = strStart.indexOf(wtconfig.get('ET.ArraySep'));
console.log('Ged4 end', end)
result = ''
if (end == -1)
{ result = strStart.substring(7) }
else
{ result = strStart.substring(7, end) }
retVal = result;
console.log('Ged5 retVal', retVal)
break;
case "IMDB ID (Legacy)":
if (val == wtconfig.get('ET.NotAvail'))
@ -1108,11 +1104,10 @@ const excel2 = new class Excel {
}
}
async addRowToTmp( { libType, level, data, stream, pListType }) {
async addRowToTmp( { libType, level, data, stream, fields }) {
log.debug(`Start addRowToTmp. libType: ${libType} - level: ${level}`)
log.silly(`Data is: ${JSON.stringify(data)}`)
let date, year, month, day, hours, minutes, seconds
const fields = et.getFields( libType, level, pListType)
let lookup, val, array, i, valArray, valArrayVal, subType, subKey
let str = ''
let result = ''
@ -1242,7 +1237,8 @@ const excel2 = new class Excel {
}
// Remove first character
result = str.substr(1);
await stream.write( result + "\n");
//await stream.write( result + "\n");
stream.write( result + "\n");
}
async sleep(ms) {
@ -1353,25 +1349,30 @@ const excel2 = new class Excel {
jPath = "$.MediaContainer.Metadata[*]";
}
const bExportPosters = wtconfig.get(`ET.CustomLevels.${libType}.Posters.${level}`, false);
const bExportArt = wtconfig.get(`ET.CustomLevels.${libType}.Art.${level}`, false);
for (x=0; x<sectionData.length; x++)
{
store.commit("UPDATE_EXPORTSTATUS", i18n.t('Modules.ET.Status.Processing-Chunk', {current: x, total: sectionData.length}));
sectionChunk = await JSONPath({path: jPath, json: sectionData[x]});
const fields = et.getFields( libType, level);
if ( call == 1 )
{
for (item of sectionChunk){
store.commit("UPDATE_EXPORTSTATUS", i18n.t('Modules.ET.Status.ProcessItem', {count: counter, total: totalSize}));
await excel2.addRowToTmp( { libType: libType, level: level, data: item, stream: stream, pListType: pListType } );
if (wtconfig.get(`ET.CustomLevels.${libType}.Posters.${level}`, false))
await excel2.addRowToTmp( { libType: libType, level: level, data: item, stream: stream, fields: fields } );
if (bExportPosters)
{
await this.exportPics( { type: 'posters', data: item, baseURL: baseURL, accessToken: accessToken } )
}
if (wtconfig.get(`ET.CustomLevels.${libType}.Art.${level}`, false))
if (bExportArt)
{
await this.exportPics( { type: 'arts', data: item, baseURL: baseURL, accessToken: accessToken } )
}
counter += 1;
await new Promise(resolve => setTimeout(resolve, 1));
// await new Promise(resolve => setTimeout(resolve, 1));
}
}
else
@ -1387,17 +1388,17 @@ const excel2 = new class Excel {
const contentsItems = await JSONPath({path: '$.MediaContainer.Metadata[*]', json: contents});
for (item of contentsItems){
store.commit("UPDATE_EXPORTSTATUS", i18n.t('Modules.ET.Status.ProcessItem', {count: counter, total: totalSize}));
if (wtconfig.get(`ET.CustomLevels.${libType}.Posters.${level}`, false))
if (bExportPosters)
{
await this.exportPics( { type: 'posters', data: item, baseURL: baseURL, accessToken: accessToken } )
}
if (wtconfig.get(`ET.CustomLevels.${libType}.Art.${level}`, false))
if (bExportArt)
{
await this.exportPics( { type: 'arts', data: item, baseURL: baseURL, accessToken: accessToken } )
}
await excel2.addRowToTmp( { libType: libType, level: level, data: item, stream: stream, pListType: pListType } );
await excel2.addRowToTmp( { libType: libType, level: level, data: item, stream: stream, fields: fields } );
counter += 1;
await new Promise(resolve => setTimeout(resolve, 1));
//await new Promise(resolve => setTimeout(resolve, 1));
}
}
}

View file

@ -266,7 +266,7 @@ const wtutils = new class WTUtils {
wtconfig.set('PMS.ContainerSize.4', 20)
}
if ( wtconfig.get('PMS.ContainerSize.1', 'N/A') == 'N/A' ){
wtconfig.set('PMS.ContainerSize.1', 20)
wtconfig.set('PMS.ContainerSize.1', 50)
}
if ( wtconfig.get('PMS.ContainerSize.13', 'N/A') == 'N/A' ){
wtconfig.set('PMS.ContainerSize.13', 20)

View file

@ -12,9 +12,6 @@
</b-input-group>
</div>
<b-input-group id="TimeOutGrp" :prepend="$t('Modules.GlobalSettings.TimeOut')" class="mt-3">
<b-form-input id="TimeOut" name="TimeOut" type="text" class="form-control" v-model="TimeOut" :disabled=false :maxlength=2 @change="setTimeOut()"></b-form-input>
</b-input-group>
@ -23,14 +20,14 @@
<b-tooltip target="LogLevelGrp" triggers="hover">
{{ $t('Modules.GlobalSettings.RestartNeeded') }}
</b-tooltip>
<b-form-select id="LogLevel" name="LogLevel" type="text" class="form-control" v-model="LogLevel" :disabled=false :maxlength=2 v-on:change="setLogLevel" :options="logLevels"></b-form-select>
<b-form-select id="LogLevel" name="LogLevel" type="text" class="form-control" v-model="LogLevel" :disabled=false :maxlength=2 v-on:change="setPrefs($event, 'Log.fileLevel')" :options="logLevels"></b-form-select>
</b-input-group>
<b-input-group id="LogLevelConsoleGrp" :prepend="$t('Modules.GlobalSettings.LogLevelConsole')" class="mt-3">
<b-tooltip target="LogLevelConsoleGrp" triggers="hover">
{{ $t('Modules.GlobalSettings.RestartNeeded') }}
</b-tooltip>
<b-form-select id="LogLevelConsole" name="LogLevelConsole" type="text" class="form-control" v-model="LogLevelConsole" :disabled=false :maxlength=2 v-on:change="setLogLevelConsole" :options="logLevels"></b-form-select>
<b-form-select id="LogLevelConsole" name="LogLevelConsole" type="text" class="form-control" v-model="LogLevelConsole" :disabled=false :maxlength=2 v-on:change="setPrefs($event, 'Log.consoleLevel')" :options="logLevels"></b-form-select>
</b-input-group>
<b-input-group id="LogLevelSizeGrp" :prepend="$t('Modules.GlobalSettings.LogSize')" class="mt-3">
@ -56,6 +53,76 @@
</b-form-select>
</b-input-group>
<b-input-group id="ContainerSizeMovie" :prepend="$t('Modules.GlobalSettings.ContainerSizeMovie')" class="mt-3">
<b-tooltip target="ContainerSizeMovie" triggers="hover">
{{ $t('Modules.GlobalSettings.TTContainerSize') }}
</b-tooltip>
<b-form-select id="ContainerSizeMovie" name="ContainerSizeMovie" type="text" class="form-control" v-model="ContainerSizeMovie" :options="ContainerSizes" :disabled=false v-on:change="setPrefs($event, 'PMS.ContainerSize.1')"></b-form-select>
</b-input-group>
<b-input-group id="ContainerSizeShow" :prepend="$t('Modules.GlobalSettings.ContainerSizeShow')" class="mt-3">
<b-tooltip target="ContainerSizeShow" triggers="hover">
{{ $t('Modules.GlobalSettings.TTContainerSize') }}
</b-tooltip>
<b-form-select id="ContainerSizeShow" name="ContainerSizeShow" type="text" class="form-control" v-model="ContainerSizeShow" :options="ContainerSizes" :disabled=false v-on:change="setPrefs($event, 'PMS.ContainerSize.2')"></b-form-select>
</b-input-group>
<b-input-group id="ContainerSizeEpisode" :prepend="$t('Modules.GlobalSettings.ContainerSizeEpisode')" class="mt-3">
<b-tooltip target="ContainerSizeEpisode" triggers="hover">
{{ $t('Modules.GlobalSettings.TTContainerSize') }}
</b-tooltip>
<b-form-select id="ContainerSizeEpisode" name="ContainerSizeEpisode" type="text" class="form-control" v-model="ContainerSizeEpisode" :options="ContainerSizes" :disabled=false v-on:change="setPrefs($event, 'PMS.ContainerSize.4')"></b-form-select>
</b-input-group>
<b-input-group id="ContainerSizeArtist" :prepend="$t('Modules.GlobalSettings.ContainerSizeArtist')" class="mt-3">
<b-tooltip target="ContainerSizeArtist" triggers="hover">
{{ $t('Modules.GlobalSettings.TTContainerSize') }}
</b-tooltip>
<b-form-select id="ContainerSizeArtist" name="ContainerSizeArtist" type="text" class="form-control" v-model="ContainerSizeArtist" :options="ContainerSizes" :disabled=false v-on:change="setPrefs($event, 'PMS.ContainerSize.8')"></b-form-select>
</b-input-group>
<b-input-group id="ContainerSizeAlbum" :prepend="$t('Modules.GlobalSettings.ContainerSizeAlbum')" class="mt-3">
<b-tooltip target="ContainerSizeAlbum" triggers="hover">
{{ $t('Modules.GlobalSettings.TTContainerSize') }}
</b-tooltip>
<b-form-select id="ContainerSizeAlbum" name="ContainerSizeAlbum" type="text" class="form-control" v-model="ContainerSizeAlbum" :options="ContainerSizes" :disabled=false v-on:change="setPrefs($event, 'PMS.ContainerSize.9')"></b-form-select>
</b-input-group>
<b-input-group id="ContainerSizeTrack" :prepend="$t('Modules.GlobalSettings.ContainerSizeTrack')" class="mt-3">
<b-tooltip target="ContainerSizeTrack" triggers="hover">
{{ $t('Modules.GlobalSettings.TTContainerSize') }}
</b-tooltip>
<b-form-select id="ContainerSizeTrack" name="ContainerSizeTrack" type="text" class="form-control" v-model="ContainerSizeTrack" :options="ContainerSizes" :disabled=false v-on:change="setPrefs($event, 'PMS.ContainerSize.10')"></b-form-select>
</b-input-group>
<b-input-group id="ContainerSizePhoto" :prepend="$t('Modules.GlobalSettings.ContainerSizePhoto')" class="mt-3">
<b-tooltip target="ContainerSizePhoto" triggers="hover">
{{ $t('Modules.GlobalSettings.TTContainerSize') }}
</b-tooltip>
<b-form-select id="ContainerSizePhoto" name="ContainerSizePhoto" type="text" class="form-control" v-model="ContainerSizePhoto" :options="ContainerSizes" :disabled=false v-on:change="setPrefs($event, 'PMS.ContainerSize.13')"></b-form-select>
</b-input-group>
<b-input-group id="ContainerSizePlaylist" :prepend="$t('Modules.GlobalSettings.ContainerSizePlaylist')" class="mt-3">
<b-tooltip target="ContainerSizePlaylist" triggers="hover">
{{ $t('Modules.GlobalSettings.TTContainerSize') }}
</b-tooltip>
<b-form-select id="ContainerSizePlaylist" name="ContainerSizePlaylist" type="text" class="form-control" v-model="ContainerSizePlaylist" :options="ContainerSizes" :disabled=false v-on:change="setPrefs($event, 'PMS.ContainerSize.15')"></b-form-select>
</b-input-group>
<b-input-group id="ContainerSizeLibraries" :prepend="$t('Modules.GlobalSettings.ContainerSizeLibraries')" class="mt-3">
<b-tooltip target="ContainerSizeLibraries" triggers="hover">
{{ $t('Modules.GlobalSettings.TTContainerSize') }}
</b-tooltip>
<b-form-select id="ContainerSizeLibraries" name="ContainerSizeLibraries" type="text" class="form-control" v-model="ContainerSizeLibraries" :options="ContainerSizes" :disabled=false v-on:change="setPrefs($event, 'PMS.ContainerSize.1002')"></b-form-select>
</b-input-group>
<b-input-group id="ContainerSizePlaylists" :prepend="$t('Modules.GlobalSettings.ContainerSizePlaylists')" class="mt-3">
<b-tooltip target="ContainerSizePlaylists" triggers="hover">
{{ $t('Modules.GlobalSettings.TTContainerSize') }}
</b-tooltip>
<b-form-select id="ContainerSizePlaylists" name="ContainerSizePlaylists" type="text" class="form-control" v-model="ContainerSizePlaylists" :options="ContainerSizes" :disabled=false v-on:change="setPrefs($event, 'PMS.ContainerSize.3001')"></b-form-select>
</b-input-group>
<!-- Factory Reset -->
<b-modal ref="confirmFactoryReset" hide-footer v-bind:title="$t('Modules.GlobalSettings.FactoryResetConfirmTitle')" >
<div class="d-block text-center">
@ -94,7 +161,17 @@
LogLevelConsole: wtconfig.get('Log.consoleLevel'),
LogLevelSize: this.getLogFileSize(),
BetaTester: this.getBeta(),
Update: this.getUpdate()
Update: this.getUpdate(),
ContainerSizeMovie: wtconfig.get('PMS.ContainerSize.1'),
ContainerSizeShow: wtconfig.get('PMS.ContainerSize.2'),
ContainerSizeEpisode: wtconfig.get('PMS.ContainerSize.4'),
ContainerSizeArtist: wtconfig.get('PMS.ContainerSize.8'),
ContainerSizeAlbum: wtconfig.get('PMS.ContainerSize.9'),
ContainerSizeTrack: wtconfig.get('PMS.ContainerSize.10'),
ContainerSizePhoto: wtconfig.get('PMS.ContainerSize.13'),
ContainerSizePlaylist: wtconfig.get('PMS.ContainerSize.15'),
ContainerSizeLibraries: wtconfig.get('PMS.ContainerSize.1002'),
ContainerSizePlaylists: wtconfig.get('PMS.ContainerSize.3001')
}
},
methods: {
@ -173,10 +250,6 @@
setTimeOut: function(){
wtconfig.set('PMS.TimeOut', this.TimeOut)
},
setLogLevel: function(value){
log.info(`Log file level set to ${value}`)
wtconfig.set('Log.fileLevel', value)
},
setBeta: function(value){
log.info(`Beta level set to ${value}`);
wtconfig.set('Update.Beta', value == i18n.t('Modules.GlobalSettings.True'));
@ -185,9 +258,9 @@
log.info(`Update set to ${value}`);
wtconfig.set('Update.Update', value == i18n.t('Modules.GlobalSettings.True'));
},
setLogLevelConsole: function(value){
log.info(`Log Console level set to ${value}`);
wtconfig.set('Log.consoleLevel', value);
setPrefs: function(value, name){
log.info(`Update prefs for ${name} set to ${value}`);
wtconfig.set(name, value);
},
getLogFileSize: function(){
const logSizeBytes = wtconfig.get('Log.maxSize');
@ -247,6 +320,10 @@
}
},
computed: {
ContainerSizes: function() {
const options = [20, 30, 40, 50, 60, 70, 80, 90, 100];
return options;
},
logLevels: function() {
const options = ['error', 'warn', 'info', 'verbose', 'debug', 'silly'];
return options;