fix sum_total_duration failing if duration_seconds is not an int (#598)
* fix sum_total_duration failing if duration_seconds is not an int Signed-off-by: Adwait Thattey <coderdude1999@gmail.com> * format --------- Signed-off-by: Adwait Thattey <coderdude1999@gmail.com> Co-authored-by: sigma67 <sigma67.github@gmail.com>
This commit is contained in:
parent
d2cbe538de
commit
ab2aa28992
1 changed files with 8 additions and 1 deletions
|
|
@ -71,4 +71,11 @@ def to_int(string):
|
||||||
def sum_total_duration(item):
|
def sum_total_duration(item):
|
||||||
if "tracks" not in item:
|
if "tracks" not in item:
|
||||||
return 0
|
return 0
|
||||||
return sum([track["duration_seconds"] if "duration_seconds" in track else 0 for track in item["tracks"]])
|
return sum(
|
||||||
|
[
|
||||||
|
track["duration_seconds"]
|
||||||
|
if ("duration_seconds" in track and isinstance(track["duration_seconds"], int))
|
||||||
|
else 0
|
||||||
|
for track in item["tracks"]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue