Merge pull request 'simple-repo' (#1) from simple-repo into master
Reviewed-on: #1
This commit is contained in:
commit
8f3e40f190
1 changed files with 140 additions and 126 deletions
|
@ -32,7 +32,12 @@ except:
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import dbus.service
|
import dbus.service
|
||||||
import dbus.glib
|
# deprecated
|
||||||
|
#import dbus.glib
|
||||||
|
# replaces by this 2 lines
|
||||||
|
from dbus.mainloop.glib import DBusGMainLoop
|
||||||
|
DBusGMainLoop(set_as_default=True)
|
||||||
|
|
||||||
from mkbackup.system_notification_emitter import Emitter
|
from mkbackup.system_notification_emitter import Emitter
|
||||||
from mkbackup.mkbackup_emitter import Emitter as EM
|
from mkbackup.mkbackup_emitter import Emitter as EM
|
||||||
|
|
||||||
|
@ -43,6 +48,10 @@ from mkbackup.mkbackup_btrfs_config import __version__ as confversion
|
||||||
__author__ = "Jakobus Schürz <jakob@schuerz.at>"
|
__author__ = "Jakobus Schürz <jakob@schuerz.at>"
|
||||||
__version__ = "1.01.0"
|
__version__ = "1.01.0"
|
||||||
|
|
||||||
|
class EmDBUSDesktop(EM):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__(conn=dbus.SystemBus(), object_path='/at/xundeenergie/notifications/advanced')
|
||||||
|
|
||||||
class Notification(Emitter):
|
class Notification(Emitter):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(conn=dbus.SystemBus(), object_path='/at/xundeenergie/notifications/advanced/Notification')
|
super().__init__(conn=dbus.SystemBus(), object_path='/at/xundeenergie/notifications/advanced/Notification')
|
||||||
|
@ -1667,19 +1676,18 @@ def restore(args):
|
||||||
#class desktop_notification:
|
#class desktop_notification:
|
||||||
# def __init__(self, args, urgency=1):
|
# def __init__(self, args, urgency=1):
|
||||||
# self.args = args
|
# self.args = args
|
||||||
# self.dbus_path = "/at/xundeenergie/notifications"
|
# self.dbus_path = "/at/xundeenergie/notifications/advanced"
|
||||||
# self.dbus_iface = "at.xundeenergie.notifications.advanced"
|
# self.dbus_iface = "at.xundeenergie.Notification"
|
||||||
# self.dbus_busname = "at.xundeenergie.notifications"
|
|
||||||
# self.timestamp = datetime.datetime.now()
|
# self.timestamp = datetime.datetime.now()
|
||||||
# self.time = self.timestamp.strftime('%H:%M:%S')
|
# self.time = self.timestamp.strftime('%H:%M:%S')
|
||||||
# self.date = self.timestamp.strftime('%d. %B %Y')
|
# self.date = self.timestamp.strftime('%d. %B %Y')
|
||||||
# self.bus = dbus.SystemBus()
|
# self.bus = dbus.SystemBus()
|
||||||
# if int(urgency) == 0:
|
# if int(urgency) == 0:
|
||||||
# self.signal_name = 'Notification_low'
|
# self.signal_name = 'low'
|
||||||
# elif int(urgency) == 1:
|
# elif int(urgency) == 1:
|
||||||
# self.signal_name = 'Notification_normal'
|
# self.signal_name = 'normal'
|
||||||
# else:
|
# else:
|
||||||
# self.signal_name = 'Notification_critical'
|
# self.signal_name = 'critical'
|
||||||
# print('NO',int(urgency),self.signal_name)
|
# print('NO',int(urgency),self.signal_name)
|
||||||
#
|
#
|
||||||
# def send_signal(self, intv='default', *args):
|
# def send_signal(self, intv='default', *args):
|
||||||
|
@ -1695,7 +1703,8 @@ def restore(args):
|
||||||
#""" % (self.date, self.time, '\n'.join(args), self.signal_name)
|
#""" % (self.date, self.time, '\n'.join(args), self.signal_name)
|
||||||
# msg['expiration_timeout'] = '-1'
|
# msg['expiration_timeout'] = '-1'
|
||||||
# message = dbus.lowlevel.SignalMessage(self.dbus_path, self.dbus_iface, self.signal_name)
|
# message = dbus.lowlevel.SignalMessage(self.dbus_path, self.dbus_iface, self.signal_name)
|
||||||
# message.append(msg)
|
# #message.append(msg)
|
||||||
|
# message.append({'body': 'blafoo'})
|
||||||
# self.bus.send_message(message)
|
# self.bus.send_message(message)
|
||||||
|
|
||||||
# PARSER
|
# PARSER
|
||||||
|
@ -2009,6 +2018,12 @@ Author: %s""" % (confversion,__version__,__author__))
|
||||||
args.mdb = EmDBUS()
|
args.mdb = EmDBUS()
|
||||||
args.mdb.reset(args.tag)
|
args.mdb.reset(args.tag)
|
||||||
args.mdb.start(args.tag)
|
args.mdb.start(args.tag)
|
||||||
|
args.mdbd = EmDBUSDesktop()
|
||||||
|
# msg = dict()
|
||||||
|
# msg['sender'] = "mkbackup"
|
||||||
|
# msg['header'] = "%s-backup" % (args.tag)
|
||||||
|
# msg['body'] = "Start"
|
||||||
|
# args.mdbd.critical(msg)
|
||||||
#################################################################
|
#################################################################
|
||||||
## Run action ##
|
## Run action ##
|
||||||
#################################################################
|
#################################################################
|
||||||
|
@ -2120,8 +2135,6 @@ snapshots: %s
|
||||||
um %s Uhr abgeschlossen.
|
um %s Uhr abgeschlossen.
|
||||||
|
|
||||||
%s
|
%s
|
||||||
http://www.google.com
|
|
||||||
<a href="file:///home/jakob/backup">TEST</a>
|
|
||||||
(Ugency: normal)
|
(Ugency: normal)
|
||||||
""" % (args.ts.strftime('%Y-%m-%d'), args.ts.strftime('%H:%M:%S'), '\r'.join(volumes))
|
""" % (args.ts.strftime('%Y-%m-%d'), args.ts.strftime('%H:%M:%S'), '\r'.join(volumes))
|
||||||
# msg['action'] = dict()
|
# msg['action'] = dict()
|
||||||
|
@ -2132,6 +2145,7 @@ http://www.google.com
|
||||||
|
|
||||||
advnotify = Notification()
|
advnotify = Notification()
|
||||||
advnotify.normal(msg)
|
advnotify.normal(msg)
|
||||||
|
args.mdbd.critical(msg)
|
||||||
elif args.notification == None:
|
elif args.notification == None:
|
||||||
logger.critical("No notification at all")
|
logger.critical("No notification at all")
|
||||||
else:
|
else:
|
||||||
|
@ -2154,4 +2168,4 @@ http://www.google.com
|
||||||
# msg = """
|
# msg = """
|
||||||
# Hello!""" # The /n separates the message from the headers
|
# Hello!""" # The /n separates the message from the headers
|
||||||
# server.sendmail("first.recipient@provider1.example", "second.recipient@provider2.example", msg)
|
# server.sendmail("first.recipient@provider1.example", "second.recipient@provider2.example", msg)
|
||||||
#
|
#header
|
||||||
|
|
Loading…
Reference in a new issue