Save metadata and media info export level to database

This commit is contained in:
JonnyWong16 2020-09-27 16:56:40 -07:00
parent 3973c57020
commit 4e29960238
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
5 changed files with 43 additions and 10 deletions

View file

@ -573,6 +573,8 @@ DOCUMENTATION :: END
<th align="left" id="rating_key">Rating Key</th> <th align="left" id="rating_key">Rating Key</th>
<th align="left" id="filename">Filename</th> <th align="left" id="filename">Filename</th>
<th align="left" id="file_format">File Format</th> <th align="left" id="file_format">File Format</th>
<th align="left" id="metadata_level">Metadata Level</th>
<th align="left" id="media_info_level">Media Info Level</th>
<th align="left" id="file_size">File Size</th> <th align="left" id="file_size">File Size</th>
<th align="left" id="complete">Download</th> <th align="left" id="complete">Download</th>
<th align="left" id="delete">Delete</th> <th align="left" id="delete">Delete</th>

View file

@ -39,7 +39,7 @@ export_table_options = {
$(td).html(moment(cellData, "X").format(date_format + ' ' + time_format)); $(td).html(moment(cellData, "X").format(date_format + ' ' + time_format));
} }
}, },
"width": "10%", "width": "8%",
"className": "no-wrap" "className": "no-wrap"
}, },
{ {
@ -76,7 +76,7 @@ export_table_options = {
} }
} }
}, },
"width": "50%", "width": "40%",
"className": "no-wrap" "className": "no-wrap"
}, },
{ {
@ -96,6 +96,28 @@ export_table_options = {
}, },
{ {
"targets": [5], "targets": [5],
"data": "metadata_level",
"createdCell": function (td, cellData, rowData, row, col) {
if (cellData !== null) {
$(td).html(cellData);
}
},
"width": "6%",
"className": "no-wrap"
},
{
"targets": [6],
"data": "media_info_level",
"createdCell": function (td, cellData, rowData, row, col) {
if (cellData !== null) {
$(td).html(cellData);
}
},
"width": "6%",
"className": "no-wrap"
},
{
"targets": [7],
"data": "file_size", "data": "file_size",
"createdCell": function (td, cellData, rowData, row, col) { "createdCell": function (td, cellData, rowData, row, col) {
if (cellData !== '' && cellData !== null) { if (cellData !== '' && cellData !== null) {
@ -106,7 +128,7 @@ export_table_options = {
"className": "no-wrap" "className": "no-wrap"
}, },
{ {
"targets": [6], "targets": [8],
"data": "complete", "data": "complete",
"createdCell": function (td, cellData, rowData, row, col) { "createdCell": function (td, cellData, rowData, row, col) {
if (cellData === 1 && rowData['exists']) { if (cellData === 1 && rowData['exists']) {
@ -123,7 +145,7 @@ export_table_options = {
"className": "export_download" "className": "export_download"
}, },
{ {
"targets": [7], "targets": [9],
"data": null, "data": null,
"createdCell": function (td, cellData, rowData, row, col) { "createdCell": function (td, cellData, rowData, row, col) {
if (rowData['complete'] !== 0) { if (rowData['complete'] !== 0) {

View file

@ -344,6 +344,8 @@ DOCUMENTATION :: END
<th align="left" id="rating_key">Rating Key</th> <th align="left" id="rating_key">Rating Key</th>
<th align="left" id="filename">Filename</th> <th align="left" id="filename">Filename</th>
<th align="left" id="file_format">File Format</th> <th align="left" id="file_format">File Format</th>
<th align="left" id="metadata_level">Metadata Level</th>
<th align="left" id="media_info_level">Media Info Level</th>
<th align="left" id="file_size">File Size</th> <th align="left" id="file_size">File Size</th>
<th align="left" id="complete">Download</th> <th align="left" id="complete">Download</th>
<th align="left" id="delete">Delete</th> <th align="left" id="delete">Delete</th>

View file

@ -797,7 +797,9 @@ def dbcheck():
c_db.execute( c_db.execute(
'CREATE TABLE IF NOT EXISTS exports (id INTEGER PRIMARY KEY AUTOINCREMENT, ' 'CREATE TABLE IF NOT EXISTS exports (id INTEGER PRIMARY KEY AUTOINCREMENT, '
'timestamp INTEGER, section_id INTEGER, rating_key INTEGER, media_type TEXT, ' 'timestamp INTEGER, section_id INTEGER, rating_key INTEGER, media_type TEXT, '
'filename TEXT, file_format TEXT, include_images INTEGER DEFAULT 0, ' 'filename TEXT, file_format TEXT, '
'metadata_level INTEGER, media_info_level INTEGER, include_images INTEGER DEFAULT 0, '
'custom_fields TEXT, '
'file_size INTEGER DEFAULT 0, complete INTEGER DEFAULT 0)' 'file_size INTEGER DEFAULT 0, complete INTEGER DEFAULT 0)'
) )

View file

@ -86,7 +86,6 @@ class Export(object):
self.timestamp = helpers.timestamp() self.timestamp = helpers.timestamp()
self.media_type = None self.media_type = None
self.sub_media_type = None
self.items = [] self.items = []
self.filename = None self.filename = None
@ -1421,9 +1420,6 @@ class Export(object):
item = plex.get_item(self.rating_key) item = plex.get_item(self.rating_key)
self.media_type = item.type self.media_type = item.type
if self.media_type == 'collection':
self.sub_media_type = item.subtype
if self.media_type != 'playlist': if self.media_type != 'playlist':
self.section_id = item.librarySectionID self.section_id = item.librarySectionID
@ -1511,7 +1507,10 @@ class Export(object):
values = {'file_format': self.file_format, values = {'file_format': self.file_format,
'filename': self.filename, 'filename': self.filename,
'include_images': self.include_images} 'metadata_level': self.metadata_level,
'media_info_level': self.media_info_level,
'include_images': self.include_images,
'custom_fields': self.custom_fields}
db = database.MonitorDatabase() db = database.MonitorDatabase()
try: try:
@ -1760,7 +1759,10 @@ def get_export_datatable(section_id=None, rating_key=None, kwargs=None):
'exports.media_type', 'exports.media_type',
'exports.filename', 'exports.filename',
'exports.file_format', 'exports.file_format',
'exports.metadata_level',
'exports.media_info_level',
'exports.include_images', 'exports.include_images',
'exports.custom_fields',
'exports.file_size', 'exports.file_size',
'exports.complete' 'exports.complete'
] ]
@ -1792,7 +1794,10 @@ def get_export_datatable(section_id=None, rating_key=None, kwargs=None):
'media_type_title': media_type_title, 'media_type_title': media_type_title,
'filename': item['filename'], 'filename': item['filename'],
'file_format': item['file_format'], 'file_format': item['file_format'],
'metadata_level': item['metadata_level'],
'media_info_level': item['media_info_level'],
'include_images': item['include_images'], 'include_images': item['include_images'],
'custom_fields': item['custom_fields'],
'file_size': item['file_size'], 'file_size': item['file_size'],
'complete': item['complete'], 'complete': item['complete'],
'exists': exists 'exists': exists