mirror of
https://github.com/WebTools-NG/WebTools-NG
synced 2024-11-23 03:23:05 +00:00
Merge pull request #127 from WebTools-NG/#94-Export-Episodes-as-well
#94 export episodes as well
This commit is contained in:
commit
2302a8f855
10 changed files with 193 additions and 47 deletions
|
@ -3,6 +3,8 @@
|
||||||
"version": "0.1.2",
|
"version": "0.1.2",
|
||||||
"description": "WebTools Next Generation 4 Plex",
|
"description": "WebTools Next Generation 4 Plex",
|
||||||
"author": "dane22 & CPSO",
|
"author": "dane22 & CPSO",
|
||||||
|
"license": "MPL-2.0",
|
||||||
|
"homepage": "https://github.com/WebTools-NG/WebTools-NG",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service electron:serve",
|
"serve": "vue-cli-service electron:serve",
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB |
|
@ -105,6 +105,7 @@
|
||||||
"RadioMovies": "Movies",
|
"RadioMovies": "Movies",
|
||||||
"RadioTVSeries": "TV Series",
|
"RadioTVSeries": "TV Series",
|
||||||
"RadioTVEpisodes": "TV Episodes",
|
"RadioTVEpisodes": "TV Episodes",
|
||||||
|
"RadioTVShowEpisodes": "TV Shows and Episodes",
|
||||||
"RadioMusic": "Music",
|
"RadioMusic": "Music",
|
||||||
"RadioPhotos": "Photos",
|
"RadioPhotos": "Photos",
|
||||||
"RadioOtherVideos": "Other Videos",
|
"RadioOtherVideos": "Other Videos",
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 6.7 KiB |
|
@ -106,6 +106,8 @@
|
||||||
optionsMediaType: [
|
optionsMediaType: [
|
||||||
{ text: i18n.t('Modules.ET.RadioMovies'), value: 'movie', disabled: false },
|
{ text: i18n.t('Modules.ET.RadioMovies'), value: 'movie', disabled: false },
|
||||||
{ text: i18n.t('Modules.ET.RadioTVSeries'), value: 'show', disabled: true },
|
{ text: i18n.t('Modules.ET.RadioTVSeries'), value: 'show', disabled: true },
|
||||||
|
{ text: i18n.t('Modules.ET.RadioTVEpisodes'), value: 'episode', disabled: false },
|
||||||
|
{ text: i18n.t('Modules.ET.RadioTVShowEpisodes'), value: 'showepisode', disabled: true },
|
||||||
{ text: i18n.t('Modules.ET.RadioMusic'), value: 'artist', disabled: true },
|
{ text: i18n.t('Modules.ET.RadioMusic'), value: 'artist', disabled: true },
|
||||||
{ text: i18n.t('Modules.ET.RadioPhotos'), value: 'photo', disabled: true },
|
{ text: i18n.t('Modules.ET.RadioPhotos'), value: 'photo', disabled: true },
|
||||||
{ text: i18n.t('Modules.ET.RadioOtherVideos'), value: 'other', disabled: true }
|
{ text: i18n.t('Modules.ET.RadioOtherVideos'), value: 'other', disabled: true }
|
||||||
|
@ -139,9 +141,10 @@
|
||||||
return this.$store.getters.getSelectedServerAddressUpdateInProgress
|
return this.$store.getters.getSelectedServerAddressUpdateInProgress
|
||||||
},
|
},
|
||||||
exportLevels: function() {
|
exportLevels: function() {
|
||||||
et.getLevelDisplayName('My Level', this.selMediaType)
|
et.getLevelDisplayName('My Level', this.selMediaType);
|
||||||
// Returns valid levels for selected media type
|
// Returns valid levels for selected media type
|
||||||
const etLevel = et.getLevels(this.selMediaType);
|
let targetType = this.selMediaType;
|
||||||
|
const etLevel = et.getLevels(targetType);
|
||||||
const etCustomLevel = et.getCustomLevels(this.selMediaType);
|
const etCustomLevel = et.getCustomLevels(this.selMediaType);
|
||||||
const options = []
|
const options = []
|
||||||
const item = {}
|
const item = {}
|
||||||
|
@ -184,14 +187,19 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getPMSSections: async function(){
|
getPMSSections: async function(){
|
||||||
|
|
||||||
this.selLibrary = "Loading...";
|
this.selLibrary = "Loading...";
|
||||||
await this.$store.dispatch('fetchSections')
|
await this.$store.dispatch('fetchSections')
|
||||||
const sections = await this.$store.getters.getPmsSections;
|
const sections = await this.$store.getters.getPmsSections;
|
||||||
const result = [];
|
const result = [];
|
||||||
|
// If episodes, we need to show shows
|
||||||
|
let targetType = this.selMediaType;
|
||||||
|
if (targetType == 'episode')
|
||||||
|
{
|
||||||
|
targetType = 'show'
|
||||||
|
}
|
||||||
if (Array.isArray(sections) && sections.length) {
|
if (Array.isArray(sections) && sections.length) {
|
||||||
sections.forEach(req => {
|
sections.forEach(req => {
|
||||||
if (req.type == this.selMediaType) {
|
if (req.type == targetType) {
|
||||||
log.debug(`pushing library: ${req.title} to results`);
|
log.debug(`pushing library: ${req.title} to results`);
|
||||||
let item = [];
|
let item = [];
|
||||||
item['text']=req.title;
|
item['text']=req.title;
|
||||||
|
@ -217,6 +225,7 @@
|
||||||
// Triggers when lib type is changed
|
// Triggers when lib type is changed
|
||||||
this.selLibrary = '';
|
this.selLibrary = '';
|
||||||
this.selLevel = '';
|
this.selLevel = '';
|
||||||
|
this.getPMSSections();
|
||||||
this.$store.commit("UPDATE_SELECTEDLIBTYPE", this.selMediaType);
|
this.$store.commit("UPDATE_SELECTEDLIBTYPE", this.selMediaType);
|
||||||
},
|
},
|
||||||
selectExportLevel: function() {
|
selectExportLevel: function() {
|
||||||
|
|
|
@ -1134,6 +1134,7 @@
|
||||||
"episode": {
|
"episode": {
|
||||||
"levels": {
|
"levels": {
|
||||||
"Level 1": "level1",
|
"Level 1": "level1",
|
||||||
|
"Level 2": "level2",
|
||||||
"Tommy": "tommy"
|
"Tommy": "tommy"
|
||||||
},
|
},
|
||||||
"LevelCount": {
|
"LevelCount": {
|
||||||
|
@ -1147,12 +1148,64 @@
|
||||||
},
|
},
|
||||||
"level": {
|
"level": {
|
||||||
"tommy": [
|
"tommy": [
|
||||||
"Title",
|
"Media ID"
|
||||||
"Part Duration"
|
|
||||||
|
|
||||||
|
],
|
||||||
|
"verified": [
|
||||||
|
"Series Title",
|
||||||
|
"Episode Sort Title",
|
||||||
|
"Episode Title",
|
||||||
|
"Year",
|
||||||
|
"Season",
|
||||||
|
"Episode",
|
||||||
|
"Content Rating",
|
||||||
|
"Summary",
|
||||||
|
"Rating",
|
||||||
|
"User Rating"
|
||||||
|
|
||||||
|
],
|
||||||
|
"Clear Fields": [
|
||||||
|
|
||||||
|
"Writers",
|
||||||
|
"Duration",
|
||||||
|
"Added",
|
||||||
|
"Updated",
|
||||||
|
"Poster url",
|
||||||
|
"Collection",
|
||||||
|
"Locked Fields",
|
||||||
|
"View Count"
|
||||||
|
],
|
||||||
|
"Invalid, belongs to shows": [
|
||||||
|
"Studio",
|
||||||
|
"Originally Aired",
|
||||||
|
"Directors"
|
||||||
|
|
||||||
],
|
],
|
||||||
"level1": [
|
"level1": [
|
||||||
|
"Media ID",
|
||||||
|
"Series Title",
|
||||||
|
"Episode Sort Title",
|
||||||
|
"Episode Title",
|
||||||
|
"Year",
|
||||||
|
"Season",
|
||||||
|
"Episode",
|
||||||
|
"Content Rating",
|
||||||
|
"Summary",
|
||||||
|
"Rating",
|
||||||
|
"User Rating"
|
||||||
|
],
|
||||||
|
"level2": [
|
||||||
|
"Writers",
|
||||||
|
"Duration",
|
||||||
|
"Added",
|
||||||
|
"Updated",
|
||||||
|
"Poster url",
|
||||||
|
"Collection",
|
||||||
|
"Locked Fields",
|
||||||
|
"View Count"
|
||||||
]
|
]
|
||||||
|
|
||||||
},
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
"Media ID":
|
"Media ID":
|
||||||
|
@ -1220,7 +1273,33 @@
|
||||||
"key": "$.userRating",
|
"key": "$.userRating",
|
||||||
"call": 1,
|
"call": 1,
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
},
|
||||||
|
"Studio":
|
||||||
|
{
|
||||||
|
"key": "$.studio",
|
||||||
|
"call": 1,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"Originally Aired":
|
||||||
|
{},
|
||||||
|
"Directors":
|
||||||
|
{},
|
||||||
|
"Writers":
|
||||||
|
{},
|
||||||
|
"Duration":
|
||||||
|
{},
|
||||||
|
"Added":
|
||||||
|
{},
|
||||||
|
"Updated":
|
||||||
|
{},
|
||||||
|
"Poster url":
|
||||||
|
{},
|
||||||
|
"Collection":
|
||||||
|
{},
|
||||||
|
"Locked Fields":
|
||||||
|
{},
|
||||||
|
"View Count":
|
||||||
|
{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ const et = new class ET {
|
||||||
async getSectionData({sectionName, baseURL, accessToken, libType})
|
async getSectionData({sectionName, baseURL, accessToken, libType})
|
||||||
{
|
{
|
||||||
const sectionData = []
|
const sectionData = []
|
||||||
log.info(`Starting getSectionData with Name: ${sectionName}`)
|
log.info(`Starting getSectionData with Name: ${sectionName} and with a type of: ${libType}`)
|
||||||
// Get Section Key
|
// Get Section Key
|
||||||
const libKey = await et.getSectionKey({libName: sectionName, baseURL: baseURL, accessToken: accessToken})
|
const libKey = await et.getSectionKey({libName: sectionName, baseURL: baseURL, accessToken: accessToken})
|
||||||
log.debug(`Get SectionKey as: ${libKey}`)
|
log.debug(`Get SectionKey as: ${libKey}`)
|
||||||
|
@ -43,6 +43,13 @@ const et = new class ET {
|
||||||
let size
|
let size
|
||||||
do {
|
do {
|
||||||
postURI = `/all?X-Plex-Container-Start=${idx}&X-Plex-Container-Size=${step}`;
|
postURI = `/all?X-Plex-Container-Start=${idx}&X-Plex-Container-Size=${step}`;
|
||||||
|
if (libType == 'episode')
|
||||||
|
{
|
||||||
|
console.log('Ged Episodes needed, so adding the type')
|
||||||
|
console.log('Ged url called: ' + baseURL + element + postURI)
|
||||||
|
postURI += '&type=4'
|
||||||
|
}
|
||||||
|
console.log('GED postURI: ' + postURI)
|
||||||
chuncks = await et.getItemData({baseURL: baseURL, accessToken: accessToken, element: element, postURI: postURI});
|
chuncks = await et.getItemData({baseURL: baseURL, accessToken: accessToken, element: element, postURI: postURI});
|
||||||
size = JSONPath({path: '$.MediaContainer.size', json: chuncks});
|
size = JSONPath({path: '$.MediaContainer.size', json: chuncks});
|
||||||
log.verbose(`getSectionData chunck size is ${size} and idx is ${idx}`)
|
log.verbose(`getSectionData chunck size is ${size} and idx is ${idx}`)
|
||||||
|
@ -90,6 +97,7 @@ const et = new class ET {
|
||||||
|
|
||||||
getRealLevelName(level, libType) {
|
getRealLevelName(level, libType) {
|
||||||
// First get the real name of the level, and not just the display name
|
// First get the real name of the level, and not just the display name
|
||||||
|
console.log('GED getRealLevelName LibType: ' + libType)
|
||||||
const levelName = def[libType]['levels'][level]
|
const levelName = def[libType]['levels'][level]
|
||||||
return levelName
|
return levelName
|
||||||
}
|
}
|
||||||
|
@ -121,7 +129,7 @@ const et = new class ET {
|
||||||
}
|
}
|
||||||
|
|
||||||
getLevelDisplayName(level, libType){
|
getLevelDisplayName(level, libType){
|
||||||
// return displayname fort with buildin levels
|
// return displayname for the buildin levels
|
||||||
const levels = et.getLevels(libType)
|
const levels = et.getLevels(libType)
|
||||||
let result = '';
|
let result = '';
|
||||||
loop1:
|
loop1:
|
||||||
|
@ -164,6 +172,7 @@ const et = new class ET {
|
||||||
getLevelFields(level, libType) {
|
getLevelFields(level, libType) {
|
||||||
// return fields in a level
|
// return fields in a level
|
||||||
const out = []
|
const out = []
|
||||||
|
console.log('GED getLevelFields LibType: ' + libType)
|
||||||
const levels = def[libType]['level'][et.getRealLevelName(level, libType)]
|
const levels = def[libType]['level'][et.getRealLevelName(level, libType)]
|
||||||
Object.keys(levels).forEach(function(key) {
|
Object.keys(levels).forEach(function(key) {
|
||||||
out.push(levels[key])
|
out.push(levels[key])
|
||||||
|
@ -181,6 +190,7 @@ const et = new class ET {
|
||||||
getLevels(libType) {
|
getLevels(libType) {
|
||||||
// Returns an json of levels for a selected type og medias, like 'movie'
|
// Returns an json of levels for a selected type og medias, like 'movie'
|
||||||
const levels = def[libType]['levels']
|
const levels = def[libType]['levels']
|
||||||
|
console.log('GED getLevels LibType: ' + libType)
|
||||||
log.debug('ET LevelNames: ' + JSON.stringify(levels))
|
log.debug('ET LevelNames: ' + JSON.stringify(levels))
|
||||||
return levels
|
return levels
|
||||||
}
|
}
|
||||||
|
@ -196,6 +206,7 @@ const et = new class ET {
|
||||||
getLevelKeys(libType){
|
getLevelKeys(libType){
|
||||||
// Only return the keys for possible levels
|
// Only return the keys for possible levels
|
||||||
const out = []
|
const out = []
|
||||||
|
console.log('GED getLevelKeys LibType: ' + libType)
|
||||||
const levels = def[libType]['levels']
|
const levels = def[libType]['levels']
|
||||||
Object.keys(levels).forEach(function(key) {
|
Object.keys(levels).forEach(function(key) {
|
||||||
out.push(key)
|
out.push(key)
|
||||||
|
@ -483,7 +494,8 @@ const excel2 = new class Excel {
|
||||||
}
|
}
|
||||||
|
|
||||||
async addRowToTmp( { libType, level, data, stream }) {
|
async addRowToTmp( { libType, level, data, stream }) {
|
||||||
// log.debug(`Start addRowToTmp. libType: ${libType} - level: ${level}`)
|
log.debug(`Start addRowToTmp. libType: ${libType} - level: ${level}`)
|
||||||
|
console.log('Ged data: ' + JSON.stringify(data))
|
||||||
let date, year, month, day, hours, minutes, seconds
|
let date, year, month, day, hours, minutes, seconds
|
||||||
const fields = et.getFields( libType, level)
|
const fields = et.getFields( libType, level)
|
||||||
let lookup, val, array, i, valArray, valArrayVal, subType, subKey
|
let lookup, val, array, i, valArray, valArrayVal, subType, subKey
|
||||||
|
@ -492,6 +504,7 @@ const excel2 = new class Excel {
|
||||||
for (var x=0; x<fields.length; x++) {
|
for (var x=0; x<fields.length; x++) {
|
||||||
var name = Object.keys(fields[x]);
|
var name = Object.keys(fields[x]);
|
||||||
lookup = JSONPath({path: '$..key', json: fields[x]})[0];
|
lookup = JSONPath({path: '$..key', json: fields[x]})[0];
|
||||||
|
console.log('Ged lookup: ' + lookup)
|
||||||
switch(String(JSONPath({path: '$..type', json: fields[x]}))) {
|
switch(String(JSONPath({path: '$..type', json: fields[x]}))) {
|
||||||
case "string":
|
case "string":
|
||||||
val = JSONPath({path: String(lookup), json: data})[0];
|
val = JSONPath({path: String(lookup), json: data})[0];
|
||||||
|
|
50
src/components/modules/ExportTools/sample/shows.json
Normal file
50
src/components/modules/ExportTools/sample/shows.json
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
"ratingKey":"1653",
|
||||||
|
"key":"/library/metadata/1653",
|
||||||
|
"parentRatingKey":"1643",
|
||||||
|
"grandparentRatingKey":"1642",
|
||||||
|
"guid":"com.plexapp.agents.thetvdb://356202/1/10?lang=en",
|
||||||
|
"parentGuid":"com.plexapp.agents.thetvdb://356202/1?lang=en",
|
||||||
|
"grandparentGuid":"com.plexapp.agents.thetvdb://356202?lang=en",
|
||||||
|
"type":"episode","title":"A City Upon a Hill",
|
||||||
|
"titleSort":"City Upon a Hill",
|
||||||
|
"grandparentKey":"/library/metadata/1642",
|
||||||
|
"parentKey":"/library/metadata/1643",
|
||||||
|
"grandparentTitle":"For All Mankind",
|
||||||
|
"parentTitle":"Season 1",
|
||||||
|
"contentRating":"TV-MA",
|
||||||
|
"summary":"Ed handles a trespasser. Ellen and Deke chart a new course without Mission Control.",
|
||||||
|
"index":10,
|
||||||
|
"parentIndex":1,
|
||||||
|
"year":2019,
|
||||||
|
"thumb":"/library/metadata/1653/thumb/1577660763",
|
||||||
|
"art":"/library/metadata/1642/art/1577660764",
|
||||||
|
"parentThumb":"/library/metadata/1643/thumb/1577660764",
|
||||||
|
"grandparentThumb":"/library/metadata/1642/thumb/1577660764",
|
||||||
|
"grandparentArt":"/library/metadata/1642/art/1577660764",
|
||||||
|
"duration":4563104,
|
||||||
|
"originallyAvailableAt":"2019-12-20",
|
||||||
|
"addedAt":1577227543,
|
||||||
|
"updatedAt":1577660763,
|
||||||
|
"Media":[
|
||||||
|
{
|
||||||
|
"id":1506,"duration":4563104,"bitrate":4698,"width":1356,"height":678,
|
||||||
|
"aspectRatio":1.85,"audioChannels":6,"audioCodec":"eac3",
|
||||||
|
"videoCodec":"h264","videoResolution":"720","container":"mkv",
|
||||||
|
"videoFrameRate":"24p","videoProfile":"high",
|
||||||
|
"Part":[
|
||||||
|
{
|
||||||
|
"id":1516,"key":"/library/parts/1516/1577227543/file.mkv",
|
||||||
|
"duration":4563104,
|
||||||
|
"file":"/share/CACHEDEV1_DATA/video/shows/For All Mankind/Season 01/For.All.Mankind.S01E10.iNTERNAL.720p.WEB.H264-AMRAP.mkv",
|
||||||
|
"size":2679942218,"container":"mkv","indexes":"sd",
|
||||||
|
"videoProfile":"high"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Writer":[
|
||||||
|
{"tag":"Ben Nedivi"},
|
||||||
|
{"tag":"Matt Wolpert"}
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,4 +1,3 @@
|
||||||
import axios from 'axios';
|
|
||||||
import {excel2} from '../../components/modules/ExportTools/et'
|
import {excel2} from '../../components/modules/ExportTools/et'
|
||||||
import {et} from '../../components/modules/ExportTools/et'
|
import {et} from '../../components/modules/ExportTools/et'
|
||||||
const log = require('electron-log');
|
const log = require('electron-log');
|
||||||
|
@ -45,21 +44,19 @@ const actions = {
|
||||||
var accessToken = getters.getSelectedServerToken
|
var accessToken = getters.getSelectedServerToken
|
||||||
commit('UPDATE_SECTIONS', await et.getSections(baseURL, accessToken))
|
commit('UPDATE_SECTIONS', await et.getSections(baseURL, accessToken))
|
||||||
},
|
},
|
||||||
exportMedias({ commit, getters }) {
|
exportMedias({ getters }) {
|
||||||
// Vars OK
|
|
||||||
var baseURL = getters.getSelectedServerAddress
|
var baseURL = getters.getSelectedServerAddress
|
||||||
var accessToken = getters.getSelectedServerToken
|
var accessToken = getters.getSelectedServerToken
|
||||||
var libType = getters.getLibType
|
var libType = getters.getLibType
|
||||||
var levelName = et.getLevelDisplayName(getters.getSelectedExportLevel, libType)
|
var levelName = et.getLevelDisplayName(getters.getSelectedExportLevel, libType)
|
||||||
var key = getters.getSelectedSection
|
|
||||||
var mediaSize = ''
|
|
||||||
var calcSize = 0
|
|
||||||
var libName = et.getLibDisplayName(getters.getSelectedSection, getters.getPmsSections)
|
var libName = et.getLibDisplayName(getters.getSelectedSection, getters.getPmsSections)
|
||||||
libName, levelName, libType, 'xlsx', baseURL, accessToken
|
excel2.createOutFile( {
|
||||||
excel2
|
libName: libName,
|
||||||
axios, commit, key, mediaSize, calcSize
|
level: levelName,
|
||||||
excel2.createOutFile( {libName: libName, level: levelName, libType: libType, baseURL: baseURL, accessToken: accessToken} );
|
libType: libType,
|
||||||
|
baseURL: baseURL,
|
||||||
|
accessToken: accessToken
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,26 +10,21 @@ module.exports = {
|
||||||
},
|
},
|
||||||
electronBuilder: {
|
electronBuilder: {
|
||||||
builderOptions: {
|
builderOptions: {
|
||||||
|
appId: "com.webtools.webtools-ng",
|
||||||
"extraResources": [
|
"extraResources": [
|
||||||
{
|
{
|
||||||
"from": "./public/locales",
|
"from": "./public/locales",
|
||||||
"to": "locales"
|
"to": "locales"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"linux": {
|
linux: {
|
||||||
"category": "Utility"
|
category: "Utility",
|
||||||
|
icon: 'src/assets/WebTools-512.png'
|
||||||
|
},
|
||||||
|
win: {
|
||||||
|
icon: 'src/assets/WebTools-512.png'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ,
|
|
||||||
// chainWebpack: config => {
|
|
||||||
// config
|
|
||||||
// .plugin('html')
|
|
||||||
// .tap(args => {
|
|
||||||
// let v = JSON.stringify(require('./package.json').version)
|
|
||||||
// args[0]['process.env']['VERSION'] = v
|
|
||||||
// return args;
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue