mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 13:41:15 -07:00
Add IP address to current activity
This commit is contained in:
parent
0c33e7492a
commit
fd9cf7017b
4 changed files with 34 additions and 1 deletions
|
@ -688,6 +688,14 @@ a:hover .dashboard-activity-poster {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
width: 150px;
|
width: 150px;
|
||||||
}
|
}
|
||||||
|
.dashboard-activity-poster-info-ip-address {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 5px;
|
||||||
|
left: 10px;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #eee;
|
||||||
|
}
|
||||||
.dashboard-activity-poster-info-time {
|
.dashboard-activity-poster-info-time {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 5px;
|
bottom: 5px;
|
||||||
|
|
|
@ -191,6 +191,9 @@ DOCUMENTATION :: END
|
||||||
</div>
|
</div>
|
||||||
% if a['media_type'] != 'photo':
|
% if a['media_type'] != 'photo':
|
||||||
<div class="dashboard-activity-poster-info-bar">
|
<div class="dashboard-activity-poster-info-bar">
|
||||||
|
<div class="dashboard-activity-poster-info-ip-address">
|
||||||
|
<span>IP: ${a['ip_address']}</span>
|
||||||
|
</div>
|
||||||
<div class="dashboard-activity-poster-info-time">
|
<div class="dashboard-activity-poster-info-time">
|
||||||
<span class="progress_time">${a['view_offset']}</span>/<span class="progress_time">${a['duration']}</span>
|
<span class="progress_time">${a['view_offset']}</span>/<span class="progress_time">${a['duration']}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -998,4 +998,21 @@ class DataFactory(object):
|
||||||
else:
|
else:
|
||||||
return 'No updated rating key needed in database. No changes were made.'
|
return 'No updated rating key needed in database. No changes were made.'
|
||||||
# for debugging
|
# for debugging
|
||||||
#return mapping
|
#return mapping
|
||||||
|
|
||||||
|
def get_session_ip(self, session_key=''):
|
||||||
|
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)
|
||||||
|
result = monitor_db.select(query)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
ip_address = 'N/A'
|
||||||
|
|
||||||
|
for item in result:
|
||||||
|
ip_address = item[0]
|
||||||
|
|
||||||
|
return ip_address
|
||||||
|
|
|
@ -715,6 +715,11 @@ class WebInterface(object):
|
||||||
return serve_template(templatename="current_activity.html", data=None)
|
return serve_template(templatename="current_activity.html", data=None)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
|
data_factory = datafactory.DataFactory()
|
||||||
|
for session in result['sessions']:
|
||||||
|
ip_address = data_factory.get_session_ip(session['session_key'])
|
||||||
|
session['ip_address'] = ip_address
|
||||||
|
|
||||||
return serve_template(templatename="current_activity.html", data=result)
|
return serve_template(templatename="current_activity.html", data=result)
|
||||||
else:
|
else:
|
||||||
logger.warn('Unable to retrieve data.')
|
logger.warn('Unable to retrieve data.')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue