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",
|
||||
"description": "WebTools Next Generation 4 Plex",
|
||||
"author": "dane22 & CPSO",
|
||||
"license": "MPL-2.0",
|
||||
"homepage": "https://github.com/WebTools-NG/WebTools-NG",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service electron:serve",
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB |
|
@ -105,6 +105,7 @@
|
|||
"RadioMovies": "Movies",
|
||||
"RadioTVSeries": "TV Series",
|
||||
"RadioTVEpisodes": "TV Episodes",
|
||||
"RadioTVShowEpisodes": "TV Shows and Episodes",
|
||||
"RadioMusic": "Music",
|
||||
"RadioPhotos": "Photos",
|
||||
"RadioOtherVideos": "Other Videos",
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 6.7 KiB |
|
@ -105,7 +105,9 @@
|
|||
selLevelName: "",
|
||||
optionsMediaType: [
|
||||
{ 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.RadioPhotos'), value: 'photo', disabled: true },
|
||||
{ text: i18n.t('Modules.ET.RadioOtherVideos'), value: 'other', disabled: true }
|
||||
|
@ -139,9 +141,10 @@
|
|||
return this.$store.getters.getSelectedServerAddressUpdateInProgress
|
||||
},
|
||||
exportLevels: function() {
|
||||
et.getLevelDisplayName('My Level', this.selMediaType)
|
||||
et.getLevelDisplayName('My Level', this.selMediaType);
|
||||
// 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 options = []
|
||||
const item = {}
|
||||
|
@ -183,15 +186,20 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
getPMSSections: async function(){
|
||||
|
||||
getPMSSections: async function(){
|
||||
this.selLibrary = "Loading...";
|
||||
await this.$store.dispatch('fetchSections')
|
||||
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) {
|
||||
sections.forEach(req => {
|
||||
if (req.type == this.selMediaType) {
|
||||
if (req.type == targetType) {
|
||||
log.debug(`pushing library: ${req.title} to results`);
|
||||
let item = [];
|
||||
item['text']=req.title;
|
||||
|
@ -216,7 +224,8 @@
|
|||
changeType: function() {
|
||||
// Triggers when lib type is changed
|
||||
this.selLibrary = '';
|
||||
this.selLevel = '';
|
||||
this.selLevel = '';
|
||||
this.getPMSSections();
|
||||
this.$store.commit("UPDATE_SELECTEDLIBTYPE", this.selMediaType);
|
||||
},
|
||||
selectExportLevel: function() {
|
||||
|
|
|
@ -1134,6 +1134,7 @@
|
|||
"episode": {
|
||||
"levels": {
|
||||
"Level 1": "level1",
|
||||
"Level 2": "level2",
|
||||
"Tommy": "tommy"
|
||||
},
|
||||
"LevelCount": {
|
||||
|
@ -1147,12 +1148,64 @@
|
|||
},
|
||||
"level": {
|
||||
"tommy": [
|
||||
"Title",
|
||||
"Part Duration"
|
||||
"Media ID"
|
||||
|
||||
|
||||
],
|
||||
"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": [
|
||||
|
||||
"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": {
|
||||
"Media ID":
|
||||
|
@ -1220,7 +1273,33 @@
|
|||
"key": "$.userRating",
|
||||
"call": 1,
|
||||
"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})
|
||||
{
|
||||
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
|
||||
const libKey = await et.getSectionKey({libName: sectionName, baseURL: baseURL, accessToken: accessToken})
|
||||
log.debug(`Get SectionKey as: ${libKey}`)
|
||||
|
@ -42,7 +42,14 @@ 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}`;
|
||||
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});
|
||||
size = JSONPath({path: '$.MediaContainer.size', json: chuncks});
|
||||
log.verbose(`getSectionData chunck size is ${size} and idx is ${idx}`)
|
||||
|
@ -89,7 +96,8 @@ const et = new class ET {
|
|||
}
|
||||
|
||||
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]
|
||||
return levelName
|
||||
}
|
||||
|
@ -121,7 +129,7 @@ const et = new class ET {
|
|||
}
|
||||
|
||||
getLevelDisplayName(level, libType){
|
||||
// return displayname fort with buildin levels
|
||||
// return displayname for the buildin levels
|
||||
const levels = et.getLevels(libType)
|
||||
let result = '';
|
||||
loop1:
|
||||
|
@ -163,7 +171,8 @@ const et = new class ET {
|
|||
|
||||
getLevelFields(level, libType) {
|
||||
// return fields in a level
|
||||
const out = []
|
||||
const out = []
|
||||
console.log('GED getLevelFields LibType: ' + libType)
|
||||
const levels = def[libType]['level'][et.getRealLevelName(level, libType)]
|
||||
Object.keys(levels).forEach(function(key) {
|
||||
out.push(levels[key])
|
||||
|
@ -180,7 +189,8 @@ const et = new class ET {
|
|||
|
||||
getLevels(libType) {
|
||||
// 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))
|
||||
return levels
|
||||
}
|
||||
|
@ -196,6 +206,7 @@ const et = new class ET {
|
|||
getLevelKeys(libType){
|
||||
// Only return the keys for possible levels
|
||||
const out = []
|
||||
console.log('GED getLevelKeys LibType: ' + libType)
|
||||
const levels = def[libType]['levels']
|
||||
Object.keys(levels).forEach(function(key) {
|
||||
out.push(key)
|
||||
|
@ -483,7 +494,8 @@ const excel2 = new class Excel {
|
|||
}
|
||||
|
||||
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
|
||||
const fields = et.getFields( libType, level)
|
||||
let lookup, val, array, i, valArray, valArrayVal, subType, subKey
|
||||
|
@ -491,7 +503,8 @@ const excel2 = new class Excel {
|
|||
let result = ''
|
||||
for (var x=0; x<fields.length; 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]}))) {
|
||||
case "string":
|
||||
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 {et} from '../../components/modules/ExportTools/et'
|
||||
const log = require('electron-log');
|
||||
|
@ -44,22 +43,20 @@ const actions = {
|
|||
var baseURL = getters.getSelectedServerAddress
|
||||
var accessToken = getters.getSelectedServerToken
|
||||
commit('UPDATE_SECTIONS', await et.getSections(baseURL, accessToken))
|
||||
},
|
||||
exportMedias({ commit, getters }) {
|
||||
// Vars OK
|
||||
},
|
||||
exportMedias({ getters }) {
|
||||
var baseURL = getters.getSelectedServerAddress
|
||||
var accessToken = getters.getSelectedServerToken
|
||||
var libType = getters.getLibType
|
||||
var levelName = et.getLevelDisplayName(getters.getSelectedExportLevel, libType)
|
||||
var key = getters.getSelectedSection
|
||||
var mediaSize = ''
|
||||
var calcSize = 0
|
||||
var libName = et.getLibDisplayName(getters.getSelectedSection, getters.getPmsSections)
|
||||
libName, levelName, libType, 'xlsx', baseURL, accessToken
|
||||
excel2
|
||||
axios, commit, key, mediaSize, calcSize
|
||||
excel2.createOutFile( {libName: libName, level: levelName, libType: libType, baseURL: baseURL, accessToken: accessToken} );
|
||||
|
||||
var levelName = et.getLevelDisplayName(getters.getSelectedExportLevel, libType)
|
||||
var libName = et.getLibDisplayName(getters.getSelectedSection, getters.getPmsSections)
|
||||
excel2.createOutFile( {
|
||||
libName: libName,
|
||||
level: levelName,
|
||||
libType: libType,
|
||||
baseURL: baseURL,
|
||||
accessToken: accessToken
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,27 +9,22 @@ module.exports = {
|
|||
enableInSFC: false
|
||||
},
|
||||
electronBuilder: {
|
||||
builderOptions: {
|
||||
builderOptions: {
|
||||
appId: "com.webtools.webtools-ng",
|
||||
"extraResources": [
|
||||
{
|
||||
"from": "./public/locales",
|
||||
"to": "locales"
|
||||
}
|
||||
],
|
||||
"linux": {
|
||||
"category": "Utility"
|
||||
linux: {
|
||||
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