1
This commit is contained in:
@@ -9,7 +9,9 @@ try:
|
|||||||
except:
|
except:
|
||||||
subprocess.check_call([sys.executable, "-m", "pip", "install", 'playsound'])
|
subprocess.check_call([sys.executable, "-m", "pip", "install", 'playsound'])
|
||||||
from playsound import 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")
|
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: "))
|
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')
|
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:
|
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
|
timeInSuperSeconds -= 1
|
||||||
time.sleep(superSecond)
|
time.sleep(superSecond)
|
||||||
|
|
||||||
playsound("alarm.mp3")
|
print("Press Ctrl + C to stop alarm")
|
||||||
|
while True:
|
||||||
|
playsound("alarm.mp3")
|
||||||
|
|||||||
Reference in New Issue
Block a user