Fix KeyError when playlist is empty
This commit is contained in:
parent
d48951f00f
commit
2344a1715b
1 changed files with 2 additions and 0 deletions
|
|
@ -66,6 +66,8 @@ def to_int(string):
|
|||
|
||||
|
||||
def sum_total_duration(item):
|
||||
if 'tracks' not in item:
|
||||
return 0
|
||||
return sum([
|
||||
track['duration_seconds'] if 'duration_seconds' in track else 0 for track in item['tracks']
|
||||
])
|
||||
|
|
|
|||
Loading…
Reference in a new issue