mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 13:41:15 -07:00
add timestamps for rich metadata info on discord
This commit is contained in:
parent
4884cee309
commit
ddb7fa04ca
2 changed files with 11 additions and 7 deletions
|
@ -209,6 +209,9 @@ def now():
|
|||
now = datetime.datetime.now()
|
||||
return now.strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
def utc_now_iso():
|
||||
utcnow = datetime.datetime.utcnow()
|
||||
return utcnow.isoformat()
|
||||
|
||||
def human_duration(s, sig='dhms'):
|
||||
|
||||
|
@ -949,7 +952,7 @@ def parse_condition_logic_string(s, num_cond=0):
|
|||
"""
|
||||
valid_tokens = re.compile(r'(\(|\)|and|or)')
|
||||
conditions_pattern = re.compile(r'{\d+}')
|
||||
|
||||
|
||||
tokens = [x.strip() for x in re.split(valid_tokens, s.lower()) if x.strip()]
|
||||
|
||||
stack = [[]]
|
||||
|
@ -960,7 +963,7 @@ def parse_condition_logic_string(s, num_cond=0):
|
|||
close_bracket_next = False
|
||||
nest_and = 0
|
||||
nest_nest_and = 0
|
||||
|
||||
|
||||
for i, x in enumerate(tokens):
|
||||
if open_bracket_next and x == '(':
|
||||
stack[-1].append([])
|
||||
|
@ -971,7 +974,7 @@ def parse_condition_logic_string(s, num_cond=0):
|
|||
close_bracket_next = False
|
||||
if nest_and:
|
||||
nest_nest_and += 1
|
||||
|
||||
|
||||
elif close_bracket_next and x == ')':
|
||||
stack.pop()
|
||||
if not stack:
|
||||
|
@ -1000,7 +1003,7 @@ def parse_condition_logic_string(s, num_cond=0):
|
|||
if nest_and > nest_nest_and:
|
||||
stack.pop()
|
||||
nest_and -= 1
|
||||
|
||||
|
||||
elif bool_next and x == 'and' and i < len(tokens)-1:
|
||||
stack[-1].append([])
|
||||
stack.append(stack[-1][-1])
|
||||
|
@ -1011,7 +1014,7 @@ def parse_condition_logic_string(s, num_cond=0):
|
|||
open_bracket_next = True
|
||||
close_bracket_next = False
|
||||
nest_and += 1
|
||||
|
||||
|
||||
elif bool_next and x == 'or' and i < len(tokens)-1:
|
||||
stack[-1].append(x)
|
||||
cond_next = True
|
||||
|
|
|
@ -420,7 +420,7 @@ def get_notifiers(notifier_id=None, notify_action=None):
|
|||
db = database.MonitorDatabase()
|
||||
result = db.select('SELECT id, agent_id, agent_name, agent_label, friendly_name, %s FROM notifiers %s'
|
||||
% (', '.join(notify_actions), where), args=args)
|
||||
|
||||
|
||||
for item in result:
|
||||
item['active'] = int(any([item.pop(k) for k in item.keys() if k in notify_actions]))
|
||||
|
||||
|
@ -1145,7 +1145,8 @@ class DISCORD(Notifier):
|
|||
plex_url = pretty_metadata.get_plex_url()
|
||||
|
||||
# Build Discord post attachment
|
||||
attachment = {'title': title
|
||||
attachment = {'title': title,
|
||||
'timestamp': helpers.utc_now_iso()
|
||||
}
|
||||
|
||||
if self.config['color']:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue