Add background to statistic cards

This commit is contained in:
JonnyWong16 2017-10-30 23:47:24 -07:00
parent 7714ecc7dd
commit 43f285951d
5 changed files with 103 additions and 23 deletions

View file

@ -1867,20 +1867,52 @@ a .library-user-instance-box:hover {
margin: 0;
}
.home-platforms-instance {
background-color: #282828;
position: relative;
float: left;
width: 330px;
padding: 10px;
width: 340px;
padding: 5px;
margin-right: 20px;
margin-bottom: 20px;
-webkit-box-sizing: content-box;
box-sizing: content-box;
-webkit-box-shadow: 0 0 4px rgba(0,0,0,.3),inset 0 0 0 1px rgba(255,255,255,.1);
-moz-box-shadow: 0 0 4px rgba(0,0,0,.3),inset 0 0 0 1px rgba(255,255,255,.1);
box-shadow: 0 0 4px rgba(0,0,0,.3),inset 0 0 0 1px rgba(255,255,255,.1);
white-space: nowrap;
}
.home-platforms-instance-overlay {
height: 130px;
width: 100%;
padding: 5px;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
-webkit-box-shadow: 0 0 4px rgba(0,0,0,.3), inset 0 0 0 1px rgba(255,255,255,.1);
-moz-box-shadow: 0 0 4px rgba(0,0,0,.3),inset 0 0 0 1px rgba(255,255,255,.1);
box-shadow: 0 0 4px rgba(0,0,0,.3), inset 0 0 0 1px rgba(255,255,255,.1);
z-index: 0;
}
.home-platforms-instance-background {
background-color: #282828;
background-position: center;
background-size: cover;
height: 130px;
width: 100%;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
opacity: 0.15;
-webkit-filter: blur(3px);
-moz-filter: blur(3px);
filter: blur(3px);
-webkit-transition: background 1s linear;
transition: background 1s linear;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
z-index: -1;
}
.home-platforms-instance li {
position: relative;
}
@ -2204,8 +2236,8 @@ a .library-user-instance-box:hover {
}
.home-platforms-instance-list-chevron {
position: absolute;
top: 105px;
right: 0;
top: 100px;
right: 5px;
cursor: pointer;
}
.home-platforms-instance-list-chevron i {
@ -2243,13 +2275,13 @@ a .home-platforms-list-cover-face:hover
width: calc(100% + 20px);
display: none;
position: absolute;
top: 128px;
left: -10px;
-webkit-box-shadow: 0 0 4px rgba(0,0,0,.3),inset 0 0 0 1px rgba(255,255,255,.1);
top: 124px;
left: -5px;
-webkit-box-shadow: 0 0 4px rgba(0,0,0,.3), inset 0 0 0 1px rgba(255,255,255,.1);
-moz-box-shadow: 0 0 4px rgba(0,0,0,.3),inset 0 0 0 1px rgba(255,255,255,.1);
box-shadow: 0 0 4px rgba(0,0,0,.3),inset 0 0 0 1px rgba(255,255,255,.1);
box-shadow: 0 0 4px rgba(0,0,0,.3), inset 0 0 0 1px rgba(255,255,255,.1);
z-index: 1;
clip: rect(1px, 354px, 1000px, -2px);
clip: rect(1px, 350px, 1000px, -2px);
}
.history-table-title {
text-overflow: ellipsis;

View file

@ -75,6 +75,9 @@ DOCUMENTATION :: END
% for top_stat in data:
% if top_stat['stat_id'] == 'top_tv' and top_stat['rows']:
<div class="home-platforms-instance">
<div class="home-platforms-instance-overlay">
<div class="home-platforms-instance-background" style="background-image: url(pms_image_proxy?img=${top_stat['rows'][0]['art']}&width=500&height=280&fallback=art);"></div>
</div>
<li>
<div class="home-platforms-instance-info">
<div class="home-platforms-instance-name">
@ -181,6 +184,9 @@ DOCUMENTATION :: END
</div>
% elif top_stat['stat_id'] == 'popular_tv' and top_stat['rows']:
<div class="home-platforms-instance">
<div class="home-platforms-instance-overlay">
<div class="home-platforms-instance-background" style="background-image: url(pms_image_proxy?img=${top_stat['rows'][0]['art']}&width=500&height=280&fallback=art);"></div>
</div>
<li>
<div class="home-platforms-instance-info">
<div class="home-platforms-instance-name">
@ -279,6 +285,9 @@ DOCUMENTATION :: END
</div>
% elif top_stat['stat_id'] == 'top_movies' and top_stat['rows']:
<div class="home-platforms-instance">
<div class="home-platforms-instance-overlay">
<div class="home-platforms-instance-background" style="background-image: url(pms_image_proxy?img=${top_stat['rows'][0]['art']}&width=500&height=280&fallback=art);"></div>
</div>
<li>
<div class="home-platforms-instance-info">
<div class="home-platforms-instance-name">
@ -385,6 +394,9 @@ DOCUMENTATION :: END
</div>
% elif top_stat['stat_id'] == 'popular_movies' and top_stat['rows']:
<div class="home-platforms-instance">
<div class="home-platforms-instance-overlay">
<div class="home-platforms-instance-background" style="background-image: url(pms_image_proxy?img=${top_stat['rows'][0]['art']}&width=500&height=280&fallback=art);"></div>
</div>
<li>
<div class="home-platforms-instance-info">
<div class="home-platforms-instance-name">
@ -483,6 +495,9 @@ DOCUMENTATION :: END
</div>
% elif top_stat['stat_id'] == 'top_music' and top_stat['rows']:
<div class="home-platforms-instance">
<div class="home-platforms-instance-overlay">
<div class="home-platforms-instance-background" style="background-image: url(pms_image_proxy?img=${top_stat['rows'][0]['art']}&width=500&height=280&fallback=art);"></div>
</div>
<li>
<div class="home-platforms-instance-info">
<div class="home-platforms-instance-name">
@ -589,6 +604,9 @@ DOCUMENTATION :: END
</div>
% elif top_stat['stat_id'] == 'popular_music' and top_stat['rows']:
<div class="home-platforms-instance">
<div class="home-platforms-instance-overlay">
<div class="home-platforms-instance-background" style="background-image: url(pms_image_proxy?img=${top_stat['rows'][0]['art']}&width=500&height=280&fallback=art);"></div>
</div>
<li>
<div class="home-platforms-instance-info">
<div class="home-platforms-instance-name">
@ -687,6 +705,13 @@ DOCUMENTATION :: END
</div>
% elif top_stat['stat_id'] == 'top_users' and top_stat['rows']:
<div class="home-platforms-instance">
<div class="home-platforms-instance-overlay">
% if top_stat['rows'][0]['user_thumb'] != '':
<div class="home-platforms-instance-background" style="background-image: url(${top_stat['rows'][0]['user_thumb']}"></div>
% else:
<div class="home-platforms-instance-background" style="background-image: url(${http_root}images/gravatar-default.png}"></div>
% endif
</div>
<li>
<div class="home-platforms-instance-info">
<div class="home-platforms-instance-name">
@ -783,6 +808,12 @@ DOCUMENTATION :: END
</div>
% elif top_stat['stat_id'] == 'top_platforms' and top_stat['rows']:
<div class="home-platforms-instance">
<div class="home-platforms-instance-overlay">
<div id="platform-stat-background" class="home-platforms-instance-background"></div>
<script>
$("#platform-stat-background").css("background-image", "url(" + getPlatformImagePath("${top_stat['rows'][0]['platform_type']}") + ")");
</script>
</div>
<li>
<div class="home-platforms-instance-info">
<div class="home-platforms-instance-name">
@ -845,6 +876,9 @@ DOCUMENTATION :: END
</div>
% elif top_stat['stat_id'] == 'last_watched' and top_stat['rows']:
<div class="home-platforms-instance">
<div class="home-platforms-instance-overlay">
<div class="home-platforms-instance-background" style="background-image: url(pms_image_proxy?img=${top_stat['rows'][0]['art']}&width=500&height=280&fallback=art);"></div>
</div>
<li>
<div class="home-platforms-instance-info">
<div class="home-platforms-instance-name">
@ -971,6 +1005,9 @@ DOCUMENTATION :: END
</div>
% elif top_stat['stat_id'] == 'most_concurrent' and top_stat['rows']:
<div class="home-platforms-instance">
<div class="home-platforms-instance-overlay">
<div class="home-platforms-instance-background" style="background-image: url(${http_root}images/home-stat_most-concurrent.png)"></div>
</div>
<li>
<div class="home-platforms-instance-info">
<div class="home-platforms-instance-name">

View file

@ -27,6 +27,9 @@ DOCUMENTATION :: END
<ul class="list-unstyled">
% for library in data:
<div class="home-platforms-instance">
<div class="home-platforms-instance-overlay">
<div class="home-platforms-instance-background" style="background-image: url(pms_image_proxy?img=${library['art']}&width=500&height=280&fallback=art);"></div>
</div>
<li>
<div class="home-platforms-instance-info">
<div class="home-platforms-instance-name">

View file

@ -285,7 +285,7 @@ class DataFactory(object):
top_tv = []
try:
query = 'SELECT t.id, t.grandparent_title, t.grandparent_rating_key, t.grandparent_thumb, t.section_id, ' \
't.media_type, t.content_rating, t.labels, t.started, ' \
't.art, t.media_type, t.content_rating, t.labels, t.started, ' \
'MAX(t.started) AS last_watch, COUNT(t.id) AS total_plays, SUM(t.d) AS total_duration ' \
'FROM (SELECT *, SUM(CASE WHEN stopped > 0 THEN (stopped - started) - ' \
' (CASE WHEN paused_counter IS NULL THEN 0 ELSE paused_counter END) ELSE 0 END) ' \
@ -313,6 +313,7 @@ class DataFactory(object):
'last_play': item['last_watch'],
'grandparent_thumb': item['grandparent_thumb'],
'thumb': '',
'art': item['art'],
'section_id': item['section_id'],
'media_type': item['media_type'],
'content_rating': item['content_rating'],
@ -333,7 +334,7 @@ class DataFactory(object):
popular_tv = []
try:
query = 'SELECT t.id, t.grandparent_title, t.grandparent_rating_key, t.grandparent_thumb, t.section_id, ' \
't.media_type, t.content_rating, t.labels, t.started, ' \
't.art, t.media_type, t.content_rating, t.labels, t.started, ' \
'COUNT(DISTINCT t.user_id) AS users_watched, ' \
'MAX(t.started) AS last_watch, COUNT(t.id) as total_plays, SUM(t.d) AS total_duration ' \
'FROM (SELECT *, SUM(CASE WHEN stopped > 0 THEN (stopped - started) - ' \
@ -361,6 +362,7 @@ class DataFactory(object):
'total_plays': item['total_plays'],
'grandparent_thumb': item['grandparent_thumb'],
'thumb': '',
'art': item['art'],
'section_id': item['section_id'],
'media_type': item['media_type'],
'content_rating': item['content_rating'],
@ -380,7 +382,7 @@ class DataFactory(object):
top_movies = []
try:
query = 'SELECT t.id, t.full_title, t.rating_key, t.thumb, t.section_id, ' \
't.media_type, t.content_rating, t.labels, t.started, ' \
't.art, t.media_type, t.content_rating, t.labels, t.started, ' \
'MAX(t.started) AS last_watch, COUNT(t.id) AS total_plays, SUM(t.d) AS total_duration ' \
'FROM (SELECT *, SUM(CASE WHEN stopped > 0 THEN (stopped - started) - ' \
' (CASE WHEN paused_counter IS NULL THEN 0 ELSE paused_counter END) ELSE 0 END) ' \
@ -408,6 +410,7 @@ class DataFactory(object):
'last_play': item['last_watch'],
'grandparent_thumb': '',
'thumb': item['thumb'],
'art': item['art'],
'section_id': item['section_id'],
'media_type': item['media_type'],
'content_rating': item['content_rating'],
@ -428,7 +431,7 @@ class DataFactory(object):
popular_movies = []
try:
query = 'SELECT t.id, t.full_title, t.rating_key, t.thumb, t.section_id, ' \
't.media_type, t.content_rating, t.labels, t.started, ' \
't.art, t.media_type, t.content_rating, t.labels, t.started, ' \
'COUNT(DISTINCT t.user_id) AS users_watched, ' \
'MAX(t.started) AS last_watch, COUNT(t.id) as total_plays, SUM(t.d) AS total_duration ' \
'FROM (SELECT *, SUM(CASE WHEN stopped > 0 THEN (stopped - started) - ' \
@ -456,6 +459,7 @@ class DataFactory(object):
'total_plays': item['total_plays'],
'grandparent_thumb': '',
'thumb': item['thumb'],
'art': item['art'],
'section_id': item['section_id'],
'media_type': item['media_type'],
'content_rating': item['content_rating'],
@ -475,7 +479,7 @@ class DataFactory(object):
top_music = []
try:
query = 'SELECT t.id, t.grandparent_title, t.grandparent_rating_key, t.grandparent_thumb, t.section_id, ' \
't.media_type, t.content_rating, t.labels, t.started, ' \
't.art, t.media_type, t.content_rating, t.labels, t.started, ' \
'MAX(t.started) AS last_watch, COUNT(t.id) AS total_plays, SUM(t.d) AS total_duration ' \
'FROM (SELECT *, SUM(CASE WHEN stopped > 0 THEN (stopped - started) - ' \
' (CASE WHEN paused_counter IS NULL THEN 0 ELSE paused_counter END) ELSE 0 END) ' \
@ -503,6 +507,7 @@ class DataFactory(object):
'last_play': item['last_watch'],
'grandparent_thumb': item['grandparent_thumb'],
'thumb': '',
'art': item['art'],
'section_id': item['section_id'],
'media_type': item['media_type'],
'content_rating': item['content_rating'],
@ -523,7 +528,7 @@ class DataFactory(object):
popular_music = []
try:
query = 'SELECT t.id, t.grandparent_title, t.grandparent_rating_key, t.grandparent_thumb, t.section_id, ' \
't.media_type, t.content_rating, t.labels, t.started, ' \
't.art, t.media_type, t.content_rating, t.labels, t.started, ' \
'COUNT(DISTINCT t.user_id) AS users_watched, ' \
'MAX(t.started) AS last_watch, COUNT(t.id) as total_plays, SUM(t.d) AS total_duration ' \
'FROM (SELECT *, SUM(CASE WHEN stopped > 0 THEN (stopped - started) - ' \
@ -551,6 +556,7 @@ class DataFactory(object):
'total_plays': item['total_plays'],
'grandparent_thumb': item['grandparent_thumb'],
'thumb': '',
'art': item['art'],
'section_id': item['section_id'],
'media_type': item['media_type'],
'content_rating': item['content_rating'],
@ -670,7 +676,7 @@ class DataFactory(object):
try:
query = 'SELECT t.id, t.full_title, t.rating_key, t.thumb, t.grandparent_thumb, ' \
't.user, t.user_id, t.custom_avatar_url as user_thumb, t.player, t.section_id, ' \
't.media_type, t.content_rating, t.labels, ' \
't.art, t.media_type, t.content_rating, t.labels, ' \
'(CASE WHEN t.friendly_name IS NULL THEN t.username ELSE t.friendly_name END) ' \
' AS friendly_name, ' \
'MAX(t.started) AS last_watch, ' \
@ -710,6 +716,7 @@ class DataFactory(object):
'rating_key': item['rating_key'],
'thumb': thumb,
'grandparent_thumb': item['grandparent_thumb'],
'art': item['art'],
'section_id': item['section_id'],
'media_type': item['media_type'],
'content_rating': item['content_rating'],
@ -816,7 +823,7 @@ class DataFactory(object):
if id.isdigit():
try:
query = 'SELECT section_id, section_name, section_type, thumb AS library_thumb, ' \
'custom_thumb_url AS custom_thumb, count, parent_count, child_count ' \
'custom_thumb_url AS custom_thumb, art, count, parent_count, child_count ' \
'FROM library_sections ' \
'WHERE section_id = %s ' % id
result = monitor_db.select(query)
@ -836,6 +843,7 @@ class DataFactory(object):
'section_name': item['section_name'],
'section_type': item['section_type'],
'thumb': library_thumb,
'art': item['art'],
'count': item['count'],
'parent_count': item['parent_count'],
'child_count': item['child_count']

View file

@ -36,7 +36,7 @@ try:
from Cryptodome.Protocol.KDF import PBKDF2
from Cryptodome.Cipher import AES
from Cryptodome.Random import get_random_bytes
from Cryptodome.Hash import HMAC, SHA1
from Cryptodome.Hash import HMAC, SHA256
CRYPTODOME = True
except ImportError:
try:
@ -785,7 +785,7 @@ class ANDROIDAPP(Notifier):
key_length = 32 # AES256
iterations = 1000
key = PBKDF2(passphrase, salt, dkLen=key_length, count=iterations,
prf=lambda p, s: HMAC.new(p, s, SHA1).digest())
prf=lambda p, s: HMAC.new(p, s, SHA256).digest())
#logger.debug("Encryption key (base64): {}".format(base64.b64encode(key)))