Added a new branch, edited the code to include the week_number

This commit is contained in:
samip5 2018-04-10 12:10:32 +03:00
parent ab9132cdd4
commit f624908302
3 changed files with 3 additions and 5 deletions

View file

@ -304,6 +304,7 @@ NOTIFICATION_PARAMETERS = [
{'name': 'Server Version', 'type': 'str', 'value': 'server_version', 'description': 'The current version of your Plex Server.'}, {'name': 'Server Version', 'type': 'str', 'value': 'server_version', 'description': 'The current version of your Plex Server.'},
{'name': 'Server ID', 'type': 'str', 'value': 'server_machine_id', 'description': 'The unique identifier for your Plex Server.'}, {'name': 'Server ID', 'type': 'str', 'value': 'server_machine_id', 'description': 'The unique identifier for your Plex Server.'},
{'name': 'Action', 'type': 'str', 'value': 'action', 'description': 'The action that triggered the notification.'}, {'name': 'Action', 'type': 'str', 'value': 'action', 'description': 'The action that triggered the notification.'},
{'name': 'Week Number', 'type': 'int', 'value': 'week_number', 'description': 'The week number when the notfication was triggered.'},
{'name': 'Datestamp', 'type': 'str', 'value': 'datestamp', 'description': 'The date (in date format) when the notification was triggered.'}, {'name': 'Datestamp', 'type': 'str', 'value': 'datestamp', 'description': 'The date (in date format) when the notification was triggered.'},
{'name': 'Timestamp', 'type': 'str', 'value': 'timestamp', 'description': 'The time (in time format) when the notification was triggered.'}, {'name': 'Timestamp', 'type': 'str', 'value': 'timestamp', 'description': 'The time (in time format) when the notification was triggered.'},
{'name': 'Unix Time', 'type': 'int', 'value': 'unixtime', 'description': 'The unix timestamp when the notification was triggered.'}, {'name': 'Unix Time', 'type': 'int', 'value': 'unixtime', 'description': 'The unix timestamp when the notification was triggered.'},

View file

@ -308,7 +308,7 @@ class Newsletter(object):
_TEMPLATE_MASTER = '' _TEMPLATE_MASTER = ''
_TEMPLATE = '' _TEMPLATE = ''
def __init__(self, config=None, email_config=None, start_date=None, week_number=None, end_date=None, def __init__(self, config=None, email_config=None, start_date=None, end_date=None,
subject=None, body=None, message=None): subject=None, body=None, message=None):
self.config = self.set_config(config=config, default=self._DEFAULT_CONFIG) self.config = self.set_config(config=config, default=self._DEFAULT_CONFIG)
self.email_config = self.set_config(config=email_config, default=self._DEFAULT_EMAIL_CONFIG) self.email_config = self.set_config(config=email_config, default=self._DEFAULT_EMAIL_CONFIG)
@ -333,9 +333,6 @@ class Newsletter(object):
except ValueError: except ValueError:
pass pass
if week_number is None:
self.week_number = int(datetime.date.today().strftime("%W"))
if self.start_date is None: if self.start_date is None:
self.start_date = self.end_date.shift(days=-self.config['last_days']+1).floor('day') self.start_date = self.end_date.shift(days=-self.config['last_days']+1).floor('day')

View file

@ -703,7 +703,6 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
'tautulli_remote': plexpy.CONFIG.GIT_REMOTE, 'tautulli_remote': plexpy.CONFIG.GIT_REMOTE,
'tautulli_branch': plexpy.CONFIG.GIT_BRANCH, 'tautulli_branch': plexpy.CONFIG.GIT_BRANCH,
'tautulli_commit': plexpy.CURRENT_VERSION, 'tautulli_commit': plexpy.CURRENT_VERSION,
'week_number': int(datetime.date.today().strftime("%W")),
'server_name': plexpy.CONFIG.PMS_NAME, 'server_name': plexpy.CONFIG.PMS_NAME,
'server_ip': plexpy.CONFIG.PMS_IP, 'server_ip': plexpy.CONFIG.PMS_IP,
'server_port': plexpy.CONFIG.PMS_PORT, 'server_port': plexpy.CONFIG.PMS_PORT,
@ -712,6 +711,7 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
'server_platform': plexpy.CONFIG.PMS_PLATFORM, 'server_platform': plexpy.CONFIG.PMS_PLATFORM,
'server_version': plexpy.CONFIG.PMS_VERSION, 'server_version': plexpy.CONFIG.PMS_VERSION,
'action': notify_action.lstrip('on_'), 'action': notify_action.lstrip('on_'),
'week_number': arrow.now().isocalendar()[1],
'datestamp': arrow.now().format(date_format), 'datestamp': arrow.now().format(date_format),
'timestamp': arrow.now().format(time_format), 'timestamp': arrow.now().format(time_format),
'unixtime': int(time.time()), 'unixtime': int(time.time()),