mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Check exported file exists
This commit is contained in:
parent
de2e2ee962
commit
b872cce2a4
2 changed files with 9 additions and 3 deletions
|
@ -90,10 +90,12 @@ export_table_options = {
|
||||||
"targets": [5],
|
"targets": [5],
|
||||||
"data": "complete",
|
"data": "complete",
|
||||||
"createdCell": function (td, cellData, rowData, row, col) {
|
"createdCell": function (td, cellData, rowData, row, col) {
|
||||||
if (cellData === 1) {
|
if (cellData === 0 ) {
|
||||||
|
$(td).html('<button class="btn btn-xs btn-dark" data-id="' + rowData['row_id'] + '" disabled><i class="fa fa-spinner fa-spin fa-fw"></i> Processing</button>');
|
||||||
|
} else if (cellData === 1 && rowData['exists']) {
|
||||||
$(td).html('<button class="btn btn-xs btn-dark btn-download" data-id="' + rowData['row_id'] + '"><i class="fa fa-file-download fa-fw"></i> Download</button>');
|
$(td).html('<button class="btn btn-xs btn-dark btn-download" data-id="' + rowData['row_id'] + '"><i class="fa fa-file-download fa-fw"></i> Download</button>');
|
||||||
} else {
|
} else {
|
||||||
$(td).html('<button class="btn btn-xs btn-dark" data-id="' + rowData['row_id'] + '" disabled><i class="fa fa-spinner fa-spin fa-fw"></i> Processing</button>');
|
$(td).html('<button class="btn btn-xs btn-dark" data-id="' + rowData['row_id'] + '" disabled><i class="fa fa-question-circle fa-fw"></i> Not Found</button>');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"width": "7%"
|
"width": "7%"
|
||||||
|
|
|
@ -904,6 +904,7 @@ def export(section_id=None, rating_key=None, file_format='json'):
|
||||||
section_id=section_id,
|
section_id=section_id,
|
||||||
rating_key=rating_key,
|
rating_key=rating_key,
|
||||||
media_type=media_type,
|
media_type=media_type,
|
||||||
|
file_format=file_format,
|
||||||
filename=filename)
|
filename=filename)
|
||||||
if not export_id:
|
if not export_id:
|
||||||
logger.error("Tautulli Exporter :: Failed to export '%s'", filename)
|
logger.error("Tautulli Exporter :: Failed to export '%s'", filename)
|
||||||
|
@ -999,6 +1000,8 @@ def get_export_datatable(section_id=None, rating_key=None, kwargs=None):
|
||||||
rows = []
|
rows = []
|
||||||
for item in result:
|
for item in result:
|
||||||
media_type_title = item['media_type'].title()
|
media_type_title = item['media_type'].title()
|
||||||
|
filepath = os.path.join(plexpy.CONFIG.EXPORT_DIR, item['filename'])
|
||||||
|
exists = helpers.cast_to_int(os.path.isfile(filepath))
|
||||||
|
|
||||||
row = {'row_id': item['row_id'],
|
row = {'row_id': item['row_id'],
|
||||||
'timestamp': item['timestamp'],
|
'timestamp': item['timestamp'],
|
||||||
|
@ -1008,7 +1011,8 @@ def get_export_datatable(section_id=None, rating_key=None, kwargs=None):
|
||||||
'media_type_title': media_type_title,
|
'media_type_title': media_type_title,
|
||||||
'file_format': item['file_format'],
|
'file_format': item['file_format'],
|
||||||
'filename': item['filename'],
|
'filename': item['filename'],
|
||||||
'complete': item['complete']
|
'complete': item['complete'],
|
||||||
|
'exists': exists
|
||||||
}
|
}
|
||||||
|
|
||||||
rows.append(row)
|
rows.append(row)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue