diff --git a/plexpy/common.py b/plexpy/common.py index 2c7ccbcc..50dc6f37 100644 --- a/plexpy/common.py +++ b/plexpy/common.py @@ -304,6 +304,7 @@ NOTIFICATION_PARAMETERS = [ {'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': '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': '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.'}, diff --git a/plexpy/newsletters.py b/plexpy/newsletters.py index b5b12100..a8ccefed 100644 --- a/plexpy/newsletters.py +++ b/plexpy/newsletters.py @@ -308,7 +308,7 @@ class Newsletter(object): _TEMPLATE_MASTER = '' _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): 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) @@ -333,9 +333,6 @@ class Newsletter(object): except ValueError: pass - if week_number is None: - self.week_number = int(datetime.date.today().strftime("%W")) - if self.start_date is None: self.start_date = self.end_date.shift(days=-self.config['last_days']+1).floor('day') diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index 6242db34..5a124647 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -703,7 +703,6 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m 'tautulli_remote': plexpy.CONFIG.GIT_REMOTE, 'tautulli_branch': plexpy.CONFIG.GIT_BRANCH, 'tautulli_commit': plexpy.CURRENT_VERSION, - 'week_number': int(datetime.date.today().strftime("%W")), 'server_name': plexpy.CONFIG.PMS_NAME, 'server_ip': plexpy.CONFIG.PMS_IP, '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_version': plexpy.CONFIG.PMS_VERSION, 'action': notify_action.lstrip('on_'), + 'week_number': arrow.now().isocalendar()[1], 'datestamp': arrow.now().format(date_format), 'timestamp': arrow.now().format(time_format), 'unixtime': int(time.time()),