]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blame - helpers/__init__.py
Use workflow for music_files
[perso/Immae/Projets/Python/MusicSampler.git] / helpers / __init__.py
CommitLineData
1df30f07 1# -*- coding: utf-8 -*-
bb69f62e
IB
2import sys
3import os
4
5def path():
6 if getattr(sys, 'frozen', False):
7 return sys._MEIPASS + "/"
8 else:
9 path = os.path.dirname(os.path.realpath(__file__))
10 return path + "/../"
11
cc008de4
IB
12def parse_args():
13 for arg in sys.argv:
14 if arg == "-v":
15 sys.argv.remove(arg)
16
17 if getattr(sys, 'frozen', False):
18 f = open(path() + ".pyinstaller_commit", "r")
19 print(f.read(), end="")
20 f.close()
21 else:
22 print("option '-v' can only be used in bundled package")
23 sys.exit()
24
98ff4305
IB
25def duration_to_min_sec(duration):
26 minutes = int(duration / 60)
27 seconds = int(duration) % 60
28 if minutes < 100:
29 return "{:2}:{:0>2}".format(minutes, seconds)
30 else:
31 return "{}:{:0>2}".format(minutes, seconds)