Skip to content

Instantly share code, notes, and snippets.

@dewanshrawat15
Last active June 11, 2019 07:21
Show Gist options
  • Save dewanshrawat15/897b366efbeb4f3e8f80e54527b4e701 to your computer and use it in GitHub Desktop.
Save dewanshrawat15/897b366efbeb4f3e8f80e54527b4e701 to your computer and use it in GitHub Desktop.
A terminal alarm python script. It is dependent on the playsound library. Plays all songs in the directory until you're awake.
import time
from playsound import playsound
import os
from os import system
filename = os.listdir()
songs = []
for file in filename:
if '.mp3' in file:
songs.append(file)
t = input("Wake you up at? ")
t = int(t)
time.sleep(t)
for i in songs:
# print("Playing => "+i+"")
base = '/Volumes/Sherrinford/alarm/'
i.replace(" ", "%20")
temp_path = base + i
playsound(temp_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment