def errorNotify(title, body): if thePlatform == "Linux" or thePlatform == "Darwin": from notifypy import Notify notif = Notify() notif.title = title notif.message = body notif.icon = "./icons/png/robloxnotif.png" notif.audio = path.realpath("./sounds/error.wav") notif.application_name = "robloxnotif" notif.send(block=True) elif thePlatform == "Windows": import win10toast from playsound import playsound toast = win10toast.ToastNotifier() toast.show_toast( title, body, duration=5, icon_path="./icons/robloxnotif.ico", threaded=True, sound=False, ) try: playsound(path.realpath("./sounds/error.wav")) except UnicodeDecodeError: pass while toast.notification_active(): sleep(0.1)
def notify(self, title, description, duration=5): notification = Notify() notification.title = title notification.message = description notification.icon = "./assets/image/icon.png" notification.audio = "./assets/audio/notification.wav" notification.send()
def EnviarNotificacion(mensaje, audio): NotigicacionBase = Notify() NotigicacionBase.title = "Titulo" NotigicacionBase.message = mensaje if audio is not None: NotigicacionBase.audio = path.join(direcion, audio) NotigicacionBase.send()
def notifcation(title="test", message="test"): notification = Notify() notification.title = title notification.message = message sound = random_sound() setting = read_config() if setting[2] == "True": # True False - SOUND ON OFF if setting[3] == "default": # default random notification.audio = "sounds/" + "default.wav" if setting[3] == "random": # default random notification.audio = "sounds/" + sound if setting[4] == "True": # True False - Norifcarion ON OFF notification.icon = "images/icon.png" notification.send()
def Birthday_Today_Notification(First, Last, Age): notification = Notify() notification.title = f"{First} {Last}'s Birthday!!!" notification.message = f"{First} is turning {Age} today! Make sure to wish them a happy birthday!" notification.icon = "Images\BirthdayCakeIcon.png" notification.application_name = "Birthday Tracker" notification.audio = r"Images\NotificationSound.wav" notification.send()
def notification_send(title, message, config_dict, b_sound): notification = Notify() notification.title = title notification.message = message notification.icon = config_dict['PATH_NOTIF_ICON'] if b_sound: notification.audio = config_dict['PATH_NOTIF_SOUND'] notification.send()
def notify(title="Event", message=None, location=None): """Send a system notification""" notification = Notify() notification.title = title notification.message = message if location: message += f"\nLocation: {location}" notification.icon = "./schedule.png" notification.audio = "./Polite.wav" notification.send()
def this_will_run_when_alarm_rings(alarm): if alarm[2] == 0: pass else: alarm_ = Alarms() time = alarm_.convert_to_12_hour_clock(minutes_from_minight=alarm[4]) notification = Notify() notification.title = alarm[1] notification.message = f"The time is {time[0]}:{time[1]} {time[2]}" notification.icon = "./Assets/Robert Logo.png" notification.audio = "./Assets/beep.wav" notification.send() alarm_.delete_alarm(alarm[0])
def prompt_for_touch(): try: click.echo('Touch your YubiKey...', err=True) notification = Notify() notification.title = "Touch your yubikey" notification.message = "Touch your yubikey" notification.audio = os.path.join(os.path.dirname(__file__), "notification_sound.wav") notification.icon = os.path.join(os.path.dirname(__file__), "yubikey.png") notification.send() except Exception: sys.stderr.write("Touch your YubiKey...\n")
def notifier(): global timer_started, timer_running, clock_values timer_started = False timer_running = -1 clock_values = ['00','00','00'] n = Notify() n.title = "Timer" n.message = "Timer is over" n.audio = 'notification.wav' n.icon = 'timer.png' n.send()
def notify_msg(self): notification = Notify() notification.title = self.currency message = str(self.rate) + "@ \n" + self.time notification.message = message try: notification.audio = self.tone notification.icon = self.indicator notification.send(block=False) except ( exceptions.InvalidAudioFormat, exceptions.InvalidIconPath, exceptions.InvalidAudioPath, ): pass
def Three_Days_Notification(First, Last, Age, Birthday): Birthday = datetime.datetime.strptime(Birthday, "%Y-%m-%d") Day = Birthday.day Formatted = "th" if Day == 1 or Day == 21 or Day == 31: Formatted = "st" if Day == 2 or Day == 22: Formatted = "nd" if Day == 3 or Day == 23: Formatted = "rd" Birthday = Birthday.strftime(f"%B {Day}{Formatted}!") notification = Notify() notification.title = f"{First} {Last}'s Birthday is in 3 days!" notification.message = f"{First} turns {Age} years old on {Birthday}!" notification.icon = "Images\BirthdayCakeIcon.png" notification.application_name = "Birthday Tracker" notification.audio = r"Images\NotificationSound.wav" notification.send()
the path of the icon" memo_path = os.environ.get("NOTIFY_MEMO") if not memo_path: raise NotificationMemo with open(memo_path, "r") as file: memo = safe_load(file) tips = memo["tips"] tips = list(tips.items()) tip = random.choice(tips) logging.info(str(tip)) notification = Notify() logging.info(f"memo: {memo_path}") # notify.application_name="Tips", notification.title = tip[0] icon_path = memo.get("icon") if icon_path: logging.info(f"icon: {icon_path}") notification.icon = icon_path audio_path = memo.get("audio") if audio_path: logging.info(f"audio: {audio_path}") notification.audio = audio_path notification.message = tip[1]["message"] notification.send()
# Creado ChepeCarlos de ALSW # Tutorial Completo en https://nocheprogramacion.com # Canal Youtube https://youtube.com/alswnet?sub_confirmation=1 from os import path from notifypy import Notify notification = Notify() notification.title = "Titulo" notification.message = "Hola Mundo" icono = "LogoALSW.png" audio = "HolaMundo.wav" direcion = path.abspath(path.dirname(__file__)) notification.icon = path.join(direcion, icono) notification.audio = path.join(direcion, audio) notification.send()
def notify(usernames: Dict[str, str], a: Presence, boot: bool): thestring = "" theicon = "robloxnotif.ico" thecolor = Fore.WHITE thesound = "robloxnotif" if usernames[str(a.userId)].startswith("!") or usernames[str( a.userId)].startswith("[!]"): thesound = "fav" if str(a.userPresenceType) == str(PresenceType.Playing.value): thestring = "playing: " + a.lastLocation if a.lastLocation == "": thestring = "playing something" theicon = "playing" thecolor = Fore.LIGHTGREEN_EX # better for powershell elif str(a.userPresenceType) == str(PresenceType.Online.value): thestring = "online" theicon = "online" thecolor = Fore.LIGHTCYAN_EX # better for powershell elif str(a.userPresenceType) == str(PresenceType.InStudio.value): thestring = "in studio: " + a.lastLocation if a.lastLocation == "": thestring = "in studio making something" theicon = "studio" thecolor = Fore.LIGHTYELLOW_EX # better for powershell elif (str(a.userPresenceType) == str( PresenceType.Offline.value)) and (not boot): thestring = "now offline" thecolor = Fore.LIGHTBLACK_EX # better for powershell theicon = "offline" if thestring != "": log(usernames[str(a.userId)] + " is " + thestring, thecolor) if thePlatform == "Linux" or thePlatform == "Darwin": from notifypy import Notify notif = Notify() notif.title = usernames[str(a.userId)] + " is" notif.message = thestring notif.icon = f"./icons/png/{theicon}.png" notif.audio = path.realpath(f"./sounds/{thesound}.wav") notif.application_name = "robloxnotif" notif.send(block=True) elif thePlatform == "Windows": import win10toast from playsound import playsound toast = win10toast.ToastNotifier() toast.show_toast( usernames[str(a.userId)] + " is", thestring, duration=3, icon_path="./icons/" + theicon + ".ico", threaded=True, sound=False, ) try: playsound(path.realpath(f"./sounds/{thesound}.wav")) except UnicodeDecodeError: pass while toast.notification_active(): sleep(0.1)