Change notification detection

merge-requests/21/head
Bob Mottram 2021-03-16 16:10:21 +00:00
parent 9fee890f32
commit 29e3fcf8d0
1 changed files with 4 additions and 8 deletions

View File

@ -767,8 +767,6 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
domainFull = getFullDomain(domain, port) domainFull = getFullDomain(domain, port)
actor = httpPrefix + '://' + domainFull + '/users/' + nickname actor = httpPrefix + '://' + domainFull + '/users/' + nickname
prevSay = '' prevSay = ''
prevDM = False
prevReply = False
prevCalendar = False prevCalendar = False
prevFollow = False prevFollow = False
prevLike = '' prevLike = ''
@ -810,17 +808,16 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
speakerJson['notify']['theme'] + '/sounds' 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 speakerJson['notify']['dm'] != prevDM: if speakerJson['notify'].get('direct'):
if speakerJson['notify']['dm'] is True: if speakerJson['notify']['direct'] is True:
if notificationSounds: if notificationSounds:
_playNotificationSound(soundsDir + '/' + _playNotificationSound(soundsDir + '/' +
dmSoundFilename, player) dmSoundFilename, player)
_desktopNotification(notificationType, title, _desktopNotification(notificationType, title,
'New direct message ' + 'New direct message ' +
actor + '/dm') actor + '/dm')
prevDM = speakerJson['notify']['dm'] elif speakerJson['notify'].get('replyToYou'):
elif newRepliesExist != prevReply: if speakerJson['notify']['replyToYou'] is True:
if newRepliesExist:
if notificationSounds: if notificationSounds:
_playNotificationSound(soundsDir + '/' + _playNotificationSound(soundsDir + '/' +
replySoundFilename, replySoundFilename,
@ -828,7 +825,6 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
_desktopNotification(notificationType, title, _desktopNotification(notificationType, title,
'New reply ' + 'New reply ' +
actor + '/tlreplies') actor + '/tlreplies')
prevReply = newRepliesExist
elif speakerJson['notify']['calendar'] != prevCalendar: elif speakerJson['notify']['calendar'] != prevCalendar:
if speakerJson['notify']['calendar'] is True: if speakerJson['notify']['calendar'] is True:
if notificationSounds: if notificationSounds: