def test_notify(): from resources.libs.common import logging from resources.libs.common import tools from resources.libs.gui import window response = tools.open_url(CONFIG.NOTIFICATION, check=True) if response: try: id, msg = window.split_notify(CONFIG.NOTIFICATION) if not id: logging.log_notify( CONFIG.ADDONTITLE, "[COLOR {0}]Notificação: não formatado corretamente[/COLOR]" .format(CONFIG.COLOR2)) return window.show_notification(msg, test=True) except Exception as e: logging.log("Error on Notifications Window: {0}".format(str(e)), level=xbmc.LOGERROR) else: logging.log_notify( CONFIG.ADDONTITLE, "[COLOR {0}]URL inválido para notificação[/COLOR]".format( CONFIG.COLOR2))
def show_notification(): if not CONFIG.NOTIFY == 'true': response = tools.open_url(CONFIG.NOTIFICATION) if response: note_id, msg = window.split_notify(CONFIG.NOTIFICATION) if note_id: try: note_id = int(note_id) if note_id == CONFIG.NOTEID: if CONFIG.NOTEDISMISS == 'false': window.show_notification(msg) else: logging.log("[Notifications] id[{0}] Dismissed".format(int(id)), level=xbmc.LOGNOTICE) elif note_id > CONFIG.NOTEID: logging.log("[Notifications] id: {0}".format(str(id)), level=xbmc.LOGNOTICE) CONFIG.set_setting('noteid', str(id)) CONFIG.set_setting('notedismiss', 'false') window.show_notification(msg=msg) logging.log("[Notifications] Complete", level=xbmc.LOGNOTICE) except Exception as e: logging.log("Error on Notifications Window: {0}".format(str(e)), level=xbmc.LOGERROR) else: logging.log("[Notifications] Text File not formatted Correctly") else: logging.log("[Notifications] URL({0}): {1}".format(CONFIG.NOTIFICATION, response), level=xbmc.LOGNOTICE) else: logging.log("[Notifications] Turned Off", level=xbmc.LOGNOTICE)
def test_notify(): from resources.libs.common import logging from resources.libs.common import tools from resources.libs.gui import window response = tools.open_url(CONFIG.NOTIFICATION, check=True) if response: try: id, msg = window.split_notify(CONFIG.NOTIFICATION) if not id: logging.log_notify( CONFIG.ADDONTITLE, "[COLOR {0}]Notification: Not Formatted Correctly[/COLOR]". format(CONFIG.COLOR2)) return window.show_notification(msg, True) except Exception as e: logging.log("Error on Notifications Window: {0}".format(str(e)), level=xbmc.LOGERROR) else: logging.log_notify( CONFIG.ADDONTITLE, "[COLOR {0}]Invalid URL for Notification[/COLOR]".format( CONFIG.COLOR2))
def show_notification(): note_id, msg = window.split_notify(CONFIG.NOTIFICATION) if note_id: if note_id == CONFIG.NOTEID: if CONFIG.NOTEDISMISS == 'false': window.show_notification(msg) else: logging.log('[Notifications] No new notifications.', level=xbmc.LOGINFO) elif note_id > CONFIG.NOTEID: logging.log('[Notifications] Showing notification {0}' .format(note_id)) CONFIG.set_setting('noteid', note_id) CONFIG.set_setting('notedismiss', 'false') window.show_notification(msg) else: logging.log('[Notifications] Notifications file at {0} not formatted correctly.' .format(CONFIG.NOTIFICATION), level=xbmc.LOGINFO)
def show_notification(): note_id, msg = window.split_notify(CONFIG.NOTIFICATION) if note_id: if note_id == CONFIG.NOTEID: if CONFIG.NOTEDISMISS == 'false': window.show_notification(msg) else: logging.log('[Notifications] No hay notificaciones nuevas.', level=xbmc.LOGINFO) elif note_id > CONFIG.NOTEID: logging.log('[Notifications] Mostrando Notificación {0}' .format(note_id)) CONFIG.set_setting('noteid', note_id) CONFIG.set_setting('notedismiss', 'false') window.show_notification(msg) else: logging.log('[Notifications] El archivo de Notificaciones en{0} no tiene el formato correcto.' .format(CONFIG.NOTIFICATION), level=xbmc.LOGINFO)
def show_notification(): note_id, msg = window.split_notify(CONFIG.NOTIFICATION) if note_id: if note_id == CONFIG.NOTEID: if CONFIG.NOTEDISMISS == 'false': window.show_notification(msg) else: logging.log('[Notifications] Sem novas notificações.', level=xbmc.LOGINFO) elif note_id > CONFIG.NOTEID: logging.log( '[Notifications] Showing notification {0}'.format(note_id)) CONFIG.set_setting('noteid', note_id) CONFIG.set_setting('notedismiss', 'false') window.show_notification(msg) else: logging.log( '[Notifications] Arquivo de notificações {0} não formatado corretamente.' .format(CONFIG.NOTIFICATION), level=xbmc.LOGINFO)