diff --git a/data/interfaces/default/js/tables/export_table.js b/data/interfaces/default/js/tables/export_table.js index d0e8b6cb..780b7591 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": "8%", + "width": "7%", "className": "no-wrap" }, { @@ -84,10 +84,14 @@ export_table_options = { "data": "file_format", "createdCell": function (td, cellData, rowData, row, col) { if (cellData !== '') { - $(td).html(cellData); + var images = ''; + if (rowData['include_images']) { + images = ' + images'; + } + $(td).html(cellData + images); } }, - "width": "6%", + "width": "7%", "className": "no-wrap" }, { diff --git a/plexpy/__init__.py b/plexpy/__init__.py index 2ffb2c0b..4d176cd5 100644 --- a/plexpy/__init__.py +++ b/plexpy/__init__.py @@ -797,7 +797,8 @@ 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, file_format TEXT, file_size INTEGER DEFAULT 0, complete INTEGER DEFAULT 0)' + 'filename TEXT, file_format TEXT, include_images INTEGER DEFAULT 0, ' + 'file_size INTEGER DEFAULT 0, complete INTEGER DEFAULT 0)' ) # Upgrade sessions table from earlier versions diff --git a/plexpy/exporter.py b/plexpy/exporter.py index 94353b7a..9c9880c2 100644 --- a/plexpy/exporter.py +++ b/plexpy/exporter.py @@ -1271,6 +1271,11 @@ class Export(object): if level <= self.media_info_level: export_attrs_set.update(attrs) + if self.include_images: + for imgage_attr in ('artFile', 'thumbFile'): + if imgage_attr in media_attrs: + export_attrs_set.add(imgage_attr) + for attr in export_attrs_set: try: value = helpers.get_dict_value_by_path(media_attrs, attr) @@ -1324,6 +1329,14 @@ class Export(object): writer.writerows(flatten_result) self.file_size = os.path.getsize(filepath) + + if self.include_images: + images_folder = get_export_filepath('{}.images'.format(self.filename)) + for f in os.listdir(images_folder): + image_path = os.path.join(images_folder, f) + if os.path.isfile(image_path): + self.file_size += os.path.getsize(image_path) + self.success = True logger.info("Tautulli Exporter :: Successfully exported to '%s'", filepath) @@ -1344,7 +1357,8 @@ class Export(object): 'media_type': self.media_type} values = {'file_format': self.file_format, - 'filename': self.filename_ext} + 'filename': self.filename_ext, + 'include_images': self.include_images} db = database.MonitorDatabase() try: @@ -1493,6 +1507,7 @@ def get_export_datatable(section_id=None, rating_key=None, kwargs=None): 'exports.media_type', 'exports.filename', 'exports.file_format', + 'exports.include_images', 'exports.file_size', 'exports.complete' ] @@ -1524,6 +1539,7 @@ def get_export_datatable(section_id=None, rating_key=None, kwargs=None): 'media_type_title': media_type_title, 'filename': item['filename'], 'file_format': item['file_format'], + 'include_images': item['include_images'], 'file_size': item['file_size'], 'complete': item['complete'], 'exists': exists