#64 just saving progress for now

This commit is contained in:
UKDTOM 2020-06-18 02:23:32 +02:00
parent 26e2cce67d
commit 25d28dd63a
6 changed files with 3009 additions and 41 deletions

View file

@ -71,10 +71,10 @@
expanded
@input="selectExportLevel">
<option
v-for="option in levels"
:value="option.key"
:key="option.key">
{{ option.name }}
v-for="(value, name) in exportLevels"
:value="value"
:key="name">
{{ name }}
</option>
</b-select>
</b-field>
@ -93,13 +93,6 @@
</b-tab-item>
</b-tabs>
<hr>
<h1 class="title is-3">{{ $t("Modules.ET.HExportMedia") }}</h1>
@ -116,6 +109,7 @@
</template>
<script>
import {et} from './et'
//import {levels, level1, level2} from '../ExportTools/movieLevels'
const log = require('electron-log');
@ -124,17 +118,16 @@ export default {
data() {
return {
radio: 'movie',
activeTab: 0
activeTab: 0,
// activeTab: 0,
// levels: levels,
// level1: level1,
// level2: level2
}
},
created(){
created(){
log.info('ET Created')
this.fetchSelection()
//console.log(level2)
}, computed: {
pmsSections: function(){
let sections = this.$store.getters.getPmsSections
@ -143,15 +136,26 @@ export default {
log.debug("doing a forEach")
sections.forEach((req) => {
if (req.type == this.radio) {
log.debug("pushing library to results: " + req.title)
log.debug("pushing data to results")
result.push(req);
}
})
} else {
log.info("No library found")
result.push["No library found"]
log.info("No data found")
result.push["No Section found"]
}
return result
},
exportLevels: function(){
let levels=''
console.log('Nugga levels: ' + JSON.stringify(et.getLevels(this.radio)))
levels = et.getLevels(this.radio)
const libType = 'movie'
console.log('Possible levels key/val are: ' + JSON.stringify(et.getLevels(libType)))
return levels
}
}, methods: {
selectSelection: function (selected) {

View file

@ -11,7 +11,12 @@
},
"level": {
"testtommy": [
"Media ID", "Title", "Subtitle Header Compression"
"Sort title",
"View Count", "Last Viewed at",
"Writers",
"Country", "Duration", "Directors",
"Roles", "User Rating"
],
"level1": [
"Media ID", "Title", "Sort title",
@ -175,25 +180,25 @@
"fields": {
"Media ID":
{
"key": "MediaContainer.Metadata[0].ratingKey",
"key": "ratingKey",
"call": 1,
"type": "string"
},
"Title":
{
"key": "MediaContainer.Metadata[0].title",
"key": "title",
"call": 1,
"type": "string"
},
"Sort title":
{
"key": "MediaContainer.Metadata[0].titleSort",
"key": "titleSort",
"call": 1,
"type": "string"
},
"Studio":
{
"key": "MediaContainer.Metadata[0].studio",
"key": "studio",
"call": 1,
"type": "string"
},

View file

@ -2,6 +2,8 @@ var def = JSON.parse(JSON.stringify(require('./definitions.json')));
const log = require('electron-log');
import {wtconfig, wtutils} from '../../../wtutils'
const et = new class ET {
constructor() {
}
@ -59,6 +61,18 @@ const et = new class ET {
getFieldKey(libType, fieldName) {
return def[libType]['fields'][fieldName]['key']
}
getFieldsKeyVal( libType, level) {
// Get fields for level
const fields = et.getLevelFields(level, libType)
const out = []
fields.forEach(element => {
const item = {}
item[element] = et.getFieldKey(libType, element)
out.push(item)
});
return out
}
}
const excel = new class Excel {
@ -75,14 +89,15 @@ const excel = new class Excel {
AddHeader(Sheet, Level, libType) {
const columns = []
let key
//let key
// Get level fields
const fields = et.getLevelFields(Level, libType)
for (var i=0; i<fields.length; i++) {
key = et.getFieldKey(libType, fields[i])
log.debug('Column: ' + fields[i] + ' - ' + key)
//key = et.getFieldKey(libType, fields[i])
//log.debug('Column: ' + fields[i] + ' - ' + key)
log.debug('Column: ' + fields[i] + ' - ' + fields[i])
//let column = { header: Level[i], key: 'id', width: 10 }
let column = { header: fields[i], key: key }
let column = { header: fields[i], key: fields[i] }
columns.push(column)
}
Sheet.columns = columns
@ -128,6 +143,36 @@ const excel = new class Excel {
workbook.modified = new Date();
return workbook
}
addToSheet(sheet, libType, level, data) {
console.log('Start AddToSheet')
const jp = require('jsonpath')
// Placeholder for row
let row = []
// Need to find the fields and keys we'll
// query the data for
const keyVal = et.getFieldsKeyVal( libType, level)
// Now get the medias
const nodes = jp.nodes(data, '$.MediaContainer.Metadata[*]')
for (var x=0; x<nodes.length; x++) {
const mediaItem = nodes[x].value
const rowentry = {}
for (var i=0; i<keyVal.length; i++) {
let val = jp.value(mediaItem, Object.values(keyVal[i]))
if (val == null)
{
val = wtconfig.get('ET.NotAvail', 'N/A')
}
console.log('Media Item: ' + Object.keys(keyVal[i]) + ' has a value of: ' + val)
rowentry[Object.keys(keyVal[i])] = val
}
row.push(rowentry)
}
console.log('Entire rows: ' + JSON.stringify(row))
row.forEach(element => {
excel.AddRow(sheet, element)
});
}
}
export {et, excel};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,204 @@
{
"MediaContainer": {
"size": 30,
"totalSize": 2570,
"allowSync": true,
"art": "/:/resources/movie-fanart.jpg",
"identifier": "com.plexapp.plugins.library",
"librarySectionID": 4,
"librarySectionTitle": "Movies",
"librarySectionUUID": "611d44e2-c4cc-4cec-8b65-d77b037e1b3d",
"mediaTagPrefix": "/system/bundle/media/flags/",
"mediaTagVersion": 1576869286,
"offset": 31,
"thumb": "/:/resources/movie.png",
"title1": "Movies",
"title2": "All Movies",
"viewGroup": "movie",
"viewMode": 65592,
"Metadata": [
{
"ratingKey": "9042",
"key": "/library/metadata/9042",
"guid": "com.plexapp.agents.imdb://tt4385888?lang=en",
"studio": "Annapurna Pictures",
"type": "movie",
"title": "20th Century Women",
"contentRating": "dk/fr.u.7",
"summary": "In 1979 Santa Barbara, California, Dorothea Fields is a determined single mother in her mid-50s who is raising her adolescent son, Jamie, at a moment brimming with cultural change and rebellion. Dorothea enlists the help of two younger women Abbie, a free-spirited punk artist living as a boarder in the Fields' home and Julie, a savvy and provocative teenage neighbour to help with Jamie's upbringing.",
"rating": 8.9,
"audienceRating": 7.3,
"year": 2016,
"thumb": "/library/metadata/9042/thumb/1575678525",
"art": "/library/metadata/9042/art/1575678525",
"duration": 7124159,
"originallyAvailableAt": "2016-12-28",
"addedAt": 1490792202,
"updatedAt": 1575678525,
"audienceRatingImage": "rottentomatoes://image.rating.upright",
"chapterSource": "media",
"primaryExtraKey": "/library/metadata/9421",
"ratingImage": "rottentomatoes://image.rating.ripe",
"Media": [
{
"id": 9325,
"duration": 7124159,
"bitrate": 10980,
"width": 1920,
"height": 960,
"aspectRatio": 1.85,
"audioChannels": 6,
"audioCodec": "ac3",
"videoCodec": "h264",
"videoResolution": "1080",
"container": "mkv",
"videoFrameRate": "24p",
"audioProfile": "dts",
"videoProfile": "high",
"Part": [
{
"id": 29623,
"key": "/library/parts/29623/1567348678/file.mkv",
"duration": 7124159,
"file": "/share/CACHEDEV1_DATA/video/old-movies/#/20th Century Women (2016)/20th.Century.Women.2016.1080p.BluRay.x264-GECKOS.mkv",
"size": 9777930144,
"audioProfile": "dts",
"container": "mkv",
"videoProfile": "high"
}
]
}
],
"Genre": [
{
"tag": "Comedy"
},
{
"tag": "Drama"
}
],
"Director": [
{
"tag": "Mike Mills"
}
],
"Writer": [
{
"tag": "Mike Mills"
}
],
"Country": [
{
"tag": "USA"
}
],
"Role": [
{
"tag": "Alia Shawkat"
},
{
"tag": "Alison Elliott"
},
{
"tag": "Annette Bening"
}
]
},
{
"ratingKey": "9050",
"key": "/library/metadata/9050",
"guid": "com.plexapp.agents.imdb://tt0463854?lang=en",
"studio": "DNA Films",
"type": "movie",
"title": "28 Weeks Later",
"contentRating": "dk/15",
"summary": "The inhabitants of the British Isles have lost their battle against the onslaught of disease, as the deadly rage virus has killed every citizen there. Six months later, a group of Americans dare to set foot on the isles, convinced the danger has come and gone. But it soon becomes all too clear that the scourge continues to live, waiting to pounce on its next victims.",
"rating": 7.1,
"audienceRating": 6.7,
"year": 2007,
"tagline": "When days turn to weeks... the horror returns.",
"thumb": "/library/metadata/9050/thumb/1575678555",
"art": "/library/metadata/9050/art/1575678555",
"duration": 5757240,
"originallyAvailableAt": "2007-04-26",
"addedAt": 1186162396,
"updatedAt": 1575678555,
"audienceRatingImage": "rottentomatoes://image.rating.upright",
"chapterSource": "agent",
"primaryExtraKey": "/library/metadata/9454",
"ratingImage": "rottentomatoes://image.rating.ripe",
"Media": [
{
"id": 9333,
"duration": 5757240,
"bitrate": 1022,
"width": 592,
"height": 320,
"aspectRatio": 1.85,
"audioChannels": 2,
"audioCodec": "mp3",
"videoCodec": "mpeg4",
"videoResolution": "sd",
"container": "avi",
"videoFrameRate": "PAL",
"videoProfile": "advanced simple",
"Part": [
{
"id": 29662,
"key": "/library/parts/29662/1186162396/file.avi",
"duration": 5757240,
"file": "/share/CACHEDEV1_DATA/video/old-movies/#/28 Weeks Later (2007)/28 Weeks Later.avi",
"size": 735303680,
"container": "avi",
"videoProfile": "advanced simple"
}
]
}
],
"Genre": [
{
"tag": "Drama"
},
{
"tag": "Horror"
}
],
"Director": [
{
"tag": "Juan Carlos Fresnadillo"
}
],
"Writer": [
{
"tag": "Enrique López Lavigne"
},
{
"tag": "Jesús Olmo"
}
],
"Country": [
{
"tag": "United Kingdom"
}
],
"Collection": [
{
"tag": "28 Days/Weeks Later"
}
],
"Role": [
{
"tag": "Amanda Lawrence"
},
{
"tag": "Amanda Walker"
},
{
"tag": "Andrew Byron"
}
]
}
]
}
}

View file

@ -69,7 +69,9 @@ if (outDir)
// We export library named "Ged" of the type movie with a level of "Level 1"
const libName = 'Ged'
const level = 'Test Tommy'
//const level = 'Test Tommy'
const level = 'Level 2'
const libType = 'movie'
// Real stuff to use
@ -82,15 +84,10 @@ console.log('Possible levels key only names: ' + et.getLevelKeys(libType))
console.log('RealLevelName: ' + et.getRealLevelName(level, libType))
console.log('Fields in this level: ' + JSON.stringify(et.getLevelFields(level, libType)))
console.log('Fields in this level sorted: ' + JSON.stringify(et.getLevelFields(level, libType).sort()))
console.log('GetLevel calls: ' + et.getLevelCall(libType, level) )
const testimp = require('./components/modules/ExportTools/testimp.json')
excel
libName
/*
// EXCEL Stuff
// Create WorkBook
@ -100,17 +97,10 @@ const Sheet = excel.NewSheet(WorkBook, libName, level)
// Now add the header column
excel.AddHeader(Sheet, level, libType)
// Add a couple of Rows
let Row = []
Row = ['ged1', 'ged2', 'ged3']
excel.AddRow(Sheet, Row)
Row = ['ged2-1', 'ged2-2', 'ged2-3']
excel.AddRow(Sheet, Row)
excel.addToSheet(Sheet, libType, level, testimp)
// Save Excel file
excel.SaveWorkbook(WorkBook, libName, level, 'xlsx')
*/
new Vue({
render: h => h(App),
router: router,