This commit is contained in:
BarsTiger
2021-06-11 14:00:13 +03:00
parent e31df79847
commit bcb16b3e1d

View File

@@ -9,7 +9,9 @@ try:
except:
subprocess.check_call([sys.executable, "-m", "pip", "install", 'playsound'])
from playsound import playsound
urllib.request.urlretrieve("https://github.com/BarsTiger/KOTIKOTapps_download_repo/blob/master/OfficialProjects/SuperTimer/alarm.mp3?raw=true", "alarm.mp3")
if not os.path.isfile('alarm.mp3'):
urllib.request.urlretrieve("https://github.com/BarsTiger/KOTIKOTapps_download_repo/blob/master/OfficialProjects/SuperTimer/alarm.mp3?raw=true", "alarm.mp3")
print("You can change alarm sound: just reneame your sound to alarm.mp3 and copy it to SuperTimer folder")
superSecond = float(input("Print how many real seconds will be in superSecond: "))
@@ -17,10 +19,15 @@ timeInSuperSeconds = int(input("Timer in superSeconds: "))
os.system('cls' if os.name == 'nt' else 'clear')
width = str(len(str(int(timeInSuperSeconds))))
formattedTimeInSuperSeconds = str(datetime.timedelta(seconds=timeInSuperSeconds))
width = str(len(str(formattedTimeInSuperSeconds)))
while timeInSuperSeconds > 0:
print('Time remaining: {{:{:}}} seconds'.format(width).format(timeInSuperSeconds), end='\r')
formattedTimeInSuperSeconds = str(datetime.timedelta(seconds=timeInSuperSeconds))
print('Time remaining: {{:{:}}}'.format(width).format(formattedTimeInSuperSeconds), end='\r')
timeInSuperSeconds -= 1
time.sleep(superSecond)
playsound("alarm.mp3")
print("Press Ctrl + C to stop alarm")
while True:
playsound("alarm.mp3")