mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-13 00:32:58 -07:00
Add most concurrent streams home statistic
This commit is contained in:
parent
6e62ffdd22
commit
9cf6793b24
5 changed files with 64 additions and 1 deletions
|
@ -44,6 +44,11 @@ player Returns the player name for the associated stat.
|
||||||
== Only if 'stat_id' is 'last_watched' ==
|
== Only if 'stat_id' is 'last_watched' ==
|
||||||
last_watch Returns the time the media item was last watched.
|
last_watch Returns the time the media item was last watched.
|
||||||
|
|
||||||
|
== Only if 'stat_id' is 'most_concurrent' ==
|
||||||
|
count Returns the count of the most concurrent streams.
|
||||||
|
started Returns the start time of the most concurrent streams.
|
||||||
|
stopped Returns the stop time of the most concurrent streams.
|
||||||
|
|
||||||
DOCUMENTATION :: END
|
DOCUMENTATION :: END
|
||||||
</%doc>
|
</%doc>
|
||||||
|
|
||||||
|
@ -782,6 +787,30 @@ DOCUMENTATION :: END
|
||||||
% endif
|
% endif
|
||||||
</li>
|
</li>
|
||||||
</div>
|
</div>
|
||||||
|
% elif top_stat['stat_id'] == 'most_concurrent' and top_stat['rows']:
|
||||||
|
<div class="home-platforms-instance">
|
||||||
|
<li>
|
||||||
|
<div class="home-platforms-instance-info">
|
||||||
|
<div class="home-platforms-instance-name">
|
||||||
|
<h4>Most Concurrent Streams</h4>
|
||||||
|
</div>
|
||||||
|
<div class="home-platforms-instance-playcount">
|
||||||
|
<h4>
|
||||||
|
<span id="most-concurrent-start">
|
||||||
|
<script>
|
||||||
|
$('#most-concurrent-start').text(moment(${top_stat['rows'][0]['started']},"X").format(date_format + ' ' + time_format));
|
||||||
|
</script>
|
||||||
|
</span>
|
||||||
|
</h4>
|
||||||
|
<h3>${top_stat['rows'][0]['count']}</h3>
|
||||||
|
<p> streams</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="home-platforms-instance-poster">
|
||||||
|
<div class="home-platforms-instance-box" style="background-image: url(interfaces/default/images/home-stat_most-concurrent.png);"></div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</div>
|
||||||
% endif
|
% endif
|
||||||
% endfor
|
% endfor
|
||||||
</ul>
|
</ul>
|
||||||
|
|
BIN
data/interfaces/default/images/home-stat_most-concurrent.png
Normal file
BIN
data/interfaces/default/images/home-stat_most-concurrent.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
|
@ -111,6 +111,7 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
|
||||||
<option id="card-popular_music" value="popular_music">Most Popular Music</option>
|
<option id="card-popular_music" value="popular_music">Most Popular Music</option>
|
||||||
<option id="card-top_users" value="top_users">Most Active User</option>
|
<option id="card-top_users" value="top_users">Most Active User</option>
|
||||||
<option id="card-top_platforms" value="top_platforms">Most Active Platform</option>
|
<option id="card-top_platforms" value="top_platforms">Most Active Platform</option>
|
||||||
|
<option id="card-most_concurrent" value="most_concurrent">Most Concurrent Streams</option>
|
||||||
<option id="card-last_watched" value="last_watched">Last Watched</option>
|
<option id="card-last_watched" value="last_watched">Last Watched</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -98,7 +98,8 @@ _CONFIG_DEFINITIONS = {
|
||||||
'HOME_STATS_LENGTH': (int, 'General', 30),
|
'HOME_STATS_LENGTH': (int, 'General', 30),
|
||||||
'HOME_STATS_TYPE': (int, 'General', 0),
|
'HOME_STATS_TYPE': (int, 'General', 0),
|
||||||
'HOME_STATS_COUNT': (int, 'General', 5),
|
'HOME_STATS_COUNT': (int, 'General', 5),
|
||||||
'HOME_STATS_CARDS': (str, 'General', 'watch_statistics, top_tv, popular_tv, top_movies, popular_movies, top_music, popular_music, top_users, top_platforms, last_watched'),
|
'HOME_STATS_CARDS': (str, 'General', 'watch_statistics, top_tv, popular_tv, top_movies, popular_movies, ' \
|
||||||
|
'top_music, popular_music, last_watched, top_users, top_platforms, most_concurrent'),
|
||||||
'HTTPS_CERT': (str, 'General', ''),
|
'HTTPS_CERT': (str, 'General', ''),
|
||||||
'HTTPS_KEY': (str, 'General', ''),
|
'HTTPS_KEY': (str, 'General', ''),
|
||||||
'HTTP_HOST': (str, 'General', '0.0.0.0'),
|
'HTTP_HOST': (str, 'General', '0.0.0.0'),
|
||||||
|
|
|
@ -589,6 +589,38 @@ class DataFactory(object):
|
||||||
home_stats.append({'stat_id': stat,
|
home_stats.append({'stat_id': stat,
|
||||||
'rows': last_watched})
|
'rows': last_watched})
|
||||||
|
|
||||||
|
elif stat == 'most_concurrent':
|
||||||
|
try:
|
||||||
|
query = 'SELECT started, stopped ' \
|
||||||
|
'FROM session_history '
|
||||||
|
result = monitor_db.select(query)
|
||||||
|
except:
|
||||||
|
logger.warn("Unable to execute database query for get_home_stats: most_concurrent.")
|
||||||
|
return None
|
||||||
|
|
||||||
|
times = {}
|
||||||
|
for item in result:
|
||||||
|
times.update({str(item['stopped']) + 'A': -1, str(item['started']) + 'B': 1})
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
last_start = 0
|
||||||
|
most_concurrent = {'count': count}
|
||||||
|
|
||||||
|
for key in sorted(times):
|
||||||
|
if times[key] == 1:
|
||||||
|
count += times[key]
|
||||||
|
if count >= most_concurrent['count']:
|
||||||
|
last_start = key
|
||||||
|
else:
|
||||||
|
if count >= most_concurrent['count']:
|
||||||
|
most_concurrent = {'count': count,
|
||||||
|
'started': last_start[:-1],
|
||||||
|
'stopped': key[:-1]}
|
||||||
|
count += times[key]
|
||||||
|
|
||||||
|
home_stats.append({'stat_id': stat,
|
||||||
|
'rows': [most_concurrent]})
|
||||||
|
|
||||||
return home_stats
|
return home_stats
|
||||||
|
|
||||||
def get_stream_details(self, row_id=None):
|
def get_stream_details(self, row_id=None):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue