mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 21:21:15 -07:00
Add include images to exporter
This commit is contained in:
parent
6f362ee2ad
commit
b1eab8bb0d
3 changed files with 26 additions and 5 deletions
|
@ -50,7 +50,7 @@ export_table_options = {
|
||||||
$(td).html(cellData);
|
$(td).html(cellData);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"width": "8%",
|
"width": "7%",
|
||||||
"className": "no-wrap"
|
"className": "no-wrap"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -84,10 +84,14 @@ export_table_options = {
|
||||||
"data": "file_format",
|
"data": "file_format",
|
||||||
"createdCell": function (td, cellData, rowData, row, col) {
|
"createdCell": function (td, cellData, rowData, row, col) {
|
||||||
if (cellData !== '') {
|
if (cellData !== '') {
|
||||||
$(td).html(cellData);
|
var images = '';
|
||||||
|
if (rowData['include_images']) {
|
||||||
|
images = ' + images';
|
||||||
|
}
|
||||||
|
$(td).html(cellData + images);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"width": "6%",
|
"width": "7%",
|
||||||
"className": "no-wrap"
|
"className": "no-wrap"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -797,7 +797,8 @@ 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, 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
|
# Upgrade sessions table from earlier versions
|
||||||
|
|
|
@ -1271,6 +1271,11 @@ class Export(object):
|
||||||
if level <= self.media_info_level:
|
if level <= self.media_info_level:
|
||||||
export_attrs_set.update(attrs)
|
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:
|
for attr in export_attrs_set:
|
||||||
try:
|
try:
|
||||||
value = helpers.get_dict_value_by_path(media_attrs, attr)
|
value = helpers.get_dict_value_by_path(media_attrs, attr)
|
||||||
|
@ -1324,6 +1329,14 @@ class Export(object):
|
||||||
writer.writerows(flatten_result)
|
writer.writerows(flatten_result)
|
||||||
|
|
||||||
self.file_size = os.path.getsize(filepath)
|
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
|
self.success = True
|
||||||
logger.info("Tautulli Exporter :: Successfully exported to '%s'", filepath)
|
logger.info("Tautulli Exporter :: Successfully exported to '%s'", filepath)
|
||||||
|
|
||||||
|
@ -1344,7 +1357,8 @@ class Export(object):
|
||||||
'media_type': self.media_type}
|
'media_type': self.media_type}
|
||||||
|
|
||||||
values = {'file_format': self.file_format,
|
values = {'file_format': self.file_format,
|
||||||
'filename': self.filename_ext}
|
'filename': self.filename_ext,
|
||||||
|
'include_images': self.include_images}
|
||||||
|
|
||||||
db = database.MonitorDatabase()
|
db = database.MonitorDatabase()
|
||||||
try:
|
try:
|
||||||
|
@ -1493,6 +1507,7 @@ 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.include_images',
|
||||||
'exports.file_size',
|
'exports.file_size',
|
||||||
'exports.complete'
|
'exports.complete'
|
||||||
]
|
]
|
||||||
|
@ -1524,6 +1539,7 @@ 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'],
|
||||||
|
'include_images': item['include_images'],
|
||||||
'file_size': item['file_size'],
|
'file_size': item['file_size'],
|
||||||
'complete': item['complete'],
|
'complete': item['complete'],
|
||||||
'exists': exists
|
'exists': exists
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue