diff --git a/data/interfaces/default/current_activity.html b/data/interfaces/default/current_activity.html
index 04632966..00a96048 100644
--- a/data/interfaces/default/current_activity.html
+++ b/data/interfaces/default/current_activity.html
@@ -119,6 +119,8 @@ DOCUMENTATION :: END
% if a['type'] == 'track':
% if a['audio_decision'] == 'direct play':
Stream Direct Play
+ % elif a['audio_decision'] == 'copy':
+ Stream Direct Stream
% else:
Stream Transcoding
(Speed: ${a['transcode_speed']})
@@ -136,8 +138,10 @@ DOCUMENTATION :: END
Audio Transcode (${a['transcode_audio_codec']}) (${a['transcode_audio_channels']}ch)
% endif
% elif a['type'] == 'episode' or a['type'] == 'movie' or a['type'] == 'clip':
- % if a['video_decision'] == 'direct play':
+ % if a['video_decision'] == 'direct play' and a['audio_decision'] == 'direct play':
Stream Direct Play
+ % elif a['video_decision'] == 'copy' and a['audio_decision'] == 'copy':
+ Stream Direct Stream
% else:
Stream Transcoding
(Speed: ${a['transcode_speed']})
@@ -165,6 +169,8 @@ DOCUMENTATION :: END
% elif a['type'] == 'photo':
% if a['video_decision'] == 'direct play':
Stream Direct Play
+ % elif a['video_decision'] == 'copy':
+ Stream Direct Stream
% else:
Stream
Transcoding
diff --git a/data/interfaces/default/graphs.html b/data/interfaces/default/graphs.html
index af6ed442..8f114b67 100644
--- a/data/interfaces/default/graphs.html
+++ b/data/interfaces/default/graphs.html
@@ -294,6 +294,8 @@
$('a[data-toggle=tab][href=' + current_tab + ']').trigger('click');
}
+ var music_visible = (${config['music_logging_enable']} == 1 ? true : false);
+
function loadGraphsTab1(time_range, yaxis) {
setGraphFormat(yaxis);
@@ -319,6 +321,7 @@
hc_plays_by_day_options.yAxis.min = 0;
hc_plays_by_day_options.xAxis.categories = dateArray;
hc_plays_by_day_options.series = data.series;
+ hc_plays_by_day_options.series[2].visible = music_visible;
var hc_plays_by_day = new Highcharts.Chart(hc_plays_by_day_options);
}
});
@@ -331,6 +334,7 @@
success: function(data) {
hc_plays_by_dayofweek_options.xAxis.categories = data.categories;
hc_plays_by_dayofweek_options.series = data.series;
+ hc_plays_by_dayofweek_options.series[2].visible = music_visible;
var hc_plays_by_dayofweek = new Highcharts.Chart(hc_plays_by_dayofweek_options);
}
});
@@ -343,6 +347,7 @@
success: function(data) {
hc_plays_by_hourofday_options.xAxis.categories = data.categories;
hc_plays_by_hourofday_options.series = data.series;
+ hc_plays_by_hourofday_options.series[2].visible = music_visible;
var hc_plays_by_hourofday = new Highcharts.Chart(hc_plays_by_hourofday_options);
}
});
@@ -355,6 +360,7 @@
success: function(data) {
hc_plays_by_platform_options.xAxis.categories = data.categories;
hc_plays_by_platform_options.series = data.series;
+ hc_plays_by_platform_options.series[2].visible = music_visible;
var hc_plays_by_platform = new Highcharts.Chart(hc_plays_by_platform_options);
}
});
@@ -367,6 +373,7 @@
success: function(data) {
hc_plays_by_user_options.xAxis.categories = data.categories;
hc_plays_by_user_options.series = data.series;
+ hc_plays_by_user_options.series[2].visible = music_visible;
var hc_plays_by_user = new Highcharts.Chart(hc_plays_by_user_options);
}
});
@@ -462,6 +469,7 @@
hc_plays_by_month_options.yAxis.min = 0;
hc_plays_by_month_options.xAxis.categories = data.categories;
hc_plays_by_month_options.series = data.series;
+ hc_plays_by_month_options.series[2].visible = music_visible;
var hc_plays_by_month = new Highcharts.Chart(hc_plays_by_month_options);
}
});
diff --git a/data/interfaces/default/index.html b/data/interfaces/default/index.html
index b73bdbe0..ed983ca6 100644
--- a/data/interfaces/default/index.html
+++ b/data/interfaces/default/index.html
@@ -82,12 +82,15 @@
currentActivity();
setInterval(currentActivity, 15000);
- function getHomeStats(days, stat_type, stat_count) {
+ function getHomeStats(days, stat_type, stat_count, notify_watched_percent) {
$.ajax({
url: 'home_stats',
cache: false,
async: true,
- data: {time_range: days, stat_type: stat_type, stat_count: stat_count},
+ data: {time_range: days,
+ stat_type: stat_type,
+ stat_count: stat_count,
+ notify_watched_percent: notify_watched_percent},
complete: function(xhr, status) {
$("#home-stats").html(xhr.responseText);
}
@@ -165,7 +168,10 @@
}
});
- getHomeStats(${config['home_stats_length']}, ${config['home_stats_type']}, ${config['home_stats_count']});
+ getHomeStats(${config['home_stats_length']},
+ ${config['home_stats_type']},
+ ${config['home_stats_count']},
+ ${config['notify_watched_percent']});
getLibraryStatsHeader();
getLibraryStats();
diff --git a/plexpy/datafactory.py b/plexpy/datafactory.py
index 4a988480..5412922d 100644
--- a/plexpy/datafactory.py
+++ b/plexpy/datafactory.py
@@ -131,7 +131,7 @@ class DataFactory(object):
return dict
- def get_home_stats(self, time_range='30', stat_type='0', stat_count='5'):
+ def get_home_stats(self, time_range='30', stat_type='0', stat_count='5', notify_watched_percent='85'):
monitor_db = database.MonitorDatabase()
if not time_range.isdigit():
@@ -432,7 +432,11 @@ class DataFactory(object):
'session_history_metadata.thumb, ' \
'session_history_metadata.grandparent_thumb, ' \
'MAX(session_history.started) as last_watch, ' \
- 'session_history.player as platform ' \
+ 'session_history.player as platform, ' \
+ '((CASE WHEN session_history.view_offset IS NULL THEN 0.1 ELSE \
+ session_history.view_offset * 1.0 END) / \
+ (CASE WHEN session_history_metadata.duration IS NULL THEN 1.0 ELSE \
+ session_history_metadata.duration * 1.0 END) * 100) as percent_complete ' \
'FROM session_history_metadata ' \
'JOIN session_history ON session_history_metadata.id = session_history.id ' \
'LEFT OUTER JOIN users ON session_history.user_id = users.user_id ' \
@@ -440,9 +444,10 @@ class DataFactory(object):
'>= datetime("now", "-%s days", "localtime") ' \
'AND (session_history_metadata.media_type = "movie" ' \
'OR session_history_metadata.media_type = "episode") ' \
+ 'AND percent_complete >= %s ' \
'GROUP BY session_history_metadata.full_title ' \
'ORDER BY last_watch DESC ' \
- 'LIMIT %s' % (time_range, stat_count)
+ 'LIMIT %s' % (time_range, notify_watched_percent, stat_count)
result = monitor_db.select(query)
except:
logger.warn("Unable to execute database query.")
diff --git a/plexpy/webserve.py b/plexpy/webserve.py
index 6bb6f9ac..de5af414 100644
--- a/plexpy/webserve.py
+++ b/plexpy/webserve.py
@@ -69,6 +69,7 @@ class WebInterface(object):
"home_stats_type": plexpy.CONFIG.HOME_STATS_TYPE,
"home_stats_count": plexpy.CONFIG.HOME_STATS_COUNT,
"pms_identifier": plexpy.CONFIG.PMS_IDENTIFIER,
+ "notify_watched_percent": plexpy.CONFIG.NOTIFY_WATCHED_PERCENT
}
return serve_template(templatename="index.html", title="Home", config=config)
@@ -121,9 +122,12 @@ class WebInterface(object):
return json.dumps(formats)
@cherrypy.expose
- def home_stats(self, time_range='30', stat_type='0', stat_count='5', **kwargs):
+ def home_stats(self, time_range='30', stat_type='0', stat_count='5', notify_watched_percent='85', **kwargs):
data_factory = datafactory.DataFactory()
- stats_data = data_factory.get_home_stats(time_range=time_range, stat_type=stat_type, stat_count=stat_count)
+ stats_data = data_factory.get_home_stats(time_range=time_range,
+ stat_type=stat_type,
+ stat_count=stat_count,
+ notify_watched_percent=notify_watched_percent)
return serve_template(templatename="home_stats.html", title="Stats", data=stats_data)
@@ -144,7 +148,12 @@ class WebInterface(object):
@cherrypy.expose
def graphs(self):
- return serve_template(templatename="graphs.html", title="Graphs")
+
+ config = {
+ "music_logging_enable": plexpy.CONFIG.MUSIC_LOGGING_ENABLE
+ }
+
+ return serve_template(templatename="graphs.html", title="Graphs", config=config)
@cherrypy.expose
def sync(self):