mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-14 02:26:58 -07:00
Some more minor changes
This commit is contained in:
parent
35528ef602
commit
3c1290e8fd
5 changed files with 18 additions and 7 deletions
|
@ -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']
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue