From 6fcca991b86616b7cb2eec23be2ca4036aff9b48 Mon Sep 17 00:00:00 2001 From: geoffrey45 Date: Wed, 2 Mar 2022 10:19:36 +0300 Subject: [PATCH] inlcude album duration in album info --- server/app/helpers.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server/app/helpers.py b/server/app/helpers.py index e2786d19..b443f683 100644 --- a/server/app/helpers.py +++ b/server/app/helpers.py @@ -172,3 +172,16 @@ def extract_colors(image) -> list: formatted_colors.append(color) return formatted_colors + + +def get_album_duration(album: List[models.Track]) -> int: + """ + Gets the duration of an album. + """ + + album_duration = 0 + + for track in album: + album_duration += track.length + + return album_duration \ No newline at end of file