MCPcopy Create free account
hub / github.com/pyload/pyload / notify

Method notify

module/plugins/internal/Notifier.py:110–149  ·  view source on GitHub ↗
(self, event, msg=None, key=None)

Source from the content-addressed store, hash-verified

108
109 @Expose
110 def notify(self, event, msg=None, key=None):
111 key = key or self.get_key()
112 if not key or isiterable(key) and not all(key):
113 return
114
115 if isiterable(msg):
116 msg = " | ".join(decode(a).strip() for a in msg if a)
117 else:
118 msg = decode(msg)
119
120 if self.pyload.isClientConnected() and not self.config.get('ignoreclient', False):
121 return
122
123 elapsed_time = time.time() - self.last_notify
124
125 if elapsed_time < self.config.get('sendinterval', 1):
126 return
127
128 elif elapsed_time > 60:
129 self.notifications = 0
130
131 elif self.notifications >= self.config.get('sendpermin', 60):
132 return
133
134 self.log_debug("Sending notification...")
135
136 try:
137 self.send(event, msg, key)
138
139 except Exception, e:
140 self.log_error(_("Error sending notification"), e)
141 return False
142
143 else:
144 self.log_debug("Notification sent")
145 return True
146
147 finally:
148 self.last_notify = time.time()
149 self.notifications += 1

Callers 13

pyload_updatedMethod · 0.95
exitMethod · 0.95
captcha_taskMethod · 0.95
before_reconnectMethod · 0.95
after_reconnectMethod · 0.95
package_finishedMethod · 0.95
package_failedMethod · 0.95
download_finishedMethod · 0.95
download_failedMethod · 0.95
stopMethod · 0.80

Calls 11

get_keyMethod · 0.95
sendMethod · 0.95
isiterableFunction · 0.85
allFunction · 0.85
joinMethod · 0.80
isClientConnectedMethod · 0.80
log_debugMethod · 0.80
log_errorMethod · 0.80
decodeFunction · 0.70
_Function · 0.50
getMethod · 0.45

Tested by

no test coverage detected