add support for sending emails after completion
This commit is contained in:
parent
583113c846
commit
edd6660710
2 changed files with 14 additions and 0 deletions
|
@ -357,6 +357,17 @@ class Carichello:
|
||||||
return self.error_exception(exc)
|
return self.error_exception(exc)
|
||||||
LOG.info("ready: %s", url)
|
LOG.info("ready: %s", url)
|
||||||
self.set_clipboard(url)
|
self.set_clipboard(url)
|
||||||
|
mail_to = self.config.get('mail', {}).get('to', None)
|
||||||
|
if mail_to:
|
||||||
|
hostname = subprocess.check_output(['hostname', '-f'], encoding='utf8').strip()
|
||||||
|
try:
|
||||||
|
subprocess.run(
|
||||||
|
['mail', '-s', 'Nuovo file caricato', mail_to],
|
||||||
|
input=f"{hostname}\n\n{url}",
|
||||||
|
encoding='utf8',
|
||||||
|
)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
LOG.error("error sending email")
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
[
|
[
|
||||||
"zenity",
|
"zenity",
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
{
|
{
|
||||||
|
"mail": {
|
||||||
|
"to": "foobar@example.com"
|
||||||
|
},
|
||||||
"backends": [
|
"backends": [
|
||||||
{
|
{
|
||||||
"type": "archive.org",
|
"type": "archive.org",
|
||||||
|
|
Loading…
Reference in a new issue