From 36a4252d082703adbab94f4a5e9d4a9f236f54c8 Mon Sep 17 00:00:00 2001 From: KKlochko Date: Sat, 9 Jul 2022 12:52:29 +0300 Subject: [PATCH] (New feature) 0.3.0 - send a notification --- CHANGELOG.org | 2 ++ src/notify.py | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/notify.py diff --git a/CHANGELOG.org b/CHANGELOG.org index 7cc85a0..9cf5d43 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -9,3 +9,5 @@ New small feature: add an anime entry if ** 0.2.0 <2022-07-09> New feature: get an anime info from page +** 0.3.0 <2022-07-09> + New feature: send a notification diff --git a/src/notify.py b/src/notify.py new file mode 100644 index 0000000..5335849 --- /dev/null +++ b/src/notify.py @@ -0,0 +1,39 @@ +########################################################################## +# Copyright (C) 2022 Kostya Klochko # +# # +# This file is part of Anitube Simple Notification. # +# # +# Anitube Simple Notification is free software: you can redistribute # +# it and/or modify it under the terms of the GNU General Public # +# License as published by the Free Software Foundation, either version # +# 3 of the License, or (at your option) any later version. # +# # +# Anitube Simple Notification is distributed in the hope that it will # +# be useful, but WITHOUT ANY WARRANTY; without even the implied # +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See # +# the GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with Anitube Simple Notification. If not, see # +# . # +########################################################################## + +""" +This module has all for simplify work with notifications. +""" + +from notifypy import Notify + +class Notification: + """The handler of notification.""" + def __init__(self, title, message, icon_path=""): + """Initialising the connection information.""" + self.title, self.message, self.icon_path = title, message, icon_path + + def send(self): + """Send the notification.""" + notification = Notify() + notification.title = self.title + notification.message = self.message + notification.icon = self.icon_path + notification.send()