diff --git a/scripts/mpd-notifications/mpd-notifications.py b/scripts/mpd-notifications/mpd-notifications.py index b16c63e..07d1092 100644 --- a/scripts/mpd-notifications/mpd-notifications.py +++ b/scripts/mpd-notifications/mpd-notifications.py @@ -47,6 +47,7 @@ last_np = '' def notify_song(): + """React to mpd event, send a now playing dispatch message if relevant.""" global last_np status = client.status() logger.debug(status) diff --git a/scripts/procmail-to-dispatch/procmail-to-dispatch.py b/scripts/procmail-to-dispatch/procmail-to-dispatch.py index 181d758..c569311 100644 --- a/scripts/procmail-to-dispatch/procmail-to-dispatch.py +++ b/scripts/procmail-to-dispatch/procmail-to-dispatch.py @@ -1,7 +1,4 @@ -""" -procmail-to-dispatch.py --- use dr.botzo's Dispatch to send mail notifications - -""" +"""Use dr.botzo's Dispatch to send mail notifications""" import argparse import getpass @@ -27,8 +24,7 @@ parser.add_argument('-l', '--location') parser.add_argument('-u', '--user') args = parser.parse_args() -if (args.filename == None or args.user == None or - args.location == None): +if args.filename is None or args.user is None or args.location is None: print("script needs -f/--filename (location of .procmailrc.log) " "-l/--location (url to connect to) -u/--user (user to authenticate to XML-RPC as)") sys.exit(2) @@ -48,7 +44,9 @@ st_results = os.stat(args.filename) st_size = st_results[6] file.seek(st_size) + def get_mail_items(filename): + """Get info to notify about from an email in the maildir.""" sender = None subject = None @@ -66,7 +64,7 @@ def get_mail_items(filename): if sender: return (sender, "[no subject]") -while 1: +while True: try: filename = None @@ -117,5 +115,3 @@ while 1: except UnicodeDecodeError as e: logger.error("Error: " + str(e) + ", skipping") pass - -# vi:tabstop=4:expandtab:autoindent