def main(): product_list = scraper.trackedProductList() updated_info_list = [] for product in product_list: webpage = generateProductUrl(product) source_code = urllib.request.urlopen(webpage).read() soup = bs.BeautifulSoup(source_code, 'lxml') utag_data = 'utag_data' script_blocks = scraper.findScripts(soup) title_price_id = scraper.findTitlePriceId(script_blocks, utag_data) # scraper.getCSVPath(title_price_id[2]) csv_path = scraper.getCSVPath(product) mode = '' with open(csv_path, 'r') as f: if scraper.shouldUpdatePrice(f, title_price_id[1]): updated_info_list.append( title_price_id[0] + ': ' + str(title_price_id[1])) mode = 'a' f.close() if mode != '': with open(csv_path, mode) as f: print(title_price_id[0] + ',' + title_price_id[1] + ',' + str(datetime.date.today()), file=f) f.close() toast_notif_string = '' for update in updated_info_list: toast_notif_string += update + '\n' notification.notify("Updating csvs", toast_notif_string)
def ReproducirDocumentos(): engine.say("Ejecutando Documentos") engine.runAndWait() home = os.environ['USERPROFILE'] carpetas = os.listdir(home) ruta = home + "\\Documents" archivos = os.listdir(ruta) try: for i in range(len(archivos)): ejecutar = ruta + '\\' + archivos[int(entrada.get())] os.startfile(ejecutar) notification.notify( title="Notificación", message="Tarea realizada con éxito ", app_icon="LogoNevy.ico", timeout=3, ) break textMateria.delete(0, END) except: engine.say("Error esta fuera de la Opción") engine.runAndWait() MessageBox.showinfo("Aviso de actividad ", "Opción fuera de rango")
def check_create_notification(current_value: float): for action in action_list: if action.notification_should_trigger(current_value): #toaster = ToastNotifier() #toaster.show_toast("Limit reached","Value is: " + str(current_value), threaded=True) notification.notify("Limit reached", "Value is: " + str(current_value)) action.notify_event()
def VerYoutube(): try: engine.say("Accediendo a Youtube") engine.runAndWait() webbrowser.open("http://www.Youtube.com", new=2, autoraise=True) notification.notify( title="Notificación", message="Tarea realizada con éxito ", app_icon="LogoNevy.ico", timeout=3, ) except: engine.say("Error al ingresar ruta no encontrada") engine.runAndWait()
def VerGoogle(): try: engine.say("Ejecutando Navegador") engine.runAndWait() webbrowser.open("http://www.Google.com", new=2, autoraise=True) notification.notify( title="Notificación", message="Tarea realizada con éxito ", app_icon="LogoNevy.ico", timeout=3, ) except: engine.say("Error al ingresar, ruta no encontrada") engine.runAndWait()
def localToCloudSetup(self): shutil.make_archive('zipped-worlds\\' + self.name, 'zip', self.path) if self.verifyPlayerMetadata(): print('player metadata exists') if self.verifyPlayerExistance(): print('player in world') self.moveLocalPlayerToExistingRemotePlayer() print('moved local player data to existing remote player data') else: print('player not in world') self.moveLocalPlayerToNewRemotePlayer() print('moved local player data to new remote player data') notification.notify('Minecraft Shared Worlds', 'Updated "' + self.title + '" in cloud', timeout=5)
def joue(self): nb = self._nb_courant_mus if nb != 0: self._supppr_ancien_audio() self.suppr_queue() filename = 'song_' + str(nb) + '_nb.mp3' player = vlc.MediaPlayer(filename) player.play() self._aff_encad("Lancement de : " + self._queue[0]) notification.notify("SonKa", self._queue[0], app_icon=memory.chemin_cour + "/images/SonKa.ico", app_name="SonKa") return player
def cloudToLocalSetup(self, cloud_date): cloud_date = cloud_date.split('T') year_month_day = cloud_date[0].split('-') hour_minute_second = cloud_date[-1].split(':') milisecond = hour_minute_second[-1].split('.') date_separated = [year_month_day, hour_minute_second[:2], milisecond] timestamp = datetime(int(date_separated[0][0]), int(date_separated[0][1]), int(date_separated[0][2]), int(date_separated[1][0]), int(date_separated[1][1]), int(date_separated[2][0]), int(date_separated[2][1])).timestamp() - self.offset os.utime(self.path, (timestamp, timestamp)) print('metadata:', self.verifyPlayerMetadata()) print('player:', self.verifyPlayerExistance()) if self.verifyPlayerMetadata() and self.verifyPlayerExistance(): print('player metadata existing and player in world') print(self.moveRemotePlayerToLocalPlayer()) print('moved remote player to local player') else: self.addNewLocalPlayer() print('added new local player') notification.notify('Minecraft Shared Worlds', 'Updated "' + self.title + '" in pc', timeout=5)
def Busqueda(): try: engine.say("Realizando la busqueda ") engine.runAndWait() Busqueda1.get() if Busqueda1.get() == "": MessageBox.showinfo("Aviso de actividad ", "No hay nada por buscar") else: webbrowser.open("https://www.google.com/search?q=" + Busqueda1.get(), new=2, autoraise=True) textBusq.delete(0, END) notification.notify( title="Notificación", message="Tarea realizada con éxito ", app_icon="LogoNevy.ico", timeout=3, ) except: engine.say("Error al ingresar, ruta no encontrada") engine.runAndWait()
usuario = getpass.getuser() engine = pyttsx3.init() voices = engine.getProperty( 'voices' ) # a voices se le carga un vector con la información de todas las voces # getPropierty es para obtener información de algo, ya sea el volumen o la velocidad con que habla engine.setProperty( 'voice', voices[0].id ) # setProperty es para cambiar una propiedad, ya sea voz o volumen volume = engine.getProperty('volume') # para obtener el volumen actual engine.setProperty('volume', volume + 0.1) # cambiar el volumen rate = engine.getProperty('rate') # para obtener la velocidad actual engine.setProperty('rate', rate - 15) # cambiar la velocidad con que habla notification.notify( # Notifcación de inicio de la aplicación title="Notificación", message="Sistema iniciando ", app_icon="LogoNevy.ico", timeout=3, ) # Inicio de saludo, depende de la hora en la que se ejecute el programa try: hora = time.strftime( "%H") # se obtiene la hora, el formato "%H" define que es de 24 horas if int(hora) >= 0 and int(hora) <= 12: notification.notify( title="Notificación", message="Bienvenido" " " + usuario, app_icon="LogoNevy.ico", timeout=2, )
def notify(distance): ##return toaster.show_toast('Eye Care', 'Please maintain a safe distance from laptop screen', duration=2) return notification.notify('Eye Care', 'Please maintain a safe distance from laptop screen', app_icon='python.ico', timeout=10, ticker='Maintain distance')
print(peak) #print("%04d %05d"%(i,peak)) if peak > LOWTHRESHOLD and peak <= HIGHTHRESHOLD + 10: if flag != 0: flag += 1 #print(flag) else: flag = 1 #stream.stop_stream() # print(now.year, now.month, now.day, now.hour, now.minute, now.second) # 2015 5 6 8 53 40 if flag > 4: # toaster.show_toast("%dh%s" % (now.hour,now.minute), "Ferme ta ras HMAR",duration = 5) now = datetime.datetime.now() notification.notify("%dh%s" % (now.hour, now.minute), "Ferme ta ras HMAR", timeout=5) time.sleep(6) stream.start_stream() flag = 0 elif peak > HIGHTHRESHOLD: stream.stop_stream() now = datetime.datetime.now() peak = 0 notification.notify("%dh%s" % (now.hour, now.minute), "Ferme ta ras HMAR", timeout=5) time.sleep(6) stream.start_stream() data = np.frombuffer(stream.read(CHUNK), dtype=np.int16) flag = 0
def show_notification(title, message): notification.notify(title, message)