parent
23007ec8f9
commit
c04445dfff
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user