Clean up time formats for server notifications

This commit is contained in:
JonnyWong16 2016-02-02 20:33:08 -08:00
parent 14a90d84ec
commit a957e8eb4f

View file

@ -560,9 +560,9 @@ def build_notify_text(session=None, timeline=None, state=None):
if state == 'play': if state == 'play':
# Default body text # Default body text
body_text = '%s (%s) is watching %s' % (session['friendly_name'], body_text = '%s (%s) started playing %s' % (session['friendly_name'],
session['player'], session['player'],
full_title) full_title)
if on_start_subject and on_start_body: if on_start_subject and on_start_body:
try: try:
@ -729,6 +729,10 @@ def build_notify_text(session=None, timeline=None, state=None):
def build_server_notify_text(state=None): def build_server_notify_text(state=None):
# Get time formats
date_format = plexpy.CONFIG.DATE_FORMAT.replace('Do','').replace('zz','')
time_format = plexpy.CONFIG.TIME_FORMAT.replace('Do','').replace('zz','')
# Get the server name # Get the server name
server_name = plexpy.CONFIG.PMS_NAME server_name = plexpy.CONFIG.PMS_NAME
@ -753,11 +757,12 @@ def build_server_notify_text(state=None):
on_intup_body = plexpy.CONFIG.NOTIFY_ON_INTUP_BODY_TEXT on_intup_body = plexpy.CONFIG.NOTIFY_ON_INTUP_BODY_TEXT
script_args_text = plexpy.CONFIG.NOTIFY_SCRIPTS_ARGS_TEXT script_args_text = plexpy.CONFIG.NOTIFY_SCRIPTS_ARGS_TEXT
available_params = {'server_name': server_name, available_params = {# Global paramaters
'server_name': server_name,
'server_uptime': server_uptime, 'server_uptime': server_uptime,
'action': state, 'action': state.title(),
'datestamp': arrow.now().format(plexpy.CONFIG.DATE_FORMAT.replace('Do','').replace('zz','')), 'datestamp': arrow.now().format(date_format),
'timestamp': arrow.now().format(plexpy.CONFIG.TIME_FORMAT.replace('Do','').replace('zz',''))} 'timestamp': arrow.now().format(time_format)}
# Default text # Default text
subject_text = 'PlexPy (%s)' % server_name subject_text = 'PlexPy (%s)' % server_name