diff --git a/CHANGELOG.md b/CHANGELOG.md index aab09779..1a0de924 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## v1.2.5 (2015-11-25) + +* Add video_decision and audio_decision to notification options +* Fix IP address logging +* Fix log spam if notifications disabled + + ## v1.2.4 (2015-11-24) * Add filtering by media type in the history table diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index 2129b5aa..fd3dd1c5 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -1001,9 +1001,17 @@ available_notification_agents = sorted(notifiers.available_notification_agents() {episode_num00} The two digit episode number. + + {video_decision} + The video transcode decisions for the media item. + + + {audio_decision} + The audio transcode decisions for the media item. + {transcode_decision} - The transcode decisions for the media item. + The stream transcode decisions for the media item. {year} diff --git a/plexpy/activity_processor.py b/plexpy/activity_processor.py index fda00ac1..df9131cb 100644 --- a/plexpy/activity_processor.py +++ b/plexpy/activity_processor.py @@ -39,7 +39,6 @@ class ActivityProcessor(object): 'parent_title': session['parent_title'], 'grandparent_title': session['grandparent_title'], 'friendly_name': session['friendly_name'], - 'ip_address': session['ip_address'], 'player': session['player'], 'platform': session['platform'], 'parent_rating_key': session['parent_rating_key'], @@ -78,20 +77,19 @@ class ActivityProcessor(object): threading.Thread(target=notification_handler.notify, kwargs=dict(stream_data=values, notify_action='play')).start() + # If it's our first write then time stamp it. started = int(time.time()) timestamp = {'started': started} + self.db.upsert('sessions', timestamp, keys) + ip_address = {'ip_address': session['ip_address']} # Try and grab IP address from logs (fallback if not on PMS 0.9.14 and above) if not session['ip_address']: if plexpy.CONFIG.IP_LOGGING_ENABLE and plexpy.CONFIG.PMS_LOGS_FOLDER: ip_address = self.find_session_ip(rating_key=session['rating_key'], machine_id=session['machine_id']) - timestamp.update({'ip_address': ip_address}) - else: - timestamp.update({'ip_address': None}) - - # If it's our first write then time stamp it. - self.db.upsert('sessions', timestamp, keys) + ip_address = {'ip_address': ip_address} + self.db.upsert('sessions', ip_address, keys) def write_session_history(self, session=None, import_metadata=None, is_import=False, import_ignore_interval=0): from plexpy import users diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index 2b91cc85..4dab68dc 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -161,7 +161,7 @@ def notify(stream_data=None, notify_action=None): elif stream_data['media_type'] == 'clip': pass else: - logger.debug(u"PlexPy Notifier :: Notify called with unsupported media type.") + #logger.debug(u"PlexPy Notifier :: Notify called with unsupported media type.") pass else: logger.debug(u"PlexPy Notifier :: Notify called but incomplete data received.") @@ -370,6 +370,8 @@ def build_notify_text(session=None, timeline=None, state=None): duration = helpers.convert_milliseconds_to_minutes(metadata['duration']) # Default values + video_decision = '' + audio_decision = '' transcode_decision = '' stream_duration = 0 view_offset = 0 @@ -381,18 +383,15 @@ def build_notify_text(session=None, timeline=None, state=None): # Session values if session: # Generate a combined transcode decision value - if session['video_decision']: - if session['video_decision'] == 'transcode': - transcode_decision = 'Transcode' - elif session['video_decision'] == 'copy' or session['audio_decision'] == 'copy': - transcode_decision = 'Direct Stream' - else: - transcode_decision = 'Direct Play' - elif session['audio_decision']: - if session['audio_decision'] == 'transcode': - transcode_decision = 'Transcode' - else: - transcode_decision = 'Direct Play' + video_decision = session['video_decision'].title() + audio_decision = session['audio_decision'].title() + + if session['video_decision'] == 'transcode' or session['audio_decision'] == 'transcode': + transcode_decision = 'Transcode' + elif session['video_decision'] == 'copy' or session['audio_decision'] == 'copy': + transcode_decision = 'Direct Stream' + else: + transcode_decision = 'Direct Play' if state != 'play': if session['paused_counter']: @@ -422,10 +421,12 @@ def build_notify_text(session=None, timeline=None, state=None): 'artist_name': metadata['grandparent_title'], 'album_name': metadata['parent_title'], 'track_name': metadata['title'], - 'season_num': metadata['parent_index'], + 'season_num': metadata['parent_index'].zfill(1), 'season_num00': metadata['parent_index'].zfill(2), - 'episode_num': metadata['index'], + 'episode_num': metadata['index'].zfill(1), 'episode_num00': metadata['index'].zfill(2), + 'video_decision': video_decision, + 'audio_decision': audio_decision, 'transcode_decision': transcode_decision, 'year': metadata['year'], 'studio': metadata['studio'], diff --git a/plexpy/version.py b/plexpy/version.py index 2bc856a5..5060fcf0 100644 --- a/plexpy/version.py +++ b/plexpy/version.py @@ -1,2 +1,2 @@ PLEXPY_VERSION = "master" -PLEXPY_RELEASE_VERSION = "1.2.4" +PLEXPY_RELEASE_VERSION = "1.2.5"