Keep track of previous values

merge-requests/30/head
Bob Mottram 2021-03-09 22:35:06 +00:00
parent fc1b22fbd9
commit 13d0bea918
1 changed files with 6 additions and 7 deletions

View File

@ -160,6 +160,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
title, title,
'New direct message ' + 'New direct message ' +
actor + '/dm') actor + '/dm')
prevDM = speakerJson['notify']['dm']
elif replySoundFilename: elif replySoundFilename:
if speakerJson['notify']['reply'] and \ if speakerJson['notify']['reply'] and \
speakerJson['notify']['reply'] != prevReply: speakerJson['notify']['reply'] != prevReply:
@ -169,6 +170,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
title, title,
'New reply ' + 'New reply ' +
actor + '/tlreplies') actor + '/tlreplies')
prevReply = speakerJson['notify']['reply']
elif calendarSoundFilename: elif calendarSoundFilename:
if speakerJson['notify']['calendar'] and \ if speakerJson['notify']['calendar'] and \
speakerJson['notify']['calendar'] != prevCalendar: speakerJson['notify']['calendar'] != prevCalendar:
@ -178,6 +180,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
title, title,
'New calendar event ' + 'New calendar event ' +
actor + '/calendar') actor + '/calendar')
prevCalendar = speakerJson['notify']['calendar']
elif followSoundFilename: elif followSoundFilename:
if speakerJson['notify']['followRequests'] and \ if speakerJson['notify']['followRequests'] and \
speakerJson['notify']['followRequests'] != prevFollow: speakerJson['notify']['followRequests'] != prevFollow:
@ -187,6 +190,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
title, title,
'New follow request ' + 'New follow request ' +
actor + '/followers#buttonheader') actor + '/followers#buttonheader')
prevFollow = speakerJson['notify']['followRequests']
elif likeSoundFilename: elif likeSoundFilename:
if speakerJson['notify']['likedBy'] != prevLike: if speakerJson['notify']['likedBy'] != prevLike:
_playNotificationSound(soundsDir + '/' + _playNotificationSound(soundsDir + '/' +
@ -195,6 +199,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
title, title,
'New like ' + 'New like ' +
speakerJson['notify']['likedBy']) speakerJson['notify']['likedBy'])
prevLike = speakerJson['notify']['likedBy']
elif shareSoundFilename: elif shareSoundFilename:
if speakerJson['notify']['share'] and \ if speakerJson['notify']['share'] and \
speakerJson['notify']['share'] != prevShare: speakerJson['notify']['share'] != prevShare:
@ -204,12 +209,6 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
title, title,
'New shared item ' + 'New shared item ' +
actor + '/shares') actor + '/shares')
prevDM = speakerJson['notify']['dm']
prevReply = speakerJson['notify']['reply']
prevCalendar = speakerJson['notify']['calendar']
prevFollow = speakerJson['notify']['followRequests']
prevLike = speakerJson['notify']['likedBy']
prevShare = speakerJson['notify']['share'] prevShare = speakerJson['notify']['share']
if speakerJson.get('say'): if speakerJson.get('say'):