Add human duration and file size to export attributes

This commit is contained in:
JonnyWong16 2020-08-04 13:45:20 -07:00
commit fb81d1b6f3
No known key found for this signature in database
GPG key ID: B1F1F9807184697A

View file

@ -70,6 +70,7 @@ MOVIE_ATTRS = {
'tag': None 'tag': None
}, },
'duration': None, 'duration': None,
'durationHuman': lambda i: helpers.human_duration(getattr(i, 'duration', 0), sig='dhm'),
'fields': { 'fields': {
'name': None, 'name': None,
'locked': None 'locked': None
@ -122,6 +123,7 @@ MOVIE_ATTRS = {
'indexes': None, 'indexes': None,
'key': None, 'key': None,
'size': None, 'size': None,
'sizeHuman': lambda i: helpers.human_file_size(getattr(i, 'size', 0)),
'optimizedForStreaming': None, 'optimizedForStreaming': None,
'requiredBandwidths': lambda e: [int(b) for b in e.split(',')] if e else None, 'requiredBandwidths': lambda e: [int(b) for b in e.split(',')] if e else None,
'syncItemId': None, 'syncItemId': None,
@ -249,6 +251,7 @@ SHOW_ATTRS = {
}, },
'contentRating': None, 'contentRating': None,
'duration': None, 'duration': None,
'durationHuman': lambda i: helpers.human_duration(getattr(i, 'duration', 0), sig='dhm'),
'fields': { 'fields': {
'name': None, 'name': None,
'locked': None 'locked': None
@ -339,6 +342,7 @@ EPISODE_ATTRS = {
'tag': None 'tag': None
}, },
'duration': None, 'duration': None,
'durationHuman': lambda i: helpers.human_duration(getattr(i, 'duration', 0), sig='dhm'),
'fields': { 'fields': {
'name': None, 'name': None,
'locked': None 'locked': None
@ -391,6 +395,7 @@ EPISODE_ATTRS = {
'indexes': None, 'indexes': None,
'key': None, 'key': None,
'size': None, 'size': None,
'sizeHuman': lambda i: helpers.human_file_size(getattr(i, 'size', 0)),
'optimizedForStreaming': None, 'optimizedForStreaming': None,
'requiredBandwidths': lambda e: [int(b) for b in e.split(',')] if e else None, 'requiredBandwidths': lambda e: [int(b) for b in e.split(',')] if e else None,
'syncItemId': None, 'syncItemId': None,
@ -607,6 +612,7 @@ TRACK_ATTRS = {
'addedAt': helpers.datetime_to_iso, 'addedAt': helpers.datetime_to_iso,
'art': None, 'art': None,
'duration': None, 'duration': None,
'durationHuman': lambda i: helpers.human_duration(getattr(i, 'duration', 0), sig='dhm'),
'grandparentArt': None, 'grandparentArt': None,
'grandparentGuid': None, 'grandparentGuid': None,
'grandparentKey': None, 'grandparentKey': None,
@ -641,6 +647,7 @@ TRACK_ATTRS = {
'id': None, 'id': None,
'key': None, 'key': None,
'size': None, 'size': None,
'sizeHuman': lambda i: helpers.human_file_size(getattr(i, 'size', 0)),
'requiredBandwidths': lambda e: [int(b) for b in e.split(',')] if e else None, 'requiredBandwidths': lambda e: [int(b) for b in e.split(',')] if e else None,
'syncItemId': None, 'syncItemId': None,
'syncState': None, 'syncState': None,
@ -777,7 +784,8 @@ PHOTO_ATTRS = {
'file': None, 'file': None,
'id': None, 'id': None,
'key': None, 'key': None,
'size': None 'size': None,
'sizeHuman': lambda i: helpers.human_file_size(getattr(i, 'size', 0)),
} }
}, },
'tag': { 'tag': {
@ -819,6 +827,7 @@ PLAYLIST_ATTRS = {
'addedAt': helpers.datetime_to_iso, 'addedAt': helpers.datetime_to_iso,
'composite': None, 'composite': None,
'duration': None, 'duration': None,
'durationHuman': lambda i: helpers.human_duration(getattr(i, 'duration', 0), sig='dhm'),
'guid': None, 'guid': None,
'key': None, 'key': None,
'leafCount': None, 'leafCount': None,