From 125fa7070ea8492f6d7ea90714272e7ab9f78068 Mon Sep 17 00:00:00 2001 From: UKDTOM Date: Sun, 7 Mar 2021 22:33:32 +0100 Subject: [PATCH] #107 URL, snow with correct type param --- .../modules/ExportTools/scripts/et.js | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/components/modules/ExportTools/scripts/et.js b/src/components/modules/ExportTools/scripts/et.js index 52fd3f8..39b5326 100644 --- a/src/components/modules/ExportTools/scripts/et.js +++ b/src/components/modules/ExportTools/scripts/et.js @@ -41,6 +41,24 @@ const et = new class ET { this.typePlaylist = '15'; this.typePlaylist_Folder = '16'; this.typePodcast = '17'; + this.mediaType ={ + "movie": 1, + "show": 2, + "season": 3, + "episode": 4, + "trailer": 5, + "comic": 6, + "person": 7, + "artist": 8, + "album": 9, + "track": 10, + "clip": 12, + "photo": 13, + "photo_album": 14, + "playlist": 15, + "playlist_folder": 16, + "podcast": 17 + } } async getSectionData({sectionName, baseURL, accessToken, libType}) @@ -65,13 +83,8 @@ const et = new class ET { const element = '/library/sections/' + libKey let size do { - postURI = `/all?X-Plex-Container-Start=${idx}&X-Plex-Container-Size=${step}`; - if (libType == 'episode') - { - postURI += '&type=' + et.typeEpisode; - postURI += '&' + this.uriParams; - log.info(`Calling url ${baseURL + element + postURI}`) - } + postURI = `/all?X-Plex-Container-Start=${idx}&X-Plex-Container-Size=${step}&type=${this.mediaType[libType]}&${this.uriParams}`; + log.info(`Calling url ${baseURL + element + postURI}`); chuncks = await et.getItemData({baseURL: baseURL, accessToken: accessToken, element: element, postURI: postURI}); size = JSONPath({path: '$.MediaContainer.size', json: chuncks}); const totalSize = JSONPath({path: '$.MediaContainer.totalSize', json: chuncks});