diff --git a/data/interfaces/default/js/tables/export_table.js b/data/interfaces/default/js/tables/export_table.js
index cde8c815..5067da14 100644
--- a/data/interfaces/default/js/tables/export_table.js
+++ b/data/interfaces/default/js/tables/export_table.js
@@ -50,7 +50,7 @@ export_table_options = {
$(td).html(cellData);
}
},
- "width": "10%",
+ "width": "7%",
"className": "no-wrap"
},
{
@@ -61,22 +61,33 @@ export_table_options = {
$(td).html(cellData);
}
},
- "width": "10%",
+ "width": "7%",
"className": "no-wrap"
},
{
"targets": [3],
+ "data": "file_format",
+ "createdCell": function (td, cellData, rowData, row, col) {
+ if (cellData !== '') {
+ $(td).html(cellData);
+ }
+ },
+ "width": "7%",
+ "className": "no-wrap"
+ },
+ {
+ "targets": [4],
"data": "filename",
"createdCell": function (td, cellData, rowData, row, col) {
if (cellData !== '') {
$(td).html(cellData);
}
},
- "width": "60%",
+ "width": "55%",
"className": "no-wrap"
},
{
- "targets": [4],
+ "targets": [5],
"data": "complete",
"createdCell": function (td, cellData, rowData, row, col) {
if (cellData === 1) {
@@ -85,7 +96,7 @@ export_table_options = {
$(td).html('');
}
},
- "width": "10%"
+ "width": "7%"
}
],
"drawCallback": function (settings) {
@@ -96,5 +107,10 @@ export_table_options = {
"preDrawCallback": function(settings) {
var msg = " Fetching rows...";
showMsg(msg, false, false, 0)
+ },
+ "rowCallback": function (row, rowData, rowIndex) {
+ if (rowData['complete'] !== 1) {
+ $(row).addClass('current-activity-row');
+ }
}
};
diff --git a/data/interfaces/default/library.html b/data/interfaces/default/library.html
index 9c0eef45..b0a915c6 100644
--- a/data/interfaces/default/library.html
+++ b/data/interfaces/default/library.html
@@ -336,6 +336,7 @@ DOCUMENTATION :: END
Exported At |
Media Type |
Rating Key |
+ Format |
Filename |
Download |
diff --git a/plexpy/__init__.py b/plexpy/__init__.py
index bf17d77f..0d45a017 100644
--- a/plexpy/__init__.py
+++ b/plexpy/__init__.py
@@ -1,4 +1,4 @@
-# This file is part of Tautulli.
+# This file is part of Tautulli.
#
# Tautulli is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -792,7 +792,7 @@ def dbcheck():
c_db.execute(
'CREATE TABLE IF NOT EXISTS exports (id INTEGER PRIMARY KEY AUTOINCREMENT, '
'timestamp INTEGER, section_id INTEGER, rating_key INTEGER, media_type TEXT, '
- 'filename TEXT, complete INTEGER DEFAULT 0)'
+ 'file_format TEXT, filename TEXT, complete INTEGER DEFAULT 0)'
)
# Upgrade sessions table from earlier versions
diff --git a/plexpy/exporter.py b/plexpy/exporter.py
index ee4cc152..5b010485 100644
--- a/plexpy/exporter.py
+++ b/plexpy/exporter.py
@@ -845,7 +845,7 @@ MEDIA_TYPES = {
}
-def export(section_id=None, rating_key=None, output_format='json'):
+def export(section_id=None, rating_key=None, file_format='json'):
timestamp = helpers.timestamp()
if not section_id and not rating_key:
@@ -857,8 +857,8 @@ def export(section_id=None, rating_key=None, output_format='json'):
elif rating_key and not str(rating_key).isdigit():
logger.error("Tautulli Exporter :: Export called with invalid rating_key '%s'.", rating_key)
return
- elif output_format not in ('json', 'csv'):
- logger.error("Tautulli Exporter :: Export called but invalid output_format '%s' provided.", output_format)
+ elif file_format not in ('json', 'csv'):
+ logger.error("Tautulli Exporter :: Export called but invalid file_format '%s' provided.", file_format)
return
plex = Plex(plexpy.CONFIG.PMS_URL, plexpy.CONFIG.PMS_TOKEN)
@@ -870,7 +870,7 @@ def export(section_id=None, rating_key=None, output_format='json'):
media_type = library.type
library_title = library.title
filename = 'Library - {} [{}].{}.{}'.format(
- library_title, section_id, helpers.timestamp_to_YMDHMS(timestamp), output_format)
+ library_title, section_id, helpers.timestamp_to_YMDHMS(timestamp), file_format)
items = library.all()
elif rating_key:
@@ -889,7 +889,7 @@ def export(section_id=None, rating_key=None, output_format='json'):
media_type = 'photo album'
filename = '{} - {} [{}].{}.{}'.format(
- media_type.title(), item_title, rating_key, helpers.timestamp_to_YMDHMS(timestamp), output_format)
+ media_type.title(), item_title, rating_key, helpers.timestamp_to_YMDHMS(timestamp), file_format)
items = [item]
@@ -915,11 +915,11 @@ def export(section_id=None, rating_key=None, output_format='json'):
with ThreadPool(processes=4) as pool:
result = pool.map(part, items)
- if output_format == 'json':
+ if file_format == 'json':
with open(filepath, 'w', encoding='utf-8') as outfile:
json.dump(result, outfile, indent=4, ensure_ascii=False, sort_keys=True)
- elif output_format == 'csv':
+ elif file_format == 'csv':
flatten_result = helpers.flatten_dict(result)
flatten_attrs = helpers.flatten_dict(attrs)
with open(filepath, 'w', encoding='utf-8', newline='') as outfile:
@@ -931,13 +931,14 @@ def export(section_id=None, rating_key=None, output_format='json'):
logger.info("Tautulli Exporter :: Successfully exported to '%s'", filepath)
-def set_export_state(timestamp, section_id, rating_key, media_type, filename):
+def set_export_state(timestamp, section_id, rating_key, media_type, file_format, filename):
keys = {'timestamp': timestamp,
'section_id': section_id,
'rating_key': rating_key,
'media_type': media_type}
- values = {'filename': filename}
+ values = {'file_format': file_format,
+ 'filename': filename}
db = database.MonitorDatabase()
try:
@@ -976,6 +977,7 @@ def get_export_datatable(section_id=None, rating_key=None, kwargs=None):
'exports.section_id',
'exports.rating_key',
'exports.media_type',
+ 'exports.file_format',
'exports.filename',
'exports.complete'
]
@@ -1004,6 +1006,7 @@ def get_export_datatable(section_id=None, rating_key=None, kwargs=None):
'rating_key': item['rating_key'],
'media_type': item['media_type'],
'media_type_title': media_type_title,
+ 'file_format': item['file_format'],
'filename': item['filename'],
'complete': item['complete']
}
diff --git a/plexpy/webserve.py b/plexpy/webserve.py
index ebff9d9f..2076e184 100644
--- a/plexpy/webserve.py
+++ b/plexpy/webserve.py
@@ -6480,10 +6480,10 @@ class WebInterface(object):
@cherrypy.tools.json_out()
@requireAuth(member_of("admin"))
@addtoapi()
- def export_metadata(self, section_id=None, rating_key=None, output_format='json', **kwargs):
+ def export_metadata(self, section_id=None, rating_key=None, file_format='json', **kwargs):
threading.Thread(target=exporter.export,
kwargs={'section_id': section_id,
'rating_key': rating_key,
- 'output_format': output_format}).start()
+ 'file_format': file_format}).start()
return {'result': 'success',
'message': 'Metadata export has started. Check the logs to monitor any problems.'}