The combined total of tv, movies, and music by month.
@@ -323,10 +328,12 @@
// Initial values for graph from config
var yaxis = "${config['graph_type']}";
- var current_range = ${config['graph_days']};
+ var current_day_range = ${config['graph_days']};
+ var current_month_range = ${config['graph_months']};
var current_tab = "${'#' + config['graph_tab']}";
- $('.days').html(current_range);
+ $('.days').html(current_day_range);
+ $('.months').html(current_month_range);
// Load user ids and names (for the selector)
$.ajax({
@@ -358,6 +365,7 @@
function loadGraphsTab1(time_range, yaxis) {
$('#days-selection').show();
+ $('#months-selection').hide();
setGraphFormat(yaxis);
@@ -448,6 +456,7 @@
function loadGraphsTab2(time_range, yaxis) {
$('#days-selection').show();
+ $('#months-selection').hide();
setGraphFormat(yaxis);
@@ -531,15 +540,16 @@
});
}
- function loadGraphsTab3(yaxis) {
+ function loadGraphsTab3(time_range, yaxis) {
$('#days-selection').hide();
+ $('#months-selection').show();
setGraphFormat(yaxis);
$.ajax({
url: "get_plays_per_month",
type: 'get',
- data: { y_axis: yaxis, user_id: selected_user_id },
+ data: { time_range: time_range, y_axis: yaxis, user_id: selected_user_id },
dataType: "json",
success: function(data) {
if (yaxis === 'duration') { dataSecondsToHours(data); }
@@ -553,15 +563,15 @@
}
// Set initial state
- if (current_tab == '#tabs-1') { loadGraphsTab1(current_range, yaxis); }
- if (current_tab == '#tabs-2') { loadGraphsTab2(current_range, yaxis); }
- if (current_tab == '#tabs-3') { loadGraphsTab3(yaxis); }
+ if (current_tab == '#tabs-1') { loadGraphsTab1(current_day_range, yaxis); }
+ if (current_tab == '#tabs-2') { loadGraphsTab2(current_day_range, yaxis); }
+ if (current_tab == '#tabs-3') { loadGraphsTab3(current_month_range, yaxis); }
// Tab1 opened
$('#graph-tabs a[href="#tabs-1"]').on('shown.bs.tab', function (e) {
e.preventDefault();
current_tab = $(this).attr('href');
- loadGraphsTab1(current_range, yaxis);
+ loadGraphsTab1(current_day_range, yaxis);
$.ajax({
url: 'set_graph_config',
data: { graph_tab: current_tab.replace('#','') },
@@ -573,7 +583,7 @@
$('#graph-tabs a[href="#tabs-2"]').on('shown.bs.tab', function (e) {
e.preventDefault();
current_tab = $(this).attr('href');
- loadGraphsTab2(current_range, yaxis);
+ loadGraphsTab2(current_day_range, yaxis);
$.ajax({
url: 'set_graph_config',
data: { graph_tab: current_tab.replace('#','') },
@@ -585,7 +595,7 @@
$('#graph-tabs a[href="#tabs-3"]').on('shown.bs.tab', function (e) {
e.preventDefault();
current_tab = $(this).attr('href');
- loadGraphsTab3(yaxis);
+ loadGraphsTab3(current_month_range, yaxis);
$.ajax({
url: 'set_graph_config',
data: { graph_tab: current_tab.replace('#','') },
@@ -595,17 +605,35 @@
// Date range changed
$('#graph-days').on('change', function() {
- current_range = $(this).val();
- if (current_range < 1) {
+ current_day_range = Math.round($(this).val());
+ $(this).val(current_day_range);
+ if (current_day_range < 1) {
$(this).val(7);
- current_range = 7;
+ current_day_range = 7;
}
- if (current_tab == '#tabs-1') { loadGraphsTab1(current_range, yaxis); }
- if (current_tab == '#tabs-2') { loadGraphsTab2(current_range, yaxis); }
- $('.days').html(current_range);
+ if (current_tab == '#tabs-1') { loadGraphsTab1(current_day_range, yaxis); }
+ if (current_tab == '#tabs-2') { loadGraphsTab2(current_day_range, yaxis); }
+ $('.days').html(current_day_range);
$.ajax({
url: 'set_graph_config',
- data: { graph_days: current_range},
+ data: { graph_days: current_day_range},
+ async: true
+ });
+ });
+
+ // Month range changed
+ $('#graph-months').on('change', function() {
+ current_month_range = Math.round($(this).val());
+ $(this).val(current_month_range);
+ if (current_month_range < 1) {
+ $(this).val(12);
+ current_month_range = 12;
+ }
+ if (current_tab == '#tabs-3') { loadGraphsTab3(current_month_range, yaxis); }
+ $('.months').html(current_month_range);
+ $.ajax({
+ url: 'set_graph_config',
+ data: { graph_months: current_month_range},
async: true
});
});
@@ -613,17 +641,17 @@
// User changed
$('#graph-user').on('change', function() {
selected_user_id = $(this).val() || null;
- if (current_tab == '#tabs-1') { loadGraphsTab1(current_range, yaxis); }
- if (current_tab == '#tabs-2') { loadGraphsTab2(current_range, yaxis); }
- if (current_tab == '#tabs-3') { loadGraphsTab3(yaxis); }
+ if (current_tab == '#tabs-1') { loadGraphsTab1(current_day_range, yaxis); }
+ if (current_tab == '#tabs-2') { loadGraphsTab2(current_day_range, yaxis); }
+ if (current_tab == '#tabs-3') { loadGraphsTab3(current_month_range, yaxis); }
});
// Y-axis changed
$('#yaxis-selection').on('change', function() {
yaxis = $('input[name=yaxis-options]:checked', '#yaxis-selection').val();
- if (current_tab == '#tabs-1') { loadGraphsTab1(current_range, yaxis); }
- if (current_tab == '#tabs-2') { loadGraphsTab2(current_range, yaxis); }
- if (current_tab == '#tabs-3') { loadGraphsTab3(yaxis); }
+ if (current_tab == '#tabs-1') { loadGraphsTab1(current_day_range, yaxis); }
+ if (current_tab == '#tabs-2') { loadGraphsTab2(current_day_range, yaxis); }
+ if (current_tab == '#tabs-3') { loadGraphsTab3(current_month_range, yaxis); }
$.ajax({
url: 'set_graph_config',
data: { graph_type: yaxis},
diff --git a/data/interfaces/default/images/res/ios/Default-portrait@2x~iphone5.jpg b/data/interfaces/default/images/res/ios/Default-portrait@2x~iphone5.jpg
deleted file mode 100644
index e4fe6de2..00000000
Binary files a/data/interfaces/default/images/res/ios/Default-portrait@2x~iphone5.jpg and /dev/null differ
diff --git a/data/interfaces/default/info.html b/data/interfaces/default/info.html
index a9beb510..c2500ea1 100644
--- a/data/interfaces/default/info.html
+++ b/data/interfaces/default/info.html
@@ -116,9 +116,9 @@ DOCUMENTATION :: END
+
+
+ Week Starting on Monday
+
+
Change the "Play by day of week " graph to start on Monday. Default is start on Sunday.
+
Group Table and Watch Statistics History
diff --git a/init-scripts/init-alt.freebsd b/init-scripts/init-alt.freebsd
index a490eabb..eef5842d 100755
--- a/init-scripts/init-alt.freebsd
+++ b/init-scripts/init-alt.freebsd
@@ -1,7 +1,7 @@
#!/bin/sh
#
# PROVIDE: plexpy
-# REQUIRE: sabnzbd
+# REQUIRE: plexpy
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
@@ -10,7 +10,7 @@
# plexpy_enable (bool): Set to NO by default.
# Set it to YES to enable it.
# plexpy_user: The user account PlexPy daemon runs as what
-# you want it to be. It uses '_sabnzbd' user by
+# you want it to be. It uses 'plexpy' user by
# default. Do not sets it as empty or it will run
# as root.
# plexpy_dir: Directory where PlexPy lives.
@@ -28,7 +28,7 @@ rcvar=${name}_enable
load_rc_config ${name}
: ${plexpy_enable:="NO"}
-: ${plexpy_user:="_sabnzbd"}
+: ${plexpy_user:="plexpy"}
: ${plexpy_dir:="/usr/local/plexpy"}
: ${plexpy_chdir:="${plexpy_dir}"}
: ${plexpy_pid:="${plexpy_dir}/plexpy.pid"}
diff --git a/init-scripts/init.fedora.centos.systemd b/init-scripts/init.fedora.centos.systemd
deleted file mode 100755
index 5cb70ce8..00000000
--- a/init-scripts/init.fedora.centos.systemd
+++ /dev/null
@@ -1,66 +0,0 @@
-# PlexPy - Stats for Plex Media Server usage
-#
-# Service Unit file for systemd system manager
-#
-# INSTALLATION NOTES
-#
-# 1. Rename this file as you want, ensuring that it ends in .service
-# e.g. 'plexpy.service'
-#
-# 2. Adjust configuration settings as required. More details in the
-# "CONFIGURATION NOTES" section shown below.
-#
-# 3. Copy this file into your systemd service unit directory, which is
-# often '/lib/systemd/system'.
-#
-# 4. Create any files/directories that you specified back in step #2.
-# e.g. '/etc/plexpy/plexpy.ini'
-# '/home/sabnzbd/.plexpy'
-#
-# 5. Enable boot-time autostart with the following commands:
-# systemctl daemon-reload
-# systemctl enable plexpy.service
-#
-# 6. Start now with the following command:
-# systemctl start plexpy.service
-#
-# 7. If troubleshooting startup-errors, start by checking permissions
-# and ownership on the files/directories that you created in step #4.
-#
-#
-# CONFIGURATION NOTES
-#
-# - The example settings in this file assume that:
-# 1. You will run PlexPy as user/group: sabnzbd.sabnzbd
-# 2. You will either have PlexPy installed as a subdirectory
-# under '~sabnzbd', or that you will have a symlink under
-# '~/sabnzbd' pointing to your PlexPy install dir.
-# 3. Your PlexPy data directory and configuration file will be
-# in separate locations from your PlexPy install dir, to
-# simplify updates.
-#
-# - Option names (e.g. ExecStart=, Type=) appear to be case-sensitive)
-#
-# - Adjust ExecStart= to point to:
-# 1. Your PlexPy executable,
-# 2. Your config file (recommended is to put it somewhere in /etc)
-# 3. Your datadir (recommended is to NOT put it in your PlexPy exec dir)
-#
-# - Adjust User= and Group= to the user/group you want PlexPy to run as.
-#
-# - WantedBy= specifies which target (i.e. runlevel) to start PlexPy for.
-# multi-user.target equates to runlevel 3 (multi-user text mode)
-# graphical.target equates to runlevel 5 (multi-user X11 graphical mode)
-
-[Unit]
-Description=PlexPy - Stats for Plex Media Server usage
-
-[Service]
-ExecStart=/home/sabnzbd/plexpy/PlexPy.py --daemon --config /etc/plexpy/plexpy.ini --datadir /home/sabnzbd/.plexpy --nolaunch --quiet
-GuessMainPID=no
-Type=forking
-User=sabnzbd
-Group=sabnzbd
-
-[Install]
-WantedBy=multi-user.target
diff --git a/init-scripts/init.freebsd b/init-scripts/init.freebsd
index 69afbd08..b5e09301 100755
--- a/init-scripts/init.freebsd
+++ b/init-scripts/init.freebsd
@@ -1,7 +1,7 @@
#!/bin/sh
#
# PROVIDE: plexpy
-# REQUIRE: DAEMON sabnzbd
+# REQUIRE: DAEMON plexpy
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
@@ -10,7 +10,7 @@
# plexpy_enable (bool): Set to NO by default.
# Set it to YES to enable it.
# plexpy_user: The user account PlexPy daemon runs as what
-# you want it to be. It uses '_sabnzbd' user by
+# you want it to be. It uses 'plexpy' user by
# default. Do not sets it as empty or it will run
# as root.
# plexpy_dir: Directory where PlexPy lives.
@@ -29,7 +29,7 @@ rcvar=${name}_enable
load_rc_config ${name}
: ${plexpy_enable:="NO"}
-: ${plexpy_user:="_sabnzbd"}
+: ${plexpy_user:="plexpy"}
: ${plexpy_dir:="/usr/local/share/plexpy"}
: ${plexpy_chdir:="${plexpy_dir}"}
: ${plexpy_pid:="${plexpy_dir}/plexpy.pid"}
diff --git a/init-scripts/init.freenas b/init-scripts/init.freenas
index f708c85e..069bb577 100755
--- a/init-scripts/init.freenas
+++ b/init-scripts/init.freenas
@@ -1,7 +1,7 @@
#!/bin/sh
#
# PROVIDE: plexpy
-# REQUIRE: DAEMON sabnzbd
+# REQUIRE: DAEMON plexpy
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
@@ -10,7 +10,7 @@
# plexpy_enable (bool): Set to NO by default.
# Set it to YES to enable it.
# plexpy_user: The user account PlexPy daemon runs as what
-# you want it to be. It uses '_sabnzbd' user by
+# you want it to be. It uses 'plexpy' user by
# default. Do not sets it as empty or it will run
# as root.
# plexpy_dir: Directory where PlexPy lives.
@@ -29,7 +29,7 @@ rcvar=${name}_enable
load_rc_config ${name}
: ${plexpy_enable:="NO"}
-: ${plexpy_user:="_sabnzbd"}
+: ${plexpy_user:="plexpy"}
: ${plexpy_dir:="/usr/local/share/plexpy"}
: ${plexpy_chdir:="${plexpy_dir}"}
: ${plexpy_pid:="${plexpy_dir}/plexpy.pid"}
diff --git a/init-scripts/init.opensuse.systemd b/init-scripts/init.opensuse.systemd
deleted file mode 100644
index 7dbdfc3e..00000000
--- a/init-scripts/init.opensuse.systemd
+++ /dev/null
@@ -1,67 +0,0 @@
-# PlexPy - Stats for Plex Media Server usage
-#
-# Service Unit file for systemd system manager
-#
-# INSTALLATION NOTES
-#
-# 1. Rename this file as you want, ensuring that it ends in .service
-# e.g. 'plexpy.service'
-#
-# 2. Adjust configuration settings as required. More details in the
-# "CONFIGURATION NOTES" section shown below.
-#
-# 3. Copy this file into your systemd service unit directory, which is
-# often '/lib/systemd/system'.
-#
-# 4. Create any files/directories that you specified back in step #2.
-# e.g. '/opt/plexpy.ini'
-# '/opt/plexpy'
-#
-# 5. Enable boot-time autostart with the following commands:
-# systemctl daemon-reload
-# systemctl enable plexpy.service
-#
-# 6. Start now with the following command:
-# systemctl start plexpy.service
-#
-# 7. If troubleshooting startup-errors, start by checking permissions
-# and ownership on the files/directories that you created in step #4.
-#
-#
-# CONFIGURATION NOTES
-#
-# - The example settings in this file assume that:
-# 1. You will run PlexPy as user/group: plex.users
-# 2. You will either have PlexPy installed as a subdirectory
-# under '/opt', or that you will have a symlink under
-# '/opt' pointing to your PlexPy install dir.
-# 3. Your PlexPy data directory and configuration file can be
-# in separate locations from your PlexPy install dir, to
-# simplify updates. However, in the example below they are in the
-# PlexPy install dir.
-#
-# - Option names (e.g. ExecStart=, Type=) appear to be case-sensitive)
-#
-# - Adjust ExecStart= to point to:
-# 1. Your PlexPy executable,
-# 2. Your config file (recommended is to put it somewhere in /etc)
-# 3. Your datadir (recommended is to NOT put it in your PlexPy exec dir)
-#
-# - Adjust User= and Group= to the user/group you want PlexPy to run as.
-#
-# - WantedBy= specifies which target (i.e. runlevel) to start PlexPy for.
-# multi-user.target equates to runlevel 3 (multi-user text mode)
-# graphical.target equates to runlevel 5 (multi-user X11 graphical mode)
-
-[Unit]
-Description=PlexPy - Stats for Plex Media Server usage
-
-[Service]
-ExecStart=/opt/plexpy/PlexPy.py --daemon --config /opt/plexpy/config.ini --datadir /opt/plexpy --nolaunch --quiet
-GuessMainPID=no
-Type=forking
-User=plex
-Group=users
-
-[Install]
-WantedBy=multi-user.target
\ No newline at end of file
diff --git a/init-scripts/init.solaris11 b/init-scripts/init.solaris11
index 8e50267d..bc6a9f99 100755
--- a/init-scripts/init.solaris11
+++ b/init-scripts/init.solaris11
@@ -19,7 +19,7 @@
-
+
diff --git a/init-scripts/init.ubuntu.systemd b/init-scripts/init.systemd
similarity index 61%
rename from init-scripts/init.ubuntu.systemd
rename to init-scripts/init.systemd
index fd4d54bc..ae74eee6 100644
--- a/init-scripts/init.ubuntu.systemd
+++ b/init-scripts/init.systemd
@@ -13,32 +13,20 @@
# 3. Copy this file into your systemd service unit directory, which is
# often '/lib/systemd/system'.
#
-# 4. Create any files/directories that you specified back in step #2.
-# e.g. '/etc/plexpy/plexpy.ini'
-# '/home/sabnzbd/.plexpy'
-#
-# 5. Enable boot-time autostart with the following commands:
+# 4. Enable boot-time autostart with the following commands:
# systemctl daemon-reload
# systemctl enable plexpy.service
#
-# 6. Start now with the following command:
+# 5. Start now with the following command:
# systemctl start plexpy.service
#
-# 7. If troubleshooting startup-errors, start by checking permissions
-# and ownership on the files/directories that you created in step #4.
-#
-#
# CONFIGURATION NOTES
#
-# - The example settings in this file assume that:
-# 1. You will run PlexPy as user/group: sabnzbd.sabnzbd
-# 2. You will either have PlexPy installed as a subdirectory
-# under '~sabnzbd', or that you will have a symlink under
-# '~/sabnzbd' pointing to your PlexPy install dir.
-# 3. Your PlexPy data directory and configuration file will be
-# in separate locations from your PlexPy install dir, to
-# simplify updates.
-#
+# - The example settings in this file assume that you will run PlexPy as user: plexpy
+# - To create this user and give it ownership of the plexpy directory:
+# sudo adduser --system --no-create-home plexpy
+# sudo chown plexpy:nogroup -R /opt/plexpy
+#
# - Option names (e.g. ExecStart=, Type=) appear to be case-sensitive)
#
# - Adjust ExecStart= to point to:
@@ -63,4 +51,4 @@ User=plexpy
Group=nogroup
[Install]
-WantedBy=multi-user.target
\ No newline at end of file
+WantedBy=multi-user.target
diff --git a/plexpy/config.py b/plexpy/config.py
index e1879d2d..ffe1e19e 100644
--- a/plexpy/config.py
+++ b/plexpy/config.py
@@ -175,6 +175,7 @@ _CONFIG_DEFINITIONS = {
'GIT_USER': (str, 'General', 'JonnyWong16'),
'GRAPH_TYPE': (str, 'General', 'plays'),
'GRAPH_DAYS': (int, 'General', 30),
+ 'GRAPH_MONTHS': (int, 'General', 12),
'GRAPH_TAB': (str, 'General', 'tabs-1'),
'GROUP_HISTORY_TABLES': (int, 'General', 0),
'GROWL_ENABLED': (int, 'Growl', 0),
@@ -578,6 +579,7 @@ _CONFIG_DEFINITIONS = {
'VIDEO_LOGGING_ENABLE': (int, 'Monitoring', 1),
'WEBSOCKET_CONNECTION_ATTEMPTS': (int, 'Advanced', 5),
'WEBSOCKET_CONNECTION_TIMEOUT': (int, 'Advanced', 5),
+ 'WEEK_START_MONDAY': (int, 'General', 0),
'XBMC_ENABLED': (int, 'XBMC', 0),
'XBMC_HOST': (str, 'XBMC', ''),
'XBMC_PASSWORD': (str, 'XBMC', ''),
diff --git a/plexpy/graphs.py b/plexpy/graphs.py
index 3666a471..fbd9087e 100644
--- a/plexpy/graphs.py
+++ b/plexpy/graphs.py
@@ -169,8 +169,12 @@ class Graphs(object):
logger.warn(u"PlexPy Graphs :: Unable to execute database query for get_total_plays_per_dayofweek: %s." % e)
return None
- days_list = ['Sunday', 'Monday', 'Tuesday', 'Wednesday',
- 'Thursday', 'Friday', 'Saturday']
+ if plexpy.CONFIG.WEEK_START_MONDAY:
+ days_list = ['Monday', 'Tuesday', 'Wednesday',
+ 'Thursday', 'Friday', 'Saturday', 'Sunday']
+ else:
+ days_list = ['Sunday', 'Monday', 'Tuesday', 'Wednesday',
+ 'Thursday', 'Friday', 'Saturday']
categories = []
series_1 = []
@@ -291,8 +295,11 @@ class Graphs(object):
'series': [series_1_output, series_2_output, series_3_output]}
return output
- def get_total_plays_per_month(self, y_axis='plays', user_id=None):
+ def get_total_plays_per_month(self, time_range='12', y_axis='plays', user_id=None):
import time as time
+
+ if not time_range.isdigit():
+ time_range = '12'
monitor_db = database.MonitorDatabase()
@@ -309,9 +316,9 @@ class Graphs(object):
'SUM(CASE WHEN media_type = "movie" THEN 1 ELSE 0 END) AS movie_count, ' \
'SUM(CASE WHEN media_type = "track" THEN 1 ELSE 0 END) AS music_count ' \
'FROM session_history ' \
- 'WHERE datetime(started, "unixepoch", "localtime") >= datetime("now", "-12 months", "localtime") %s' \
+ 'WHERE datetime(started, "unixepoch", "localtime") >= datetime("now", "-%s months", "localtime") %s' \
'GROUP BY strftime("%%Y-%%m", datetime(started, "unixepoch", "localtime")) ' \
- 'ORDER BY datestring DESC LIMIT 12' % (user_cond)
+ 'ORDER BY datestring DESC LIMIT %s' % (time_range, user_cond, time_range)
result = monitor_db.select(query)
else:
@@ -323,9 +330,9 @@ class Graphs(object):
'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_count ' \
'FROM session_history ' \
- 'WHERE datetime(started, "unixepoch", "localtime") >= datetime("now", "-12 months", "localtime") %s' \
+ 'WHERE datetime(started, "unixepoch", "localtime") >= datetime("now", "-%s months", "localtime") %s' \
'GROUP BY strftime("%%Y-%%m", datetime(started, "unixepoch", "localtime")) ' \
- 'ORDER BY datestring DESC LIMIT 12' % (user_cond)
+ 'ORDER BY datestring DESC LIMIT %s' % (time_range, user_cond, time_range)
result = monitor_db.select(query)
except Exception as e:
@@ -334,10 +341,9 @@ class Graphs(object):
# create our date range as some months may not have any data
# but we still want to display them
- x = 12
base = time.localtime()
month_range = [time.localtime(
- time.mktime((base.tm_year, base.tm_mon - n, 1, 0, 0, 0, 0, 0, 0))) for n in range(x)]
+ time.mktime((base.tm_year, base.tm_mon - n, 1, 0, 0, 0, 0, 0, 0))) for n in range(int(time_range))]
categories = []
series_1 = []
diff --git a/plexpy/version.py b/plexpy/version.py
index 56ca293d..da379833 100644
--- a/plexpy/version.py
+++ b/plexpy/version.py
@@ -1,2 +1,2 @@
-PLEXPY_BRANCH = "master"
-PLEXPY_RELEASE_VERSION = "1.4.16"
+PLEXPY_BRANCH = "master"
+PLEXPY_RELEASE_VERSION = "1.4.17"
\ No newline at end of file
diff --git a/plexpy/webserve.py b/plexpy/webserve.py
index 4131bac4..34f565c8 100644
--- a/plexpy/webserve.py
+++ b/plexpy/webserve.py
@@ -1773,6 +1773,7 @@ class WebInterface(object):
config = {
"graph_type": plexpy.CONFIG.GRAPH_TYPE,
"graph_days": plexpy.CONFIG.GRAPH_DAYS,
+ "graph_months": plexpy.CONFIG.GRAPH_MONTHS,
"graph_tab": plexpy.CONFIG.GRAPH_TAB,
"music_logging_enable": plexpy.CONFIG.MUSIC_LOGGING_ENABLE
}
@@ -1781,13 +1782,16 @@ class WebInterface(object):
@cherrypy.expose
@requireAuth(member_of("admin"))
- def set_graph_config(self, graph_type=None, graph_days=None, graph_tab=None, **kwargs):
+ def set_graph_config(self, graph_type=None, graph_days=None, graph_months=None, graph_tab=None, **kwargs):
if graph_type:
plexpy.CONFIG.__setattr__('GRAPH_TYPE', graph_type)
plexpy.CONFIG.write()
if graph_days:
plexpy.CONFIG.__setattr__('GRAPH_DAYS', graph_days)
plexpy.CONFIG.write()
+ if graph_months:
+ plexpy.CONFIG.__setattr__('GRAPH_MONTHS', graph_months)
+ plexpy.CONFIG.write()
if graph_tab:
plexpy.CONFIG.__setattr__('GRAPH_TAB', graph_tab)
plexpy.CONFIG.write()
@@ -1934,7 +1938,7 @@ class WebInterface(object):
@cherrypy.tools.json_out()
@requireAuth()
@addtoapi()
- def get_plays_per_month(self, y_axis='plays', user_id=None, **kwargs):
+ def get_plays_per_month(self, time_range='12', y_axis='plays', user_id=None, **kwargs):
""" Get graph data by month.
```
@@ -1942,7 +1946,7 @@ class WebInterface(object):
None
Optional parameters:
- time_range (str): The number of days of data to return
+ time_range (str): The number of months of data to return
y_axis (str): "plays" or "duration"
user_id (str): The user id to filter the data
@@ -1959,7 +1963,7 @@ class WebInterface(object):
```
"""
graph = graphs.Graphs()
- result = graph.get_total_plays_per_month(y_axis=y_axis, user_id=user_id)
+ result = graph.get_total_plays_per_month(time_range=time_range, y_axis=y_axis, user_id=user_id)
if result:
return result
@@ -2574,6 +2578,7 @@ class WebInterface(object):
"pms_uuid": plexpy.CONFIG.PMS_UUID,
"date_format": plexpy.CONFIG.DATE_FORMAT,
"time_format": plexpy.CONFIG.TIME_FORMAT,
+ "week_start_monday": checked(plexpy.CONFIG.WEEK_START_MONDAY),
"get_file_sizes": checked(plexpy.CONFIG.GET_FILE_SIZES),
"grouping_global_history": checked(plexpy.CONFIG.GROUPING_GLOBAL_HISTORY),
"grouping_user_history": checked(plexpy.CONFIG.GROUPING_USER_HISTORY),
@@ -2632,7 +2637,7 @@ class WebInterface(object):
checked_configs = [
"launch_browser", "enable_https", "https_create_cert", "api_enabled", "freeze_db", "check_github",
"grouping_global_history", "grouping_user_history", "grouping_charts", "group_history_tables",
- "pms_use_bif", "pms_ssl", "pms_is_remote", "home_stats_type",
+ "pms_use_bif", "pms_ssl", "pms_is_remote", "home_stats_type", "week_start_monday",
"movie_notify_enable", "tv_notify_enable", "music_notify_enable",
"refresh_libraries_on_startup", "refresh_users_on_startup",
"movie_logging_enable", "tv_logging_enable", "music_logging_enable",