Skip to content

Add autofrom Option to Email Notify Plugin#1966

Merged
liiight merged 16 commits intoFlexget:developfrom
andocromn:develop
Sep 16, 2017
Merged

Add autofrom Option to Email Notify Plugin#1966
liiight merged 16 commits intoFlexget:developfrom
andocromn:develop

Conversation

@andocromn
Copy link
Copy Markdown
Contributor

Motivation for changes:

want to have the ability have the email from field automatically generated with the system hostname and username compatible with linux/bsd mta

Detailed changes:

  • additional import of "os" to retrieve user name
  • add bool "autofrom" to schema
  • conditional to decide whether to use auto generate from address

Config usage if relevant (new plugin or updated schema):

    notify:
      task:
        title: Example
        via:
          - email:
              to: admin@server.net
              smtp_host: smtpout.server.net
              autofrom: yes

Adds the option container_directory to the Deluge plugin
container_directory is a jinja2 template used by client.core.rename_folder to rename the top level folder - which is effectively the torrent name in deluge 
added 'name' to status_keys array to support this
added code to check that there is more than 1 file and abort if the torrent is a single file
changed verification from file count greater than 1 to check for a folder structure
changed to folder_rename to use name extracted from folder structure instead of torrent name
removed 'name' from status_keys
 - thanks tubedogg for the suggestions and assistance
changed logging to verbose / debug per liiight's suggestion
removed condition on main_file_only because big_file_name is only generated if content_filename is valid
changed container_directory to variable retrieved from config or set entry
 - container_directory option did not work if configured by set
per tubedogg's recommendation
Added the ability to set the from automatically based on the FQDN hostname of the system and user running the process
Copy link
Copy Markdown
Member

@liiight liiight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might do something like:

email['From'] = os.getlogin() + '@' + socket.getfqdn() if config['autoform'] else config['From']

Just a style suggestion

email['To'] = ','.join(config['to'])
email['From'] = config['from']
if config['autofrom']:
email['From'] = os.getlogin() + '@' + socket.getfqdn()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird indentation. Probably used tab instead of spaces

if config['autofrom']:
email['From'] = os.getlogin() + '@' + socket.getfqdn()
else:
email['From'] = config['from']
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same indentation issue

removed extra spaces
email['To'] = ','.join(config['to'])
email['From'] = config['from']
if config['autofrom']:
email['From'] = os.getlogin() + '@' + socket.getfqdn()
Copy link
Copy Markdown
Contributor

@cvium cvium Sep 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.getlogin() is not cross-platform for Python 2.7

looks like getpass.getuser() is cross platform 
I have tested on Windows and Linux, unfortunately I do not have a Mac to test on
could add error handling - lmk
@liiight
Copy link
Copy Markdown
Member

liiight commented Sep 16, 2017

Have you tested this on windows by any chance?

@andocromn
Copy link
Copy Markdown
Contributor Author

yeah I did test on windows and linux

@liiight liiight merged commit e6f70ad into Flexget:develop Sep 16, 2017
@liiight
Copy link
Copy Markdown
Member

liiight commented Sep 16, 2017

Cool. Care to update the wiki?

@andocromn
Copy link
Copy Markdown
Contributor Author

wiki updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants