GetSectionSize fixed for Libraries type exp.

This commit is contained in:
UKDTOM 2021-11-19 12:37:18 +01:00
parent 12eb781d11
commit 2a0cc2b6f0
2 changed files with 15 additions and 2 deletions

View file

@ -16,7 +16,6 @@ import i18n from '../../../../i18n'
import {ipcRenderer} from 'electron';
//const fs = require('fs');
var path = require("path");
const fetch = require('node-fetch');

View file

@ -705,7 +705,18 @@ const etHelper = new class ETHELPER {
async getSectionSize()
{
const url = this.Settings.baseURL + '/library/sections/' + this.Settings.selLibKey + '/all?X-Plex-Container-Start=0&X-Plex-Container-Size=0&type=' + this.Settings.selType;
let url = this.Settings.baseURL + '/library/sections/' + this.Settings.selLibKey + '/all?X-Plex-Container-Start=0&X-Plex-Container-Size=0';
const noSelTypeArr=[this.ETmediaType.Libraries];
if (!noSelTypeArr.includes(this.Settings.selType))
{
url += '&type=' + this.Settings.selType;
log.silly('getSectionSize arr: ' + JSON.stringify(noSelTypeArr) + ' and testing against: ' + this.Settings.selType);
log.silly(`So adding "&type=${this.Settings.selType}"" to the url`)
}
this.PMSHeader["X-Plex-Token"] = this.Settings.accessToken;
log.verbose(`Calling url in getSectionSize: ${url}`)
let response = await fetch(url, { method: 'GET', headers: this.PMSHeader});
@ -1139,7 +1150,10 @@ const etHelper = new class ETHELPER {
// Private methode to set the header
async #SetFieldHeader(){
//if (this.Settings.Level)
console.log('Ged 11: Level: ' + this.Settings.Level)
log.verbose(`GetFieldHeader level: ${this.Settings.Level} - libType: ${this.Settings.libType}`);
//const fields2 = await this.getLevelFields(this.Settings.Level);
//return fields2;
return await this.getLevelFields();