Better IP address handling for current activity

This commit is contained in:
Jonathan Wong 2015-11-11 09:16:28 -08:00
parent 80df8f6191
commit d79d5d5b39
2 changed files with 6 additions and 2 deletions

View file

@ -32,6 +32,7 @@ user_thumb Returns the profile picture of the user owning the s
state Returns the state of the current session. Either 'playing', 'paused' or 'buffering'.
title Returns the name of the episode, movie or music track.
year Returns the year of the episode, movie, or clip.
ip_address Returns the ip address of the stream.
player Returns the name of the platform used to play the stream.
platform Returns the type of platform used to play the stream.
throttled Returns true if the transcode session is throttled.
@ -192,7 +193,11 @@ DOCUMENTATION :: END
% if a['media_type'] != 'photo':
<div class="dashboard-activity-poster-info-bar">
<div class="dashboard-activity-poster-info-ip-address">
% if a['ip_address']:
<span>IP: ${a['ip_address']}</span>
% else:
<span>IP: N/A</span>
% endif
</div>
<div class="dashboard-activity-poster-info-time">
<span class="progress_time">${a['view_offset']}</span>/<span class="progress_time">${a['duration']}</span>

View file

@ -1004,8 +1004,7 @@ class DataFactory(object):
monitor_db = database.MonitorDatabase()
if session_key:
query = 'SELECT CASE WHEN ip_address IS NULL THEN "N/A" ELSE ip_address END ' \
'FROM sessions WHERE session_key = %d' % int(session_key)
query = 'SELECT ip_address FROM sessions WHERE session_key = %d' % int(session_key)
result = monitor_db.select(query)
else:
return None