Add option label for plugin seven (#1304)

This commit is contained in:
André 2025-03-12 21:27:39 +01:00 committed by GitHub
parent 3cc98662f3
commit 386c77e14d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 2 deletions

View File

@ -113,10 +113,14 @@ class NotifySeven(NotifyBase):
'type': 'bool',
'default': False,
},
'label': {
'name': _('Label'),
'type': 'string'
},
})
def __init__(self, apikey, targets=None, source=None, flash=None,
**kwargs):
label=None, **kwargs):
"""
Initialize Seven Object
"""
@ -133,6 +137,8 @@ class NotifySeven(NotifyBase):
if not isinstance(source, str) else source.strip()
self.flash = self.template_args['flash']['default'] \
if flash is None else bool(flash)
self.label = None \
if not isinstance(label, str) else label.strip()
# Parse our targets
self.targets = list()
@ -154,7 +160,7 @@ class NotifySeven(NotifyBase):
def url_identifier(self):
"""
Returns all of the identifiers that make this URL unique from
another simliar one. Targets or end points should never be identified
another similar one. Targets or end points should never be identified
here.
"""
return (self.secure_protocol, self.apikey)
@ -189,6 +195,8 @@ class NotifySeven(NotifyBase):
payload['from'] = self.source
if self.flash:
payload['flash'] = self.flash
if self.label:
payload['label'] = self.label
# Create a copy of the targets list
targets = list(self.targets)
while len(targets):
@ -278,6 +286,8 @@ class NotifySeven(NotifyBase):
}
if self.source:
params['from'] = self.source
if self.label:
params['label'] = self.label
# Our URL parameters
params = self.url_parameters(privacy=privacy, *args, **kwargs)
@ -332,5 +342,7 @@ class NotifySeven(NotifyBase):
results['flash'] = \
parse_bool(results['qsd'].get('flash', False))
results['label'] = \
results['qsd'].get('label', None)
return results

View File

@ -93,6 +93,10 @@ apprise_url_tests = (
# valid number, utilizing the optional source= variable (same as from)
'instance': NotifySeven,
}),
('seven://{}/15551232000?source=AR&flash=1&label=123'.format('3' * 14), {
# valid number, utilizing the optional source= variable (same as from)
'instance': NotifySeven,
}),
)