mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-14 02:26:58 -07:00
Add recently watched to user screen
This commit is contained in:
parent
fe6d5f17f0
commit
ba18c5b96e
6 changed files with 112 additions and 3 deletions
|
@ -217,4 +217,20 @@ function isPrivateIP(ip_address) {
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function humanTime(seconds) {
|
||||
if (seconds >= 86400) {
|
||||
text = '<h1> / </h1><h3>' + Math.floor(moment.duration(seconds, 'seconds').asDays()) +
|
||||
'</h3><p> days </p><h3>' + Math.floor(moment.duration((seconds % 86400), 'seconds').asHours()) +
|
||||
'</h3><p> hrs</p><h3>' + Math.floor(moment.duration(((seconds % 86400) % 3600), 'seconds').asMinutes()) + '</h3><p> mins</p>';
|
||||
return text;
|
||||
} else if (seconds >= 3600) {
|
||||
text = '<h1> / </h1><h3>' + Math.floor(moment.duration((seconds % 86400), 'seconds').asHours()) +
|
||||
'</h3><p>hrs</p><h3>' + Math.floor(moment.duration(((seconds % 86400) % 3600), 'seconds').asMinutes()) + '</h3><p> mins</p>';
|
||||
return text;
|
||||
} else if (seconds >= 60) {
|
||||
text = '<h1> / </h1><h3>' + Math.floor(moment.duration(((seconds % 86400) % 3600), 'seconds').asMinutes()) + '</h3><p> mins</p>';
|
||||
return text;
|
||||
}
|
||||
}
|
|
@ -190,6 +190,15 @@
|
|||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
$.ajax({
|
||||
url: 'get_user_watch_time_stats',
|
||||
async: true,
|
||||
data: { user: '${user}' },
|
||||
complete: function(xhr, status) {
|
||||
$("#user-time-stats").html(xhr.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: 'get_user_recently_watched',
|
||||
async: true,
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
% if item['type'] == 'episode':
|
||||
<h3>Season ${item['parentIndex']}, Episode ${item['index']}</h3>
|
||||
% elif item['type'] == 'movie':
|
||||
<h3>${item['title']} (${item['title']})</h3>
|
||||
<h3>${item['title']} (${item['year']})</h3>
|
||||
% endif
|
||||
<div class="muted" id="time-${item['time']}">${item['time']}</div>
|
||||
</div>
|
||||
|
|
24
data/interfaces/default/user_watch_time_stats.html
Normal file
24
data/interfaces/default/user_watch_time_stats.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
% if watch_stats != None:
|
||||
<ul>
|
||||
% for a in watch_stats:
|
||||
<div class='user-overview-stats-instance'>
|
||||
<li>
|
||||
<div class='user-overview-stats-instance-text'>
|
||||
% if a['query_days'] == 0:
|
||||
<h4>All Time</h4>
|
||||
% elif a['query_days'] == 1:
|
||||
<h4>Last 24 hours</h4>
|
||||
% else:
|
||||
<h4>Last ${a['query_days']} day(s)</h4>
|
||||
% endif
|
||||
<h3>${a['total_plays']}</h3><p>plays</p>
|
||||
<span id="total-time-${a['query_days']}"></span>
|
||||
</div>
|
||||
</li>
|
||||
</div>
|
||||
<script>
|
||||
$('#total-time-${a['query_days']}').html(humanTime(${a['total_time']}));
|
||||
</script>
|
||||
% endfor
|
||||
</ul>
|
||||
% endif
|
Loading…
Add table
Add a link
Reference in a new issue