mirror of
https://github.com/WebTools-NG/WebTools-NG
synced 2025-03-09 00:37:20 +00:00
Removed some debug logs, and added playlist output
This commit is contained in:
parent
e469a504d6
commit
037dfcd46e
4 changed files with 61 additions and 45 deletions
54
package-lock.json
generated
54
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "webtools-ng",
|
||||
"version": "0.1.16",
|
||||
"version": "0.3.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "webtools-ng",
|
||||
"version": "0.1.16",
|
||||
"version": "0.3.1",
|
||||
"hasInstallScript": true,
|
||||
"license": "MPL-2.0",
|
||||
"dependencies": {
|
||||
|
@ -21,7 +21,7 @@
|
|||
"electron-is-dev": "^1.2.0",
|
||||
"electron-log": "^4.3.0",
|
||||
"electron-store": "^5.2.0",
|
||||
"exceljs": "^4.2.0",
|
||||
"exceljs": "^4.2.1",
|
||||
"fetch": "^1.1.0",
|
||||
"file-saver": "^2.0.5",
|
||||
"file-size": "^1.0.0",
|
||||
|
@ -6634,18 +6634,18 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/elliptic": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
|
||||
"integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
|
||||
"version": "6.5.4",
|
||||
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",
|
||||
"integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"bn.js": "^4.4.0",
|
||||
"brorand": "^1.0.1",
|
||||
"bn.js": "^4.11.9",
|
||||
"brorand": "^1.1.0",
|
||||
"hash.js": "^1.0.0",
|
||||
"hmac-drbg": "^1.0.0",
|
||||
"inherits": "^2.0.1",
|
||||
"minimalistic-assert": "^1.0.0",
|
||||
"minimalistic-crypto-utils": "^1.0.0"
|
||||
"hmac-drbg": "^1.0.1",
|
||||
"inherits": "^2.0.4",
|
||||
"minimalistic-assert": "^1.0.1",
|
||||
"minimalistic-crypto-utils": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/elliptic/node_modules/bn.js": {
|
||||
|
@ -7180,9 +7180,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/exceljs": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/exceljs/-/exceljs-4.2.0.tgz",
|
||||
"integrity": "sha512-r0/ClXRs3cQmMGJOQY6/ymnZSBSzeJL/LjAlKjY75ev1iQgf0LcmeFfTqFTFK0fADLAWieOMXe7abPoGYWI6hA==",
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/exceljs/-/exceljs-4.2.1.tgz",
|
||||
"integrity": "sha512-EogoTdXH1X1PxqD9sV8caYd1RIfXN3PVlCV+mA/87CgdO2h4X5xAEbr7CaiP8tffz7L4aBFwsdMbjfMXi29NjA==",
|
||||
"dependencies": {
|
||||
"archiver": "^5.0.0",
|
||||
"dayjs": "^1.8.34",
|
||||
|
@ -24134,18 +24134,18 @@
|
|||
"dev": true
|
||||
},
|
||||
"elliptic": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
|
||||
"integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
|
||||
"version": "6.5.4",
|
||||
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",
|
||||
"integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bn.js": "^4.4.0",
|
||||
"brorand": "^1.0.1",
|
||||
"bn.js": "^4.11.9",
|
||||
"brorand": "^1.1.0",
|
||||
"hash.js": "^1.0.0",
|
||||
"hmac-drbg": "^1.0.0",
|
||||
"inherits": "^2.0.1",
|
||||
"minimalistic-assert": "^1.0.0",
|
||||
"minimalistic-crypto-utils": "^1.0.0"
|
||||
"hmac-drbg": "^1.0.1",
|
||||
"inherits": "^2.0.4",
|
||||
"minimalistic-assert": "^1.0.1",
|
||||
"minimalistic-crypto-utils": "^1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"bn.js": {
|
||||
|
@ -24575,9 +24575,9 @@
|
|||
}
|
||||
},
|
||||
"exceljs": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/exceljs/-/exceljs-4.2.0.tgz",
|
||||
"integrity": "sha512-r0/ClXRs3cQmMGJOQY6/ymnZSBSzeJL/LjAlKjY75ev1iQgf0LcmeFfTqFTFK0fADLAWieOMXe7abPoGYWI6hA==",
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/exceljs/-/exceljs-4.2.1.tgz",
|
||||
"integrity": "sha512-EogoTdXH1X1PxqD9sV8caYd1RIfXN3PVlCV+mA/87CgdO2h4X5xAEbr7CaiP8tffz7L4aBFwsdMbjfMXi29NjA==",
|
||||
"requires": {
|
||||
"archiver": "^5.0.0",
|
||||
"dayjs": "^1.8.34",
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
"electron-is-dev": "^1.2.0",
|
||||
"electron-log": "^4.3.0",
|
||||
"electron-store": "^5.2.0",
|
||||
"exceljs": "^4.2.0",
|
||||
"exceljs": "^4.2.1",
|
||||
"fetch": "^1.1.0",
|
||||
"file-saver": "^2.0.5",
|
||||
"file-size": "^1.0.0",
|
||||
|
|
|
@ -13,14 +13,11 @@ import filesize from 'filesize';
|
|||
var path = require("path");
|
||||
|
||||
const fetch = require('node-fetch');
|
||||
//const {jp} = require('jsonpath');
|
||||
|
||||
const {JSONPath} = require('jsonpath-plus');
|
||||
import axios from 'axios'
|
||||
import store from '../../../../store';
|
||||
|
||||
|
||||
|
||||
const et = new class ET {
|
||||
constructor() {
|
||||
this.PMSHeader = wtutils.PMSHeader;
|
||||
|
@ -64,29 +61,35 @@ const et = new class ET {
|
|||
async getSectionData({sectionName, baseURL, accessToken, libType})
|
||||
{
|
||||
const sectionData = []
|
||||
log.info(`Starting getSectionData with Name: ${sectionName} and with a type of: ${libType}`)
|
||||
log.info(`Starting getSectionData with Name: "${sectionName}" and with a type of: "${libType}"`)
|
||||
// Get Section Key
|
||||
const libKey = await et.getSectionKey({libName: sectionName, baseURL: baseURL, accessToken: accessToken})
|
||||
log.debug(`Get SectionKey as: ${libKey}`)
|
||||
log.debug(`Got SectionKey as: ${libKey}`)
|
||||
// Get the size of the library
|
||||
const libSize = await et.getSectionSizeByKey({sectionKey: libKey, baseURL: baseURL, accessToken: accessToken})
|
||||
log.debug(`Get Section size as: ${libSize}`)
|
||||
const libSize = await et.getSectionSizeByKey({sectionKey: libKey, baseURL: baseURL, accessToken: accessToken, libType: libType})
|
||||
log.debug(`Got Section size as: ${libSize}`)
|
||||
// Find LibType steps
|
||||
const step = wtconfig.get("PMS.ContainerSize." + libType)
|
||||
log.debug(`Get Step size as: ${step}`)
|
||||
log.debug(`Got Step size as: ${step}`)
|
||||
// Now read the fields and level defs
|
||||
|
||||
// Current item
|
||||
let idx = 0
|
||||
// Now let's walk the section
|
||||
let chuncks, postURI
|
||||
const element = '/library/sections/' + libKey
|
||||
console.log('Ged 1 HER')
|
||||
let element = '/library/sections/' + libKey
|
||||
let size
|
||||
do {
|
||||
if (libType == 'photo')
|
||||
{
|
||||
postURI = `/all?addedAt>>=-2208992400&X-Plex-Container-Start=${idx}&X-Plex-Container-Size=${step}&type=${this.mediaType[libType]}&${this.uriParams}`;
|
||||
}
|
||||
else if (libType == 'playlist')
|
||||
{
|
||||
element = '/playlists/' + libKey;
|
||||
postURI = `/items?X-Plex-Container-Start=${idx}&X-Plex-Container-Size=${step}`;
|
||||
}
|
||||
else
|
||||
{
|
||||
postURI = `/all?X-Plex-Container-Start=${idx}&X-Plex-Container-Size=${step}&type=${this.mediaType[libType]}&${this.uriParams}`;
|
||||
|
@ -104,11 +107,20 @@ const et = new class ET {
|
|||
return sectionData;
|
||||
}
|
||||
|
||||
async getSectionSizeByKey({sectionKey, baseURL, accessToken})
|
||||
async getSectionSizeByKey({sectionKey, baseURL, accessToken, libType})
|
||||
{
|
||||
const sizeURI = '/library/sections/' + sectionKey
|
||||
const sizePostURI = '/all?X-Plex-Container-Start=0&X-Plex-Container-Size=0'
|
||||
const sizeContents = await et.getItemData({baseURL: baseURL, accessToken: accessToken, element: sizeURI, postURI: sizePostURI});
|
||||
let sizeURI, sizePostURI, sizeContents;
|
||||
if (libType == 'playlist')
|
||||
{
|
||||
sizeURI = '/playlists/' + sectionKey
|
||||
sizePostURI = '/items?X-Plex-Container-Start=0&X-Plex-Container-Size=0'
|
||||
}
|
||||
else
|
||||
{
|
||||
sizeURI = '/library/sections/' + sectionKey
|
||||
sizePostURI = '/all?X-Plex-Container-Start=0&X-Plex-Container-Size=0'
|
||||
}
|
||||
sizeContents = await et.getItemData({baseURL: baseURL, accessToken: accessToken, element: sizeURI, postURI: sizePostURI});
|
||||
const size = await JSONPath({path: '$..totalSize', json: sizeContents});
|
||||
return size
|
||||
}
|
||||
|
@ -127,9 +139,10 @@ const et = new class ET {
|
|||
{
|
||||
const url = baseURL + element + postURI;
|
||||
this.PMSHeader["X-Plex-Token"] = accessToken;
|
||||
//log.verbose(`Calling url: ${url}`)
|
||||
log.verbose(`Calling url: ${url}`)
|
||||
let response = await fetch(url, { method: 'GET', headers: this.PMSHeader});
|
||||
let resp = await response.json();
|
||||
log.verbose(`Response in getItemData: ${JSON.stringify(resp)}`)
|
||||
return resp
|
||||
}
|
||||
|
||||
|
@ -256,8 +269,13 @@ const et = new class ET {
|
|||
// code block
|
||||
def = JSON.parse(JSON.stringify(require('./../defs/def-Photo.json')));
|
||||
break;
|
||||
case 'playlist':
|
||||
// code block
|
||||
def = JSON.parse(JSON.stringify(require('./../defs/def-Playlist.json')));
|
||||
break;
|
||||
default:
|
||||
// code block
|
||||
log.error(`Unknown libtype: "${libType}" or level: "${level}" in "getLevelFields"`);
|
||||
}
|
||||
let levels = def[libType]['level'][realName];
|
||||
if (levels == undefined)
|
||||
|
@ -511,7 +529,7 @@ const excel2 = new class Excel {
|
|||
|
||||
GetHeader(Level, libType) {
|
||||
const columns = []
|
||||
log.verbose(`AddHeader level: ${Level} - libType: ${libType}`)
|
||||
log.verbose(`GetHeader level: ${Level} - libType: ${libType}`)
|
||||
// Get level fields
|
||||
const fields = et.getLevelFields(Level, libType)
|
||||
for (var i=0; i<fields.length; i++) {
|
||||
|
|
|
@ -157,7 +157,6 @@
|
|||
});
|
||||
},
|
||||
getUsers: async function(){
|
||||
console.log('Ged77')
|
||||
this.selUserWait = false;
|
||||
var userLst = this.$store.getters.getUsers;
|
||||
// Output store
|
||||
|
@ -176,7 +175,6 @@
|
|||
}
|
||||
this.selUserOptions = result;
|
||||
this.selUserWait = true;
|
||||
console.log('Ged77-2')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue