diff --git a/data/interfaces/default/js/tables/history_table.js b/data/interfaces/default/js/tables/history_table.js
index 053f994e..0f6e34cb 100644
--- a/data/interfaces/default/js/tables/history_table.js
+++ b/data/interfaces/default/js/tables/history_table.js
@@ -201,11 +201,11 @@ history_table_options = {
},
{
"targets": [10],
- "data":"percent_complete",
+ "data": "watched_status",
"render": function (data, type, full) {
- if (data > 80) {
+ if (data == 1) {
return ''
- } else if (data > 40) {
+ } else if (data == 0.5) {
return ''
} else {
return ''
diff --git a/plexpy/datafactory.py b/plexpy/datafactory.py
index 82cac9ae..c5dee357 100644
--- a/plexpy/datafactory.py
+++ b/plexpy/datafactory.py
@@ -26,7 +26,7 @@ class DataFactory(object):
def __init__(self):
pass
- def get_history(self, kwargs=None, custom_where=None, grouping=0):
+ def get_history(self, kwargs=None, custom_where=None, grouping=0, watched_percent=85):
data_tables = datatables.DataTables()
group_by = ['session_history.reference_id'] if grouping else ['session_history.id']
@@ -95,6 +95,13 @@ class DataFactory(object):
else:
thumb = item["thumb"]
+ if item['percent_complete'] >= watched_percent:
+ watched_status = 1
+ elif item['percent_complete'] >= watched_percent/2:
+ watched_status = 0.5
+ else:
+ watched_status = 0
+
row = {"reference_id": item["reference_id"],
"id": item["id"],
"date": item["date"],
@@ -118,7 +125,7 @@ class DataFactory(object):
"parent_media_index": item["parent_media_index"],
"thumb": thumb,
"video_decision": item["video_decision"],
- "percent_complete": item["percent_complete"],
+ "watched_status": watched_status,
"group_count": item["group_count"]
}
diff --git a/plexpy/webserve.py b/plexpy/webserve.py
index 3ed79246..1677374c 100644
--- a/plexpy/webserve.py
+++ b/plexpy/webserve.py
@@ -576,6 +576,8 @@ class WebInterface(object):
else:
grouping = plexpy.CONFIG.GROUP_HISTORY_TABLES
+ watched_percent = plexpy.CONFIG.NOTIFY_WATCHED_PERCENT
+
custom_where=[]
if user_id:
custom_where = [['user_id', user_id]]
@@ -598,7 +600,7 @@ class WebInterface(object):
custom_where = [['session_history.reference_id', reference_id]]
data_factory = datafactory.DataFactory()
- history = data_factory.get_history(kwargs=kwargs, custom_where=custom_where, grouping=grouping)
+ history = data_factory.get_history(kwargs=kwargs, custom_where=custom_where, grouping=grouping, watched_percent=watched_percent)
cherrypy.response.headers['Content-type'] = 'application/json'
return json.dumps(history)