Merge branch 'dev'

This commit is contained in:
Jonathan Wong 2015-11-25 19:16:50 -08:00
commit 683e5663e1
5 changed files with 38 additions and 24 deletions

View file

@ -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

View file

@ -1001,9 +1001,17 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
<td width="150"><strong>{episode_num00}</strong></td>
<td>The two digit episode number.</td>
</tr>
<tr>
<td width="150"><strong>{video_decision}</strong></td>
<td>The video transcode decisions for the media item.</td>
</tr>
<tr>
<td width="150"><strong>{audio_decision}</strong></td>
<td>The audio transcode decisions for the media item.</td>
</tr>
<tr>
<td width="150"><strong>{transcode_decision}</strong></td>
<td>The transcode decisions for the media item.</td>
<td>The stream transcode decisions for the media item.</td>
</tr>
<tr>
<td width="150"><strong>{year}</strong></td>

View file

@ -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

View file

@ -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'],

View file

@ -1,2 +1,2 @@
PLEXPY_VERSION = "master"
PLEXPY_RELEASE_VERSION = "1.2.4"
PLEXPY_RELEASE_VERSION = "1.2.5"