add support for sending emails after completion

This commit is contained in:
boyska 2024-11-26 00:30:15 +01:00
parent 583113c846
commit edd6660710
2 changed files with 14 additions and 0 deletions

View file

@ -357,6 +357,17 @@ class Carichello:
return self.error_exception(exc)
LOG.info("ready: %s", 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(
[
"zenity",

View file

@ -1,4 +1,7 @@
{
"mail": {
"to": "foobar@example.com"
},
"backends": [
{
"type": "archive.org",