Check for changed notification state

merge-requests/30/head
Bob Mottram 2021-03-09 22:47:10 +00:00
parent 13d0bea918
commit 5c18b3b50f
1 changed files with 26 additions and 38 deletions

View File

@ -151,62 +151,50 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
'theme/' + speakerJson['notify']['theme'] + '/sounds' 'theme/' + speakerJson['notify']['theme'] + '/sounds'
if not os.path.isdir(soundsDir): if not os.path.isdir(soundsDir):
soundsDir = 'theme/default/sounds' soundsDir = 'theme/default/sounds'
if dmSoundFilename: if speakerJson['notify']['dm'] != prevDM:
if speakerJson['notify']['dm'] and \ if speakerJson['notify']['dm'] is True:
speakerJson['notify']['dm'] != prevDM:
_playNotificationSound(soundsDir + '/' + _playNotificationSound(soundsDir + '/' +
dmSoundFilename, player) dmSoundFilename, player)
_desktopNotification(notificationType, _desktopNotification(notificationType, title,
title,
'New direct message ' + 'New direct message ' +
actor + '/dm') actor + '/dm')
prevDM = speakerJson['notify']['dm'] prevDM = speakerJson['notify']['dm']
elif replySoundFilename: elif speakerJson['notify']['reply'] != prevReply:
if speakerJson['notify']['reply'] and \ if speakerJson['notify']['reply'] is True:
speakerJson['notify']['reply'] != prevReply:
_playNotificationSound(soundsDir + '/' + _playNotificationSound(soundsDir + '/' +
replySoundFilename, player) replySoundFilename, player)
_desktopNotification(notificationType, _desktopNotification(notificationType, title,
title,
'New reply ' + 'New reply ' +
actor + '/tlreplies') actor + '/tlreplies')
prevReply = speakerJson['notify']['reply'] prevReply = speakerJson['notify']['reply']
elif calendarSoundFilename: elif speakerJson['notify']['calendar'] != prevCalendar:
if speakerJson['notify']['calendar'] and \ if speakerJson['notify']['calendar'] is True:
speakerJson['notify']['calendar'] != prevCalendar:
_playNotificationSound(soundsDir + '/' + _playNotificationSound(soundsDir + '/' +
calendarSoundFilename, player) calendarSoundFilename, player)
_desktopNotification(notificationType, _desktopNotification(notificationType, title,
title,
'New calendar event ' + 'New calendar event ' +
actor + '/calendar') actor + '/calendar')
prevCalendar = speakerJson['notify']['calendar'] prevCalendar = speakerJson['notify']['calendar']
elif followSoundFilename: elif speakerJson['notify']['followRequests'] != prevFollow:
if speakerJson['notify']['followRequests'] and \ if speakerJson['notify']['followRequests'] is True:
speakerJson['notify']['followRequests'] != prevFollow:
_playNotificationSound(soundsDir + '/' + _playNotificationSound(soundsDir + '/' +
followSoundFilename, player) followSoundFilename, player)
_desktopNotification(notificationType, _desktopNotification(notificationType, title,
title,
'New follow request ' + 'New follow request ' +
actor + '/followers#buttonheader') actor + '/followers#buttonheader')
prevFollow = speakerJson['notify']['followRequests'] prevFollow = speakerJson['notify']['followRequests']
elif likeSoundFilename: elif speakerJson['notify']['likedBy'] != prevLike:
if speakerJson['notify']['likedBy'] != prevLike:
_playNotificationSound(soundsDir + '/' + _playNotificationSound(soundsDir + '/' +
likeSoundFilename, player) likeSoundFilename, player)
_desktopNotification(notificationType, _desktopNotification(notificationType, title,
title,
'New like ' + 'New like ' +
speakerJson['notify']['likedBy']) speakerJson['notify']['likedBy'])
prevLike = speakerJson['notify']['likedBy'] prevLike = speakerJson['notify']['likedBy']
elif shareSoundFilename: elif speakerJson['notify']['share'] != prevShare:
if speakerJson['notify']['share'] and \ if speakerJson['notify']['share'] is True:
speakerJson['notify']['share'] != prevShare:
_playNotificationSound(soundsDir + '/' + _playNotificationSound(soundsDir + '/' +
shareSoundFilename, player) shareSoundFilename, player)
_desktopNotification(notificationType, _desktopNotification(notificationType, title,
title,
'New shared item ' + 'New shared item ' +
actor + '/shares') actor + '/shares')
prevShare = speakerJson['notify']['share'] prevShare = speakerJson['notify']['share']