Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
42ff4a2f62 | ||
![]() |
3fa5f80fc4 | ||
![]() |
9b5b7ef8db | ||
![]() |
560acf62fe | ||
![]() |
27d12922da | ||
![]() |
37b92f3d88 | ||
![]() |
79d5c0c92e | ||
![]() |
0bdaedd486 | ||
![]() |
018a201688 | ||
![]() |
a5bd7e6563 | ||
![]() |
a055feccd5 | ||
![]() |
ba68a9b52b | ||
![]() |
49669dc7e0 | ||
![]() |
5bdf79606e | ||
![]() |
ff3a9e47df | ||
![]() |
a18ba24f4a |
15
CHANGELOG.md
15
CHANGELOG.md
@@ -1,5 +1,20 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v1.2.12 (2015-12-06)
|
||||||
|
|
||||||
|
* Fix for "too many open files" error.
|
||||||
|
|
||||||
|
|
||||||
|
## v1.2.11 (2015-12-06)
|
||||||
|
|
||||||
|
* Fix more regressions (sorry).
|
||||||
|
|
||||||
|
|
||||||
|
## v1.2.10 (2015-12-06)
|
||||||
|
|
||||||
|
* Fix broken count graphs regression.
|
||||||
|
|
||||||
|
|
||||||
## v1.2.9 (2015-12-06)
|
## v1.2.9 (2015-12-06)
|
||||||
|
|
||||||
* Fix and improve text sanitization.
|
* Fix and improve text sanitization.
|
||||||
|
@@ -1130,7 +1130,7 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
|
|||||||
<h4 class="modal-title">Changelog</h4>
|
<h4 class="modal-title">Changelog</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
${versioncheck.read_changelog()}
|
${versioncheck.read_changelog() | n}
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
</div>
|
</div>
|
||||||
|
@@ -127,7 +127,8 @@ def check_active_sessions(ws_request=False):
|
|||||||
kwargs=dict(stream_data=stream, notify_action='buffer')).start()
|
kwargs=dict(stream_data=stream, notify_action='buffer')).start()
|
||||||
|
|
||||||
logger.debug(u"PlexPy Monitor :: Stream buffering. Count is now %s. Last triggered %s."
|
logger.debug(u"PlexPy Monitor :: Stream buffering. Count is now %s. Last triggered %s."
|
||||||
% (buffer_values[0][0], buffer_values[0][1]))
|
% (buffer_values[0]['buffer_count'],
|
||||||
|
buffer_values[0]['buffer_last_triggered']))
|
||||||
|
|
||||||
# Check if the user has reached the offset in the media we defined as the "watched" percent
|
# Check if the user has reached the offset in the media we defined as the "watched" percent
|
||||||
# Don't trigger if state is buffer as some clients push the progress to the end when
|
# Don't trigger if state is buffer as some clients push the progress to the end when
|
||||||
|
@@ -180,18 +180,18 @@ class ActivityProcessor(object):
|
|||||||
|
|
||||||
result = self.db.select(query=query, args=args)
|
result = self.db.select(query=query, args=args)
|
||||||
|
|
||||||
new_session = {'id': result[0][0],
|
new_session = {'id': result[0]['id'],
|
||||||
'rating_key': result[0][1],
|
'rating_key': result[0]['rating_key'],
|
||||||
'user_id': result[0][2],
|
'user_id': result[0]['user_id'],
|
||||||
'reference_id': result[0][3]}
|
'reference_id': result[0]['reference_id']}
|
||||||
|
|
||||||
if len(result) == 1:
|
if len(result) == 1:
|
||||||
prev_session = None
|
prev_session = None
|
||||||
else:
|
else:
|
||||||
prev_session = {'id': result[1][0],
|
prev_session = {'id': result[1]['id'],
|
||||||
'rating_key': result[1][1],
|
'rating_key': result[1]['rating_key'],
|
||||||
'user_id': result[1][2],
|
'user_id': result[1]['user_id'],
|
||||||
'reference_id': result[1][3]}
|
'reference_id': result[1]['reference_id']}
|
||||||
|
|
||||||
query = 'UPDATE session_history SET reference_id = ? WHERE id = ? '
|
query = 'UPDATE session_history SET reference_id = ? WHERE id = ? '
|
||||||
# If rating_key is the same in the previous session, then set the reference_id to the previous row, else set the reference_id to the new id
|
# If rating_key is the same in the previous session, then set the reference_id to the previous row, else set the reference_id to the new id
|
||||||
|
@@ -46,6 +46,13 @@ def get_cache_size():
|
|||||||
return 0
|
return 0
|
||||||
return int(plexpy.CONFIG.CACHE_SIZEMB)
|
return int(plexpy.CONFIG.CACHE_SIZEMB)
|
||||||
|
|
||||||
|
def dict_factory(cursor, row):
|
||||||
|
d = {}
|
||||||
|
for idx, col in enumerate(cursor.description):
|
||||||
|
d[col[0]] = row[idx]
|
||||||
|
|
||||||
|
return d
|
||||||
|
|
||||||
|
|
||||||
class MonitorDatabase(object):
|
class MonitorDatabase(object):
|
||||||
|
|
||||||
@@ -58,14 +65,7 @@ class MonitorDatabase(object):
|
|||||||
self.connection.execute("PRAGMA journal_mode = %s" % plexpy.CONFIG.JOURNAL_MODE)
|
self.connection.execute("PRAGMA journal_mode = %s" % plexpy.CONFIG.JOURNAL_MODE)
|
||||||
# 64mb of cache memory, probably need to make it user configurable
|
# 64mb of cache memory, probably need to make it user configurable
|
||||||
self.connection.execute("PRAGMA cache_size=-%s" % (get_cache_size() * 1024))
|
self.connection.execute("PRAGMA cache_size=-%s" % (get_cache_size() * 1024))
|
||||||
self.connection.row_factory = self.dict_factory
|
self.connection.row_factory = dict_factory
|
||||||
|
|
||||||
def dict_factory(self, cursor, row):
|
|
||||||
d = {}
|
|
||||||
for idx, col in enumerate(cursor.description):
|
|
||||||
d[col[0]] = row[idx]
|
|
||||||
|
|
||||||
return d
|
|
||||||
|
|
||||||
def action(self, query, args=None, return_last_id=False):
|
def action(self, query, args=None, return_last_id=False):
|
||||||
if query is None:
|
if query is None:
|
||||||
|
@@ -108,9 +108,6 @@ class DataFactory(object):
|
|||||||
# Rename Mystery platform names
|
# Rename Mystery platform names
|
||||||
platform = common.PLATFORM_NAME_OVERRIDES.get(item["platform"], item["platform"])
|
platform = common.PLATFORM_NAME_OVERRIDES.get(item["platform"], item["platform"])
|
||||||
|
|
||||||
# Sanitize player name
|
|
||||||
player = helpers.sanitize(item["player"])
|
|
||||||
|
|
||||||
row = {"reference_id": item["reference_id"],
|
row = {"reference_id": item["reference_id"],
|
||||||
"id": item["id"],
|
"id": item["id"],
|
||||||
"date": item["date"],
|
"date": item["date"],
|
||||||
@@ -122,7 +119,7 @@ class DataFactory(object):
|
|||||||
"user": item["user"],
|
"user": item["user"],
|
||||||
"friendly_name": item["friendly_name"],
|
"friendly_name": item["friendly_name"],
|
||||||
"platform": platform,
|
"platform": platform,
|
||||||
"player": player,
|
"player": item['player'],
|
||||||
"ip_address": item["ip_address"],
|
"ip_address": item["ip_address"],
|
||||||
"media_type": item["media_type"],
|
"media_type": item["media_type"],
|
||||||
"rating_key": item["rating_key"],
|
"rating_key": item["rating_key"],
|
||||||
@@ -575,9 +572,6 @@ class DataFactory(object):
|
|||||||
else:
|
else:
|
||||||
thumb = item['grandparent_thumb']
|
thumb = item['grandparent_thumb']
|
||||||
|
|
||||||
# Sanitize player name
|
|
||||||
player = helpers.sanitize(item["player"])
|
|
||||||
|
|
||||||
row = {'row_id': item['id'],
|
row = {'row_id': item['id'],
|
||||||
'user': item['user'],
|
'user': item['user'],
|
||||||
'friendly_name': item['friendly_name'],
|
'friendly_name': item['friendly_name'],
|
||||||
@@ -588,7 +582,7 @@ class DataFactory(object):
|
|||||||
'thumb': thumb,
|
'thumb': thumb,
|
||||||
'grandparent_thumb': item['grandparent_thumb'],
|
'grandparent_thumb': item['grandparent_thumb'],
|
||||||
'last_watch': item['last_watch'],
|
'last_watch': item['last_watch'],
|
||||||
'player': player,
|
'player': item['player']
|
||||||
}
|
}
|
||||||
last_watched.append(row)
|
last_watched.append(row)
|
||||||
|
|
||||||
|
132
plexpy/graphs.py
132
plexpy/graphs.py
@@ -44,11 +44,11 @@ class Graphs(object):
|
|||||||
else:
|
else:
|
||||||
query = 'SELECT date(started, "unixepoch", "localtime") as date_played, ' \
|
query = 'SELECT date(started, "unixepoch", "localtime") as date_played, ' \
|
||||||
'SUM(case when media_type = "episode" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "episode" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tv_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tv_count, ' \
|
||||||
'SUM(case when media_type = "movie" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "movie" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as movie_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as movie_count, ' \
|
||||||
'SUM(case when media_type = "track" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "track" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as music_duration ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as music_count ' \
|
||||||
'FROM session_history ' \
|
'FROM session_history ' \
|
||||||
'WHERE datetime(stopped, "unixepoch", "localtime") >= datetime("now", "-%s days", "localtime") ' \
|
'WHERE datetime(stopped, "unixepoch", "localtime") >= datetime("now", "-%s days", "localtime") ' \
|
||||||
'GROUP BY date_played ' \
|
'GROUP BY date_played ' \
|
||||||
@@ -77,9 +77,9 @@ class Graphs(object):
|
|||||||
series_3_value = 0
|
series_3_value = 0
|
||||||
for item in result:
|
for item in result:
|
||||||
if date_string == item['date_played']:
|
if date_string == item['date_played']:
|
||||||
series_1_value = item['tv_duration']
|
series_1_value = item['tv_count']
|
||||||
series_2_value = item['movie_duration']
|
series_2_value = item['movie_count']
|
||||||
series_3_value = item['music_duration']
|
series_3_value = item['music_count']
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
series_1_value = 0
|
series_1_value = 0
|
||||||
@@ -138,11 +138,11 @@ class Graphs(object):
|
|||||||
'when 5 then "Friday" ' \
|
'when 5 then "Friday" ' \
|
||||||
'else "Saturday" end as dayofweek, ' \
|
'else "Saturday" end as dayofweek, ' \
|
||||||
'SUM(case when media_type = "episode" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "episode" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tv_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tv_count, ' \
|
||||||
'SUM(case when media_type = "movie" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "movie" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as movie_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as movie_count, ' \
|
||||||
'SUM(case when media_type = "track" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "track" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as music_duration ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as music_count ' \
|
||||||
'FROM session_history ' \
|
'FROM session_history ' \
|
||||||
'WHERE datetime(stopped, "unixepoch", "localtime") >= ' \
|
'WHERE datetime(stopped, "unixepoch", "localtime") >= ' \
|
||||||
'datetime("now", "-' + time_range + ' days", "localtime") ' \
|
'datetime("now", "-' + time_range + ' days", "localtime") ' \
|
||||||
@@ -166,9 +166,9 @@ class Graphs(object):
|
|||||||
series_3_value = 0
|
series_3_value = 0
|
||||||
for item in result:
|
for item in result:
|
||||||
if day_item == item['dayofweek']:
|
if day_item == item['dayofweek']:
|
||||||
series_1_value = item['tv_duration']
|
series_1_value = item['tv_count']
|
||||||
series_2_value = item['movie_duration']
|
series_2_value = item['movie_count']
|
||||||
series_3_value = item['music_duration']
|
series_3_value = item['music_count']
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
series_1_value = 0
|
series_1_value = 0
|
||||||
@@ -211,11 +211,11 @@ class Graphs(object):
|
|||||||
else:
|
else:
|
||||||
query = 'select strftime("%H", datetime(started, "unixepoch", "localtime")) as hourofday, ' \
|
query = 'select strftime("%H", datetime(started, "unixepoch", "localtime")) as hourofday, ' \
|
||||||
'SUM(case when media_type = "episode" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "episode" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tv_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tv_count, ' \
|
||||||
'SUM(case when media_type = "movie" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "movie" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as movie_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as movie_count, ' \
|
||||||
'SUM(case when media_type = "track" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "track" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as music_duration ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as music_count ' \
|
||||||
'FROM session_history ' \
|
'FROM session_history ' \
|
||||||
'WHERE datetime(stopped, "unixepoch", "localtime") >= ' \
|
'WHERE datetime(stopped, "unixepoch", "localtime") >= ' \
|
||||||
'datetime("now", "-' + time_range + ' days", "localtime") ' \
|
'datetime("now", "-' + time_range + ' days", "localtime") ' \
|
||||||
@@ -241,9 +241,9 @@ class Graphs(object):
|
|||||||
series_3_value = 0
|
series_3_value = 0
|
||||||
for item in result:
|
for item in result:
|
||||||
if hour_item == item['hourofday']:
|
if hour_item == item['hourofday']:
|
||||||
series_1_value = item['tv_duration']
|
series_1_value = item['tv_count']
|
||||||
series_2_value = item['movie_duration']
|
series_2_value = item['movie_count']
|
||||||
series_3_value = item['music_duration']
|
series_3_value = item['music_count']
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
series_1_value = 0
|
series_1_value = 0
|
||||||
@@ -283,11 +283,11 @@ class Graphs(object):
|
|||||||
else:
|
else:
|
||||||
query = 'SELECT strftime("%Y-%m", datetime(started, "unixepoch", "localtime")) as datestring, ' \
|
query = 'SELECT strftime("%Y-%m", datetime(started, "unixepoch", "localtime")) as datestring, ' \
|
||||||
'SUM(case when media_type = "episode" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "episode" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tv_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tv_count, ' \
|
||||||
'SUM(case when media_type = "movie" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "movie" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as movie_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as movie_count, ' \
|
||||||
'SUM(case when media_type = "track" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "track" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as music_duration ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as music_count ' \
|
||||||
'FROM session_history ' \
|
'FROM session_history ' \
|
||||||
'WHERE datetime(started, "unixepoch", "localtime") >= datetime("now", "-12 months", "localtime") ' \
|
'WHERE datetime(started, "unixepoch", "localtime") >= datetime("now", "-12 months", "localtime") ' \
|
||||||
'GROUP BY strftime("%Y-%m", datetime(started, "unixepoch", "localtime")) ' \
|
'GROUP BY strftime("%Y-%m", datetime(started, "unixepoch", "localtime")) ' \
|
||||||
@@ -317,9 +317,9 @@ class Graphs(object):
|
|||||||
series_3_value = 0
|
series_3_value = 0
|
||||||
for item in result:
|
for item in result:
|
||||||
if date_string == item['datestring']:
|
if date_string == item['datestring']:
|
||||||
series_1_value = item['tv_duration']
|
series_1_value = item['tv_count']
|
||||||
series_2_value = item['movie_duration']
|
series_2_value = item['movie_count']
|
||||||
series_3_value = item['music_duration']
|
series_3_value = item['music_count']
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
series_1_value = 0
|
series_1_value = 0
|
||||||
@@ -364,11 +364,11 @@ class Graphs(object):
|
|||||||
else:
|
else:
|
||||||
query = 'SELECT platform, ' \
|
query = 'SELECT platform, ' \
|
||||||
'SUM(case when media_type = "episode" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "episode" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tv_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tv_count, ' \
|
||||||
'SUM(case when media_type = "movie" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "movie" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as movie_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as movie_count, ' \
|
||||||
'SUM(case when media_type = "track" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "track" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as music_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as music_count, ' \
|
||||||
'SUM(case when stopped > 0 then (stopped - started) ' \
|
'SUM(case when stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as total_duration ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as total_duration ' \
|
||||||
'FROM session_history ' \
|
'FROM session_history ' \
|
||||||
@@ -387,9 +387,9 @@ class Graphs(object):
|
|||||||
|
|
||||||
for item in result:
|
for item in result:
|
||||||
categories.append(common.PLATFORM_NAME_OVERRIDES.get(item['platform'], item['platform']))
|
categories.append(common.PLATFORM_NAME_OVERRIDES.get(item['platform'], item['platform']))
|
||||||
series_1.append(item['tv_duration'])
|
series_1.append(item['tv_count'])
|
||||||
series_2.append(item['movie_duration'])
|
series_2.append(item['movie_count'])
|
||||||
series_3.append(item['music_duration'])
|
series_3.append(item['music_count'])
|
||||||
|
|
||||||
series_1_output = {'name': 'TV',
|
series_1_output = {'name': 'TV',
|
||||||
'data': series_1}
|
'data': series_1}
|
||||||
@@ -430,11 +430,11 @@ class Graphs(object):
|
|||||||
'(case when users.friendly_name is null then users.username else ' \
|
'(case when users.friendly_name is null then users.username else ' \
|
||||||
'users.friendly_name end) as friendly_name,' \
|
'users.friendly_name end) as friendly_name,' \
|
||||||
'SUM(case when media_type = "episode" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "episode" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tv_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tv_count, ' \
|
||||||
'SUM(case when media_type = "movie" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "movie" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as movie_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as movie_count, ' \
|
||||||
'SUM(case when media_type = "track" and stopped > 0 then (stopped - started) ' \
|
'SUM(case when media_type = "track" and stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as music_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as music_count, ' \
|
||||||
'SUM(case when stopped > 0 then (stopped - started) ' \
|
'SUM(case when stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as total_duration ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as total_duration ' \
|
||||||
'FROM session_history ' \
|
'FROM session_history ' \
|
||||||
@@ -454,9 +454,9 @@ class Graphs(object):
|
|||||||
|
|
||||||
for item in result:
|
for item in result:
|
||||||
categories.append(item['friendly_name'])
|
categories.append(item['friendly_name'])
|
||||||
series_1.append(item['tv_duration'])
|
series_1.append(item['tv_count'])
|
||||||
series_2.append(item['movie_duration'])
|
series_2.append(item['movie_count'])
|
||||||
series_3.append(item['music_duration'])
|
series_3.append(item['music_count'])
|
||||||
|
|
||||||
series_1_output = {'name': 'TV',
|
series_1_output = {'name': 'TV',
|
||||||
'data': series_1}
|
'data': series_1}
|
||||||
@@ -501,15 +501,15 @@ class Graphs(object):
|
|||||||
'SUM(case when (session_history_media_info.video_decision = "direct play" ' \
|
'SUM(case when (session_history_media_info.video_decision = "direct play" ' \
|
||||||
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "direct play")) ' \
|
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "direct play")) ' \
|
||||||
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as dp_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as dp_count, ' \
|
||||||
'SUM(case when (session_history_media_info.video_decision = "copy" ' \
|
'SUM(case when (session_history_media_info.video_decision = "copy" ' \
|
||||||
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "copy")) ' \
|
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "copy")) ' \
|
||||||
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as ds_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as ds_count, ' \
|
||||||
'SUM(case when (session_history_media_info.video_decision = "transcode" ' \
|
'SUM(case when (session_history_media_info.video_decision = "transcode" ' \
|
||||||
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "transcode")) ' \
|
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "transcode")) ' \
|
||||||
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tc_duration ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tc_count ' \
|
||||||
'FROM session_history ' \
|
'FROM session_history ' \
|
||||||
'JOIN session_history_media_info ON session_history.id = session_history_media_info.id ' \
|
'JOIN session_history_media_info ON session_history.id = session_history_media_info.id ' \
|
||||||
'WHERE datetime(session_history.stopped, "unixepoch", "localtime") >= ' \
|
'WHERE datetime(session_history.stopped, "unixepoch", "localtime") >= ' \
|
||||||
@@ -541,9 +541,9 @@ class Graphs(object):
|
|||||||
series_3_value = 0
|
series_3_value = 0
|
||||||
for item in result:
|
for item in result:
|
||||||
if date_string == item['date_played']:
|
if date_string == item['date_played']:
|
||||||
series_1_value = item['dp_duration']
|
series_1_value = item['dp_count']
|
||||||
series_2_value = item['ds_duration']
|
series_2_value = item['ds_count']
|
||||||
series_3_value = item['tc_duration']
|
series_3_value = item['tc_count']
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
series_1_value = 0
|
series_1_value = 0
|
||||||
@@ -598,15 +598,15 @@ class Graphs(object):
|
|||||||
'SUM(case when (session_history_media_info.video_decision = "direct play" ' \
|
'SUM(case when (session_history_media_info.video_decision = "direct play" ' \
|
||||||
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "direct play")) ' \
|
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "direct play")) ' \
|
||||||
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as dp_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as dp_count, ' \
|
||||||
'SUM(case when (session_history_media_info.video_decision = "copy" ' \
|
'SUM(case when (session_history_media_info.video_decision = "copy" ' \
|
||||||
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "copy")) ' \
|
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "copy")) ' \
|
||||||
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as ds_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as ds_count, ' \
|
||||||
'SUM(case when (session_history_media_info.video_decision = "transcode" ' \
|
'SUM(case when (session_history_media_info.video_decision = "transcode" ' \
|
||||||
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "transcode")) ' \
|
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "transcode")) ' \
|
||||||
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tc_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tc_count, ' \
|
||||||
'SUM(case when stopped > 0 then (stopped - started) ' \
|
'SUM(case when stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as total_duration ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as total_duration ' \
|
||||||
'FROM session_history ' \
|
'FROM session_history ' \
|
||||||
@@ -627,9 +627,9 @@ class Graphs(object):
|
|||||||
|
|
||||||
for item in result:
|
for item in result:
|
||||||
categories.append(item['resolution'])
|
categories.append(item['resolution'])
|
||||||
series_1.append(item['dp_duration'])
|
series_1.append(item['dp_count'])
|
||||||
series_2.append(item['ds_duration'])
|
series_2.append(item['ds_count'])
|
||||||
series_3.append(item['tc_duration'])
|
series_3.append(item['tc_count'])
|
||||||
|
|
||||||
series_1_output = {'name': 'Direct Play',
|
series_1_output = {'name': 'Direct Play',
|
||||||
'data': series_1}
|
'data': series_1}
|
||||||
@@ -695,15 +695,15 @@ class Graphs(object):
|
|||||||
'SUM(case when (session_history_media_info.video_decision = "direct play" ' \
|
'SUM(case when (session_history_media_info.video_decision = "direct play" ' \
|
||||||
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "direct play")) ' \
|
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "direct play")) ' \
|
||||||
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as dp_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as dp_count, ' \
|
||||||
'SUM(case when (session_history_media_info.video_decision = "copy" ' \
|
'SUM(case when (session_history_media_info.video_decision = "copy" ' \
|
||||||
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "copy")) ' \
|
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "copy")) ' \
|
||||||
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as ds_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as ds_count, ' \
|
||||||
'SUM(case when (session_history_media_info.video_decision = "transcode" ' \
|
'SUM(case when (session_history_media_info.video_decision = "transcode" ' \
|
||||||
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "transcode")) ' \
|
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "transcode")) ' \
|
||||||
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tc_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tc_count, ' \
|
||||||
'SUM(case when stopped > 0 then (stopped - started) ' \
|
'SUM(case when stopped > 0 then (stopped - started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as total_duration ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as total_duration ' \
|
||||||
'FROM session_history ' \
|
'FROM session_history ' \
|
||||||
@@ -724,9 +724,9 @@ class Graphs(object):
|
|||||||
|
|
||||||
for item in result:
|
for item in result:
|
||||||
categories.append(item['resolution'])
|
categories.append(item['resolution'])
|
||||||
series_1.append(item['dp_duration'])
|
series_1.append(item['dp_count'])
|
||||||
series_2.append(item['ds_duration'])
|
series_2.append(item['ds_count'])
|
||||||
series_3.append(item['tc_duration'])
|
series_3.append(item['tc_count'])
|
||||||
|
|
||||||
series_1_output = {'name': 'Direct Play',
|
series_1_output = {'name': 'Direct Play',
|
||||||
'data': series_1}
|
'data': series_1}
|
||||||
@@ -773,15 +773,15 @@ class Graphs(object):
|
|||||||
'SUM(case when (session_history_media_info.video_decision = "direct play" ' \
|
'SUM(case when (session_history_media_info.video_decision = "direct play" ' \
|
||||||
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "direct play")) ' \
|
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "direct play")) ' \
|
||||||
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as dp_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as dp_count, ' \
|
||||||
'SUM(case when (session_history_media_info.video_decision = "copy" ' \
|
'SUM(case when (session_history_media_info.video_decision = "copy" ' \
|
||||||
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "copy")) ' \
|
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "copy")) ' \
|
||||||
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as ds_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as ds_count, ' \
|
||||||
'SUM(case when (session_history_media_info.video_decision = "transcode" ' \
|
'SUM(case when (session_history_media_info.video_decision = "transcode" ' \
|
||||||
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "transcode")) ' \
|
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "transcode")) ' \
|
||||||
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tc_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tc_count, ' \
|
||||||
'SUM(case when session_history.stopped > 0 ' \
|
'SUM(case when session_history.stopped > 0 ' \
|
||||||
'then (session_history.stopped - session_history.started) ' \
|
'then (session_history.stopped - session_history.started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as total_duration ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as total_duration ' \
|
||||||
@@ -802,9 +802,9 @@ class Graphs(object):
|
|||||||
|
|
||||||
for item in result:
|
for item in result:
|
||||||
categories.append(common.PLATFORM_NAME_OVERRIDES.get(item['platform'], item['platform']))
|
categories.append(common.PLATFORM_NAME_OVERRIDES.get(item['platform'], item['platform']))
|
||||||
series_1.append(item['dp_duration'])
|
series_1.append(item['dp_count'])
|
||||||
series_2.append(item['ds_duration'])
|
series_2.append(item['ds_count'])
|
||||||
series_3.append(item['tc_duration'])
|
series_3.append(item['tc_count'])
|
||||||
|
|
||||||
series_1_output = {'name': 'Direct Play',
|
series_1_output = {'name': 'Direct Play',
|
||||||
'data': series_1}
|
'data': series_1}
|
||||||
@@ -853,15 +853,15 @@ class Graphs(object):
|
|||||||
'SUM(case when (session_history_media_info.video_decision = "direct play" ' \
|
'SUM(case when (session_history_media_info.video_decision = "direct play" ' \
|
||||||
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "direct play")) ' \
|
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "direct play")) ' \
|
||||||
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as dp_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as dp_count, ' \
|
||||||
'SUM(case when (session_history_media_info.video_decision = "copy" ' \
|
'SUM(case when (session_history_media_info.video_decision = "copy" ' \
|
||||||
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "copy")) ' \
|
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "copy")) ' \
|
||||||
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as ds_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as ds_count, ' \
|
||||||
'SUM(case when (session_history_media_info.video_decision = "transcode" ' \
|
'SUM(case when (session_history_media_info.video_decision = "transcode" ' \
|
||||||
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "transcode")) ' \
|
'or (session_history_media_info.video_decision = "" and session_history_media_info.audio_decision = "transcode")) ' \
|
||||||
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
'and session_history.stopped > 0 then (session_history.stopped - session_history.started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tc_duration, ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as tc_count, ' \
|
||||||
'SUM(case when session_history.stopped > 0 ' \
|
'SUM(case when session_history.stopped > 0 ' \
|
||||||
'then (session_history.stopped - session_history.started) ' \
|
'then (session_history.stopped - session_history.started) ' \
|
||||||
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as total_duration ' \
|
' - (case when paused_counter is NULL then 0 else paused_counter end) else 0 end) as total_duration ' \
|
||||||
@@ -883,9 +883,9 @@ class Graphs(object):
|
|||||||
|
|
||||||
for item in result:
|
for item in result:
|
||||||
categories.append(item['username'])
|
categories.append(item['username'])
|
||||||
series_1.append(item['dp_duration'])
|
series_1.append(item['dp_count'])
|
||||||
series_2.append(item['ds_duration'])
|
series_2.append(item['ds_count'])
|
||||||
series_3.append(item['tc_duration'])
|
series_3.append(item['tc_count'])
|
||||||
|
|
||||||
series_1_output = {'name': 'Direct Play',
|
series_1_output = {'name': 'Direct Play',
|
||||||
'data': series_1}
|
'data': series_1}
|
||||||
|
@@ -214,13 +214,13 @@ def get_notify_state(session):
|
|||||||
args=[session['session_key'], session['rating_key'], session['user']])
|
args=[session['session_key'], session['rating_key'], session['user']])
|
||||||
notify_states = []
|
notify_states = []
|
||||||
for item in result:
|
for item in result:
|
||||||
notify_state = {'on_play': item[0],
|
notify_state = {'on_play': item['on_play'],
|
||||||
'on_stop': item[1],
|
'on_stop': item['on_stop'],
|
||||||
'on_pause': item[2],
|
'on_pause': item['on_pause'],
|
||||||
'on_resume': item[3],
|
'on_resume': item['on_resume'],
|
||||||
'on_buffer': item[4],
|
'on_buffer': item['on_buffer'],
|
||||||
'on_watched': item[5],
|
'on_watched': item['on_watched'],
|
||||||
'agent_id': item[6]}
|
'agent_id': item['agent_id']}
|
||||||
notify_states.append(notify_state)
|
notify_states.append(notify_state)
|
||||||
|
|
||||||
return notify_states
|
return notify_states
|
||||||
@@ -234,8 +234,8 @@ def get_notify_state_timeline(timeline):
|
|||||||
args=[timeline['rating_key']])
|
args=[timeline['rating_key']])
|
||||||
notify_states = []
|
notify_states = []
|
||||||
for item in result:
|
for item in result:
|
||||||
notify_state = {'on_created': item[0],
|
notify_state = {'on_created': item['on_created'],
|
||||||
'agent_id': item[1]}
|
'agent_id': item['agent_id']}
|
||||||
notify_states.append(notify_state)
|
notify_states.append(notify_state)
|
||||||
|
|
||||||
return notify_states
|
return notify_states
|
||||||
|
@@ -89,16 +89,13 @@ class Users(object):
|
|||||||
# Rename Mystery platform names
|
# Rename Mystery platform names
|
||||||
platform = common.PLATFORM_NAME_OVERRIDES.get(item["platform"], item["platform"])
|
platform = common.PLATFORM_NAME_OVERRIDES.get(item["platform"], item["platform"])
|
||||||
|
|
||||||
# Sanitize player name
|
|
||||||
player = helpers.sanitize(item["player"])
|
|
||||||
|
|
||||||
row = {"id": item['id'],
|
row = {"id": item['id'],
|
||||||
"plays": item['plays'],
|
"plays": item['plays'],
|
||||||
"last_seen": item['last_seen'],
|
"last_seen": item['last_seen'],
|
||||||
"friendly_name": item['friendly_name'],
|
"friendly_name": item['friendly_name'],
|
||||||
"ip_address": item['ip_address'],
|
"ip_address": item['ip_address'],
|
||||||
"platform": platform,
|
"platform": platform,
|
||||||
"player": player,
|
"player": item["player"],
|
||||||
"last_watched": item['last_watched'],
|
"last_watched": item['last_watched'],
|
||||||
"thumb": thumb,
|
"thumb": thumb,
|
||||||
"media_type": item['media_type'],
|
"media_type": item['media_type'],
|
||||||
@@ -183,15 +180,12 @@ class Users(object):
|
|||||||
# Rename Mystery platform names
|
# Rename Mystery platform names
|
||||||
platform = common.PLATFORM_NAME_OVERRIDES.get(item["platform"], item["platform"])
|
platform = common.PLATFORM_NAME_OVERRIDES.get(item["platform"], item["platform"])
|
||||||
|
|
||||||
# Sanitize player name
|
|
||||||
player = helpers.sanitize(item["player"])
|
|
||||||
|
|
||||||
row = {"id": item['id'],
|
row = {"id": item['id'],
|
||||||
"last_seen": item['last_seen'],
|
"last_seen": item['last_seen'],
|
||||||
"ip_address": item['ip_address'],
|
"ip_address": item['ip_address'],
|
||||||
"play_count": item['play_count'],
|
"play_count": item['play_count'],
|
||||||
"platform": platform,
|
"platform": platform,
|
||||||
"player": player,
|
"player": item['player'],
|
||||||
"last_watched": item['last_watched'],
|
"last_watched": item['last_watched'],
|
||||||
"thumb": thumb,
|
"thumb": thumb,
|
||||||
"media_type": item['media_type'],
|
"media_type": item['media_type'],
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
PLEXPY_VERSION = "master"
|
PLEXPY_VERSION = "master"
|
||||||
PLEXPY_RELEASE_VERSION = "1.2.9"
|
PLEXPY_RELEASE_VERSION = "1.2.12"
|
||||||
|
@@ -735,8 +735,6 @@ class WebInterface(object):
|
|||||||
if not session['ip_address']:
|
if not session['ip_address']:
|
||||||
ip_address = data_factory.get_session_ip(session['session_key'])
|
ip_address = data_factory.get_session_ip(session['session_key'])
|
||||||
session['ip_address'] = ip_address
|
session['ip_address'] = ip_address
|
||||||
# Sanitize player name
|
|
||||||
session['player'] = helpers.sanitize(session['player'])
|
|
||||||
|
|
||||||
except:
|
except:
|
||||||
return serve_template(templatename="current_activity.html", data=None)
|
return serve_template(templatename="current_activity.html", data=None)
|
||||||
|
Reference in New Issue
Block a user