diff --git a/data/interfaces/default/js/tables/history_table.js b/data/interfaces/default/js/tables/history_table.js
index d8d694db..73ee2b3a 100644
--- a/data/interfaces/default/js/tables/history_table.js
+++ b/data/interfaces/default/js/tables/history_table.js
@@ -73,7 +73,7 @@ history_table_options = {
$(td).html(cellData);
}
},
- "width": "7%",
+ "width": "9%",
"className": "no-wrap hidden-xs"
},
{
@@ -95,7 +95,7 @@ history_table_options = {
$(td).html('n/a');
}
},
- "width": "7%",
+ "width": "8%",
"className": "no-wrap hidden-md hidden-sm hidden-xs modal-control-ip"
},
{
@@ -106,7 +106,7 @@ history_table_options = {
$(td).html(cellData);
}
},
- "width": "7%",
+ "width": "10%",
"className": "no-wrap hidden-md hidden-sm hidden-xs modal-control"
},
{
diff --git a/data/interfaces/default/js/tables/media_info_table.js b/data/interfaces/default/js/tables/media_info_table.js
index 16482314..b4ffe830 100644
--- a/data/interfaces/default/js/tables/media_info_table.js
+++ b/data/interfaces/default/js/tables/media_info_table.js
@@ -187,7 +187,7 @@ media_info_table_options = {
"data": "file_size",
"createdCell": function (td, cellData, rowData, row, col) {
if (cellData !== null && cellData !== '') {
- $(td).html(Math.round(cellData / 1024 / 1024).toString() + ' MiB');
+ $(td).html(Math.round(cellData / Math.pow(1024, 2)).toString() + ' MiB');
} else {
if (rowData['section_type'] != 'photo') { get_file_sizes = true; }
}
@@ -268,6 +268,10 @@ media_info_table_options = {
});
get_file_sizes = false;
}
+
+ $("#media_info_table_info").append(' with a total file size of ' +
+ Math.round(settings.json.filtered_file_size / Math.pow(1024, 3)).toString() + ' GiB' +
+ ' (filtered from ' + Math.round(settings.json.total_file_size / Math.pow(1024, 3)).toString() + ' GiB)');
},
"preDrawCallback": function(settings) {
var msg = " Fetching rows...";
diff --git a/plexpy/datafactory.py b/plexpy/datafactory.py
index 7194c0d6..e793c641 100644
--- a/plexpy/datafactory.py
+++ b/plexpy/datafactory.py
@@ -814,6 +814,7 @@ class DataFactory(object):
logger.warn(u"PlexPy DataFactory :: Unable to execute database query for get_total_duration: %s." % e)
return None
+ total_duration = 0
for item in result:
total_duration = item['total_duration']
diff --git a/plexpy/helpers.py b/plexpy/helpers.py
index f20a4713..fe955dcb 100644
--- a/plexpy/helpers.py
+++ b/plexpy/helpers.py
@@ -150,7 +150,7 @@ def human_duration(s, sig='dhms'):
hd = ''
- if str(s).isdigit():
+ if str(s).isdigit() and s > 0:
d = int(s / 84600)
h = int((s % 84600) / 3600)
m = int(((s % 84600) % 3600) / 60)
@@ -173,6 +173,8 @@ def human_duration(s, sig='dhms'):
hd_list.append(str(s) + ' secs')
hd = ' '.join(hd_list)
+ else:
+ hd = '0'
return hd
diff --git a/plexpy/libraries.py b/plexpy/libraries.py
index 2802f52a..76bc7d13 100644
--- a/plexpy/libraries.py
+++ b/plexpy/libraries.py
@@ -363,15 +363,19 @@ class Libraries(object):
else:
results = sorted(results, key=lambda k: k[sort_key], reverse=reverse)
+ total_file_size = sum([helpers.cast_to_int(d['file_size']) for d in results])
+
# Paginate results
results = results[json_data['start']:(json_data['start'] + json_data['length'])]
- ## Find some way to add total disk space used?
+ filtered_file_size = sum([helpers.cast_to_int(d['file_size']) for d in results])
dict = {'recordsFiltered': filtered_count,
'recordsTotal': library_count,
'data': results,
- 'draw': int(json_data['draw'])
+ 'draw': int(json_data['draw']),
+ 'filtered_file_size': filtered_file_size,
+ 'total_file_size': total_file_size
}
return dict