diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-06-27 10:27:35 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-06-27 10:27:35 +0200 |
commit | 98ff43054fe94f333e2deda2906cd62593ded1d8 (patch) | |
tree | e8cfe3df72c6a02bd1d8fbe565b1a8b9185c79b2 /helpers/__init__.py | |
parent | 65ec4d2a87bfe0dcf1250ec8dc61225d4ed66325 (diff) | |
download | MusicSampler-98ff43054fe94f333e2deda2906cd62593ded1d8.tar.gz MusicSampler-98ff43054fe94f333e2deda2906cd62593ded1d8.tar.zst MusicSampler-98ff43054fe94f333e2deda2906cd62593ded1d8.zip |
Put time duration in playlist
Diffstat (limited to 'helpers/__init__.py')
-rw-r--r-- | helpers/__init__.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/helpers/__init__.py b/helpers/__init__.py index 70667fd..0f819e7 100644 --- a/helpers/__init__.py +++ b/helpers/__init__.py | |||
@@ -9,3 +9,10 @@ def path(): | |||
9 | path = os.path.dirname(os.path.realpath(__file__)) | 9 | path = os.path.dirname(os.path.realpath(__file__)) |
10 | return path + "/../" | 10 | return path + "/../" |
11 | 11 | ||
12 | def duration_to_min_sec(duration): | ||
13 | minutes = int(duration / 60) | ||
14 | seconds = int(duration) % 60 | ||
15 | if minutes < 100: | ||
16 | return "{:2}:{:0>2}".format(minutes, seconds) | ||
17 | else: | ||
18 | return "{}:{:0>2}".format(minutes, seconds) | ||