mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-30 19:40:08 -07:00
Merge pull request #1303 from samwiseg00/feature/add_timestamp
Add UTC timestamp to notification params + OCD + Change discord timestamp function
This commit is contained in:
commit
1eee03fa8f
4 changed files with 9 additions and 1 deletions
|
@ -321,6 +321,7 @@ NOTIFICATION_PARAMETERS = [
|
|||
{'name': 'Datestamp', 'type': 'str', 'value': 'datestamp', 'description': 'The date (in date format) when the notification is triggered.'},
|
||||
{'name': 'Timestamp', 'type': 'str', 'value': 'timestamp', 'description': 'The time (in time format) when the notification is triggered.'},
|
||||
{'name': 'Unix Time', 'type': 'int', 'value': 'unixtime', 'description': 'The unix timestamp when the notification is triggered.'},
|
||||
{'name': 'UTC Time', 'type': 'int', 'value': 'utctime', 'description': 'The UTC timestamp in ISO format when the notification is triggered.'},
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -202,17 +202,22 @@ def convert_seconds_to_minutes(s):
|
|||
def today():
|
||||
today = datetime.date.today()
|
||||
yyyymmdd = datetime.date.isoformat(today)
|
||||
|
||||
return yyyymmdd
|
||||
|
||||
|
||||
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'):
|
||||
|
||||
hd = ''
|
||||
|
|
|
@ -749,6 +749,7 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
|
|||
'datestamp': now.format(date_format),
|
||||
'timestamp': now.format(time_format),
|
||||
'unixtime': int(time.time()),
|
||||
'utctime': helpers.utc_now_iso(),
|
||||
# Stream parameters
|
||||
'streams': stream_count,
|
||||
'user_streams': user_stream_count,
|
||||
|
@ -969,6 +970,7 @@ def build_server_notify_params(notify_action=None, **kwargs):
|
|||
'datestamp': now.format(date_format),
|
||||
'timestamp': now.format(time_format),
|
||||
'unixtime': int(time.time()),
|
||||
'utctime': helpers.utc_now_iso(),
|
||||
# Plex Media Server update parameters
|
||||
'update_version': pms_download_info['version'],
|
||||
'update_url': pms_download_info['download_url'],
|
||||
|
|
|
@ -1146,7 +1146,7 @@ class DISCORD(Notifier):
|
|||
|
||||
# Build Discord post attachment
|
||||
attachment = {'title': title,
|
||||
'timestamp': helpers.utc_now_iso()
|
||||
'timestamp': pretty_metadata.parameters['utctime']
|
||||
}
|
||||
|
||||
if self.config['color']:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue