Compare commits
68 Commits
v2.1.20-be
...
v2.1.23-be
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1bce850765 | ||
![]() |
ebe5c3168f | ||
![]() |
6e4fa3ef63 | ||
![]() |
ec7afcdbc4 | ||
![]() |
0f2e25ba72 | ||
![]() |
115b05ee7f | ||
![]() |
85b4116491 | ||
![]() |
863bb4033c | ||
![]() |
92672ddda8 | ||
![]() |
018356b85e | ||
![]() |
d93390f8ed | ||
![]() |
e36be32b8e | ||
![]() |
0e0fb2e2b8 | ||
![]() |
be0144bbe1 | ||
![]() |
0d30df6853 | ||
![]() |
77460f7617 | ||
![]() |
c70cc535e5 | ||
![]() |
16733bbe04 | ||
![]() |
1686b70c1c | ||
![]() |
1ef4fd294a | ||
![]() |
83a4dfc0de | ||
![]() |
2eb82e8732 | ||
![]() |
67f70fab90 | ||
![]() |
fb2362be24 | ||
![]() |
612bf079de | ||
![]() |
a88047eb9c | ||
![]() |
7bdef05a45 | ||
![]() |
1a46e09928 | ||
![]() |
4302c4bc0d | ||
![]() |
3b0f31c112 | ||
![]() |
a976d65e9c | ||
![]() |
40559471cf | ||
![]() |
6bb6e27378 | ||
![]() |
03751abc0e | ||
![]() |
8ab5d88db5 | ||
![]() |
d80919140b | ||
![]() |
1e3a347782 | ||
![]() |
a6e8372d47 | ||
![]() |
ce59692089 | ||
![]() |
df76a02478 | ||
![]() |
a94207691f | ||
![]() |
dbc53ca710 | ||
![]() |
4c9ddbd8b7 | ||
![]() |
045c69f5d8 | ||
![]() |
71ae314c46 | ||
![]() |
c8575bbc0f | ||
![]() |
af3944734f | ||
![]() |
f1b3a6f7b6 | ||
![]() |
8a94f6d63a | ||
![]() |
9b8fb73a7a | ||
![]() |
67c333e86e | ||
![]() |
cfa0b20419 | ||
![]() |
4b2930c890 | ||
![]() |
d98565ea12 | ||
![]() |
471f7c184a | ||
![]() |
3d4a5e6547 | ||
![]() |
382322d5e7 | ||
![]() |
c0ae25611b | ||
![]() |
f025533582 | ||
![]() |
fd28e5183a | ||
![]() |
185099f183 | ||
![]() |
cd6289046e | ||
![]() |
955dc795ff | ||
![]() |
1b772e60a9 | ||
![]() |
c6f4c17a81 | ||
![]() |
1e68a81fe1 | ||
![]() |
4944ce1ca0 | ||
![]() |
634e003bb7 |
6
API.md
6
API.md
@@ -733,7 +733,7 @@ Required parameters:
|
||||
Optional parameters:
|
||||
grouping (int): 0 or 1
|
||||
time_range (str): The time range to calculate statistics, '30'
|
||||
stats_type (int): 0 for plays, 1 for duration
|
||||
stats_type (str): plays or duration
|
||||
stats_count (str): The number of top items to list, '5'
|
||||
|
||||
Returns:
|
||||
@@ -1775,7 +1775,7 @@ Returns:
|
||||
|
||||
|
||||
### get_recently_added
|
||||
Get all items that where recelty added to plex.
|
||||
Get all items that where recently added to plex.
|
||||
|
||||
```
|
||||
Required parameters:
|
||||
@@ -1783,7 +1783,7 @@ Required parameters:
|
||||
|
||||
Optional parameters:
|
||||
start (str): The item number to start at
|
||||
type (str): The media type: movie, show, artist
|
||||
media_type (str): The media type: movie, show, artist
|
||||
section_id (str): The id of the Plex library section
|
||||
|
||||
Returns:
|
||||
|
61
CHANGELOG.md
61
CHANGELOG.md
@@ -1,5 +1,66 @@
|
||||
# Changelog
|
||||
|
||||
## v2.1.23-beta (2018-10-14)
|
||||
|
||||
* Monitoring:
|
||||
* Fix: Buffer events not being triggered properly.
|
||||
* Fix: Watched progress sometimes not saved correctly. (Thanks @Sheigutn)
|
||||
* Notifications:
|
||||
* New: Added notification trigger for transcode decision change.
|
||||
* Fix: Multiple buffer notifications being triggered within the same second.
|
||||
* Change: Default buffer notification threshold changed to 10 for buffer thresholds less than 10.
|
||||
* Newsletter:
|
||||
* New: Added Other Video libraries to the newsletter.
|
||||
* Homepage:
|
||||
* New: Added Other Video type to recently added on the homepage.
|
||||
* Change: Save homepage recently added media type toggle state.
|
||||
* Change: Save homepage stats config to local storage instead of the server.
|
||||
* History:
|
||||
* Change: Save history table media type toggle state.
|
||||
* Graphs:
|
||||
* Change: Save series visibility state when toggling the legend.
|
||||
* Change: Save graph config to local storage instead of the server.
|
||||
* UI:
|
||||
* New: Show the remote app device token and id in the edit device modal.
|
||||
* Change: Lock certain settings if using the Tautulli docker container.
|
||||
* API:
|
||||
* Fix: download_config, download_database, download_log, and download_plex_log API commands not working.
|
||||
* Change: get_recently_added command 'type' parameter renamed to 'media_type'. Backwards compatibility is maintained.
|
||||
* Change: get_home_stats command 'stats_type' parameter change to string 'plays' or 'duration'. Backwards compatibility is maintained.
|
||||
|
||||
|
||||
## v2.1.22 (2018-10-05)
|
||||
|
||||
* Notifications:
|
||||
* Fix: Notification agent settings not loading when failed to retrieve some data.
|
||||
* UI:
|
||||
* Fix: Incorrectly showing localhost server in the setup wizard.
|
||||
* Other:
|
||||
* Fix: Incorrect redirect to HTTP when HTTPS proxy header is present.
|
||||
* Fix: Websocket not connecting automatically after the setup wizard.
|
||||
|
||||
|
||||
## v2.1.21 (2018-09-21)
|
||||
|
||||
* Notifications:
|
||||
* Fix: Content Rating notification condition always evaluating to True. (Thanks @Arcanemagus)
|
||||
* Fix: Script arguments not showing substituted values in the notification logs.
|
||||
* UI:
|
||||
* New: Unsupported browser warning when using IE or Edge.
|
||||
* Fix: Misaligned refresh image icon in album search results. (Thanks @Sheigutn)
|
||||
* Fix: Music history showing as pre-Tautulli in stream info modal.
|
||||
* Other:
|
||||
* Fix: Typo in Systemd init script group value. (Thanks @ldumont)
|
||||
* Fix: Execute permissions in Fedora/CentOS and Systemd init scripts. (Thanks @wilmardo)
|
||||
* Fix: Systemd init script instructions per Linux distro. (Thanks @samwiseg00)
|
||||
* Change: Fallback to Tautulli data directory if logs/backup/cache/newsletter directories are not writable.
|
||||
* Change: Check for alternative reverse proxy headers if X-Forwarded-Host is missing.
|
||||
|
||||
|
||||
## v2.1.20 (2018-09-05)
|
||||
* No changes.
|
||||
|
||||
|
||||
## v2.1.20-beta (2018-09-02)
|
||||
|
||||
* Monitoring:
|
||||
|
@@ -106,6 +106,9 @@ def main():
|
||||
logger.initLogger(console=not plexpy.QUIET, log_dir=False,
|
||||
verbose=plexpy.VERBOSE)
|
||||
|
||||
if os.getenv('TAUTULLI_DOCKER', False) == 'True':
|
||||
plexpy.DOCKER = True
|
||||
|
||||
if args.dev:
|
||||
plexpy.DEV = True
|
||||
logger.debug(u"Tautulli is running in the dev environment.")
|
||||
|
@@ -676,7 +676,9 @@ textarea.form-control:focus {
|
||||
color: #F9AA03;
|
||||
margin: 5px 40px 5px 0;
|
||||
}
|
||||
.form-control[readonly] {
|
||||
.form-control[disabled],
|
||||
.form-control[readonly],
|
||||
fieldset[disabled] .form-control {
|
||||
background-color: #555;
|
||||
}
|
||||
.form-control[readonly]:focus {
|
||||
@@ -2151,6 +2153,10 @@ div.advanced-setting {
|
||||
li.advanced-setting {
|
||||
border-left: 1px solid #cc7b19;
|
||||
}
|
||||
.docker-setting {
|
||||
color: #cc7b19;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.user-info-wrapper {
|
||||
}
|
||||
.user-info-poster-face {
|
||||
@@ -4162,4 +4168,16 @@ a[data-tab-destination] {
|
||||
}
|
||||
.fa-blank {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
#browser-warning {
|
||||
height: 25px;
|
||||
width: 100%;
|
||||
background: #cc7b19;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
padding-top: 2px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
@@ -21,137 +21,109 @@
|
||||
</label>
|
||||
</div>
|
||||
<div class="btn-group" style="margin-right: 2px;" data-toggle="buttons" id="yaxis-selection">
|
||||
% if config['graph_type'] == 'duration':
|
||||
<label class="btn btn-dark">
|
||||
<input type="radio" name="yaxis-options" id="yaxis-count" value="plays" autocomplete="off"> Play Count
|
||||
</label>
|
||||
<label class="btn btn-dark active">
|
||||
<input type="radio" name="yaxis-options" id="yaxis-duration" value="duration" autocomplete="off" checked> Play Duration
|
||||
</label>
|
||||
% else:
|
||||
<label class="btn btn-dark active">
|
||||
<input type="radio" name="yaxis-options" id="yaxis-count" value="plays" autocomplete="off" checked> Play Count
|
||||
<input type="radio" name="yaxis-options" id="yaxis-plays" value="plays" autocomplete="off"> Play Count
|
||||
</label>
|
||||
<label class="btn btn-dark">
|
||||
<input type="radio" name="yaxis-options" id="yaxis-duration" value="duration" autocomplete="off"> Play Duration
|
||||
</label>
|
||||
% endif
|
||||
</div>
|
||||
<div class="input-group pull-right" style="width: 1px;" id="days-selection">
|
||||
<span class="input-group-addon btn-dark inactive">Last</span>
|
||||
<input type="number" class="form-control number-input" name="graph-days" id="graph-days" value="${config['graph_days']}" min="1" data-default="7" data-toggle="tooltip" title="Min: 1 day" />
|
||||
<input type="number" class="form-control number-input" name="graph-days" id="graph-days" value="30" min="1" data-default="7" data-toggle="tooltip" title="Min: 1 day" />
|
||||
<span class="input-group-addon btn-dark inactive">days</span>
|
||||
</div>
|
||||
<div class="input-group pull-right" style="width: 1px;" id="months-selection">
|
||||
<span class="input-group-addon btn-dark inactive">Last</span>
|
||||
<input type="number" class="form-control number-input" name="graph-months" id="graph-months" value="${config['graph_months']}" min="1" data-default="12" data-toggle="tooltip" title="Min: 1 month" />
|
||||
<input type="number" class="form-control number-input" name="graph-months" id="graph-months" value="12" min="1" data-default="12" data-toggle="tooltip" title="Min: 1 month" />
|
||||
<span class="input-group-addon btn-dark inactive">months</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='table-card-back'>
|
||||
<ul class="nav nav-pills" role="tablist" id="graph-tabs">
|
||||
% if config['graph_tab'] == 'tabs-3':
|
||||
<li role="presentation"><a href="#tabs-1" aria-controls="tabs-1" data-toggle="tab" role="tab">Plays by period</a></li>
|
||||
<li role="presentation"><a href="#tabs-2" aria-controls="tabs-2" data-toggle="tab" role="tab">Stream Info</a></li>
|
||||
<li role="presentation" class="active"><a href="#tabs-3" aria-controls="tabs-3" data-toggle="tab" role="tab">Play Totals</a></li>
|
||||
% elif config['graph_tab'] == 'tabs-2':
|
||||
<li role="presentation"><a href="#tabs-1" aria-controls="tabs-1" data-toggle="tab" role="tab">Plays by period</a></li>
|
||||
<li role="presentation" class="active"><a href="#tabs-2" aria-controls="tabs-2" data-toggle="tab" role="tab">Stream Info</a></li>
|
||||
<li role="presentation"><a href="#tabs-3" aria-controls="tabs-3" data-toggle="tab" role="tab">Play Totals</a></li>
|
||||
% else:
|
||||
<li role="presentation" class="active"><a href="#tabs-1" aria-controls="tabs-1" data-toggle="tab" role="tab">Plays by period</a></li>
|
||||
<li role="presentation"><a href="#tabs-1" aria-controls="tabs-1" data-toggle="tab" role="tab">Plays by Period</a></li>
|
||||
<li role="presentation"><a href="#tabs-2" aria-controls="tabs-2" data-toggle="tab" role="tab">Stream Info</a></li>
|
||||
<li role="presentation"><a href="#tabs-3" aria-controls="tabs-3" data-toggle="tab" role="tab">Play Totals</a></li>
|
||||
% endif
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
% if config['graph_tab'] != 'tabs-2' and config['graph_tab'] != 'tabs-3':
|
||||
<div role="tabpanel" class="tab-pane active" id="tabs-1">
|
||||
% else:
|
||||
<div role="tabpanel" class="tab-pane" id="tabs-1">
|
||||
% endif
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h4><i class="fa fa-history"></i> Daily <span class="yaxis-text">Play count</span> <small>Last <span class="days">30</span> days</small></h4>
|
||||
<p class="help-block">
|
||||
The total play count or duration of tv, movies, and music played per day. Click a graph point to open up a list of items played for that specific date.
|
||||
</p>
|
||||
<div class="graphs-instance">
|
||||
<div class="watch-chart" id="chart_div_plays_by_day">
|
||||
<div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart...</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h4><i class="fa fa-calendar"></i> <span class="yaxis-text">Play count</span> by day of week <small>Last <span class="days">30</span> days</small></h4>
|
||||
<p class="help-block">
|
||||
The combined total of tv, movies, and music played per day of the week.
|
||||
</p>
|
||||
<div class="graphs-instance">
|
||||
<div class="watch-chart" id="chart_div_plays_by_dayofweek" style="float: left;">
|
||||
<div class="graphs-load">
|
||||
<i class="fa fa-refresh fa-spin"></i> Loading chart...
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h4><i class="fa fa-clock-o"></i> <span class="yaxis-text">Play count</span> by hour of day <small>Last <span class="days">30</span> days</small></h4>
|
||||
<p class="help-block">
|
||||
The combined total of tv, movies, and music played per hour of the day.
|
||||
</p>
|
||||
<div class="graphs-instance">
|
||||
<div class="watch-chart" id="chart_div_plays_by_hourofday">
|
||||
<div class="graphs-load">
|
||||
<i class="fa fa-refresh fa-spin"></i> Loading chart...
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h4><i class="fa fa-television"></i> <span class="yaxis-text">Play count</span> by top 10 platforms <small>Last <span class="days">30</span> days</small></h4>
|
||||
<p class="help-block">
|
||||
The combined total of tv, movies, and music played by top 10 most active platforms.
|
||||
</p>
|
||||
<div class="graphs-instance">
|
||||
<div class="watch-chart" id="chart_div_plays_by_platform" style="float: left;">
|
||||
<div class="graphs-load">
|
||||
<i class="fa fa-refresh fa-spin"></i> Loading chart...
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h4><i class="fa fa-user"></i> <span class="yaxis-text">Play count</span> by top 10 users <small>Last <span class="days">30</span> days</small></h4>
|
||||
<p class="help-block">
|
||||
The combined total of tv, movies, and music played by top 10 most active users.
|
||||
</p>
|
||||
<div class="graphs-instance">
|
||||
<div class="watch-chart" id="chart_div_plays_by_user">
|
||||
<div class="graphs-load">
|
||||
<i class="fa fa-refresh fa-spin"></i> Loading chart...
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h4><i class="fa fa-history"></i> Daily <span class="yaxis-text">Play count</span> <small>Last <span class="days">30</span> days</small></h4>
|
||||
<p class="help-block">
|
||||
The total play count or duration of tv, movies, and music played per day. Click a graph point to open up a list of items played for that specific date.
|
||||
</p>
|
||||
<div class="graphs-instance">
|
||||
<div class="watch-chart" id="graph_plays_by_day">
|
||||
<div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart...</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
% if config['graph_tab'] == 'tabs-2':
|
||||
<div role="tabpanel" class="tab-pane active" id="tabs-2">
|
||||
% else:
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h4><i class="fa fa-calendar"></i> <span class="yaxis-text">Play count</span> by day of week <small>Last <span class="days">30</span> days</small></h4>
|
||||
<p class="help-block">
|
||||
The combined total of tv, movies, and music played per day of the week.
|
||||
</p>
|
||||
<div class="graphs-instance">
|
||||
<div class="watch-chart" id="graph_plays_by_dayofweek" style="float: left;">
|
||||
<div class="graphs-load">
|
||||
<i class="fa fa-refresh fa-spin"></i> Loading chart...
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h4><i class="fa fa-clock-o"></i> <span class="yaxis-text">Play count</span> by hour of day <small>Last <span class="days">30</span> days</small></h4>
|
||||
<p class="help-block">
|
||||
The combined total of tv, movies, and music played per hour of the day.
|
||||
</p>
|
||||
<div class="graphs-instance">
|
||||
<div class="watch-chart" id="graph_plays_by_hourofday">
|
||||
<div class="graphs-load">
|
||||
<i class="fa fa-refresh fa-spin"></i> Loading chart...
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h4><i class="fa fa-television"></i> <span class="yaxis-text">Play count</span> by top 10 platforms <small>Last <span class="days">30</span> days</small></h4>
|
||||
<p class="help-block">
|
||||
The combined total of tv, movies, and music played by top 10 most active platforms.
|
||||
</p>
|
||||
<div class="graphs-instance">
|
||||
<div class="watch-chart" id="graph_plays_by_platform" style="float: left;">
|
||||
<div class="graphs-load">
|
||||
<i class="fa fa-refresh fa-spin"></i> Loading chart...
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h4><i class="fa fa-user"></i> <span class="yaxis-text">Play count</span> by top 10 users <small>Last <span class="days">30</span> days</small></h4>
|
||||
<p class="help-block">
|
||||
The combined total of tv, movies, and music played by top 10 most active users.
|
||||
</p>
|
||||
<div class="graphs-instance">
|
||||
<div class="watch-chart" id="graph_plays_by_user">
|
||||
<div class="graphs-load">
|
||||
<i class="fa fa-refresh fa-spin"></i> Loading chart...
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="tabs-2">
|
||||
% endif
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h4><i class="fa fa-video-camera"></i> Daily Stream type breakdown <small>Last <span class="days">30</span> days</small></h4>
|
||||
@@ -159,7 +131,7 @@
|
||||
The total play count or duration of tv, movies, and music by the transcode decision. Click a graph point to open up a list of items played for that specific date.
|
||||
</p>
|
||||
<div class="graphs-instance">
|
||||
<div class="watch-chart" id="chart_div_plays_by_stream_type">
|
||||
<div class="watch-chart" id="graph_plays_by_stream_type">
|
||||
<div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart...</div>
|
||||
<br>
|
||||
</div>
|
||||
@@ -173,7 +145,7 @@
|
||||
The combined total of tv and movies by their original resolution (pre-transcoding).
|
||||
</p>
|
||||
<div class="graphs-instance">
|
||||
<div class="watch-chart" id="chart_div_plays_by_source_resolution" style="float: left;">
|
||||
<div class="watch-chart" id="graph_plays_by_source_resolution" style="float: left;">
|
||||
<div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart...
|
||||
</div>
|
||||
<br>
|
||||
@@ -186,7 +158,7 @@
|
||||
The combined total of tv and movies by their streamed resolution (post-transcoding).
|
||||
</p>
|
||||
<div class="graphs-instance">
|
||||
<div class="watch-chart" id="chart_div_plays_by_stream_resolution">
|
||||
<div class="watch-chart" id="graph_plays_by_stream_resolution">
|
||||
<div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart...
|
||||
</div>
|
||||
<br>
|
||||
@@ -201,7 +173,7 @@
|
||||
The combined total of tv, movies, and music by platform and stream type.
|
||||
</p>
|
||||
<div class="graphs-instance">
|
||||
<div class="watch-chart" id="chart_div_plays_by_platform_by_stream_type" style="float: left;">
|
||||
<div class="watch-chart" id="graph_plays_by_platform_by_stream_type" style="float: left;">
|
||||
<div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart...
|
||||
</div>
|
||||
<br>
|
||||
@@ -214,7 +186,7 @@
|
||||
The combined total of tv, movies, and music by user and stream type.
|
||||
</p>
|
||||
<div class="graphs-instance">
|
||||
<div class="watch-chart" id="chart_div_plays_by_user_by_stream_type" style="float: left;">
|
||||
<div class="watch-chart" id="graph_plays_by_user_by_stream_type" style="float: left;">
|
||||
<div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart...
|
||||
</div>
|
||||
<br>
|
||||
@@ -223,12 +195,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
% if config['graph_tab'] == 'tabs-3':
|
||||
<div role="tabpanel" class="tab-pane active" id="tabs-3">
|
||||
% else:
|
||||
<div role="tabpanel" class="tab-pane" id="tabs-3">
|
||||
% endif
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h4><i class="fa fa-calendar"></i> Plays by month <small>Last <span class="months">12</span> months</small></h4>
|
||||
@@ -236,7 +203,7 @@
|
||||
The combined total of tv, movies, and music by month.
|
||||
</p>
|
||||
<div class="graphs-instance">
|
||||
<div class="watch-chart" id="chart_div_plays_by_month">
|
||||
<div class="watch-chart" id="graph_plays_by_month">
|
||||
<div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart...
|
||||
</div>
|
||||
<br>
|
||||
@@ -266,7 +233,7 @@
|
||||
<script src="${http_root}js/dataTables.bootstrap.pagination.js"></script>
|
||||
|
||||
<script>
|
||||
var selected_user_id = null
|
||||
var selected_user_id = null;
|
||||
|
||||
// Modal popup dialog
|
||||
function selectHandler(selectedDate, selectedSeries) {
|
||||
@@ -311,6 +278,32 @@
|
||||
console.log("Failed to retrieve history modal data.");
|
||||
}
|
||||
}
|
||||
|
||||
function getGraphVisibility(chart_name, data_series) {
|
||||
var chart_key = 'HighCharts_' + chart_name;
|
||||
var chart_visibility = JSON.parse(getLocalStorage(chart_key, null)) || [];
|
||||
|
||||
chart_visibility = chart_visibility.reduce(function(obj, s) {
|
||||
obj[s.name] = s.visible;
|
||||
return obj;
|
||||
}, {});
|
||||
|
||||
return data_series.map(function(s) {
|
||||
var obj = Object.assign({}, s);
|
||||
obj.visible = (chart_visibility[s.name] !== false);
|
||||
return obj
|
||||
});
|
||||
}
|
||||
|
||||
function setGraphVisibility(chart_name, data_series, series_name) {
|
||||
var chart_key = 'HighCharts_' + chart_name;
|
||||
|
||||
var chart_visibility = data_series.map(function(s) {
|
||||
return {name: s.name, visible: (s.name === series_name) ? !s.visible : s.visible}
|
||||
});
|
||||
|
||||
setLocalStorage(chart_key, JSON.stringify(chart_visibility));
|
||||
}
|
||||
</script>
|
||||
<script src="${http_root}js/graphs/plays_by_day.js"></script>
|
||||
<script src="${http_root}js/graphs/plays_by_dayofweek.js"></script>
|
||||
@@ -326,12 +319,20 @@
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
// Initial values for graph from config
|
||||
var yaxis = "${config['graph_type']}";
|
||||
var current_day_range = ${config['graph_days']};
|
||||
var current_month_range = ${config['graph_months']};
|
||||
var current_tab = "${'#' + config['graph_tab']}";
|
||||
|
||||
// Initial values for graph from local storage
|
||||
var yaxis = getLocalStorage('graph_type', 'plays');
|
||||
var current_day_range = getLocalStorage('graph_days', 30);
|
||||
var current_month_range = getLocalStorage('graph_months', 12);
|
||||
var current_tab = '#' + getLocalStorage('graph_tab', 'tabs-1');
|
||||
|
||||
$('#yaxis-' + yaxis).prop('checked', true);
|
||||
$('#yaxis-' + yaxis).closest('label').addClass('active');
|
||||
$('#graph-days').val(current_day_range);
|
||||
$('#graph-months').val(current_month_range);
|
||||
$('#graph-tabs a[href="' + current_tab + '"]').closest('li').addClass('active');
|
||||
$(current_tab).addClass('active');
|
||||
|
||||
|
||||
$('.days').html(current_day_range);
|
||||
$('.months').html(current_month_range);
|
||||
|
||||
@@ -352,9 +353,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var music_visible = (${config['music_logging_enable']} == 1 ? true : false);
|
||||
|
||||
function dataSecondsToHours(data) {
|
||||
$.each(data.series, function (i, series) {
|
||||
series.data = $.map(series.data, function (value) {
|
||||
@@ -379,8 +377,8 @@
|
||||
$.each(data.categories, function (i, day) {
|
||||
dateArray.push(moment(day, 'YYYY-MM-DD').valueOf());
|
||||
// Highlight the weekend
|
||||
if ((moment(day, 'YYYY-MM-DD').format('ddd') == 'Sat') ||
|
||||
(moment(day, 'YYYY-MM-DD').format('ddd') == 'Sun')) {
|
||||
if ((moment(day, 'YYYY-MM-DD').format('ddd') === 'Sat') ||
|
||||
(moment(day, 'YYYY-MM-DD').format('ddd') === 'Sun')) {
|
||||
hc_plays_by_day_options.xAxis.plotBands.push({
|
||||
from: i-0.5,
|
||||
to: i+0.5,
|
||||
@@ -391,8 +389,7 @@
|
||||
if (yaxis === 'duration') { dataSecondsToHours(data); }
|
||||
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;
|
||||
hc_plays_by_day_options.series = getGraphVisibility(hc_plays_by_day_options.chart.renderTo, data.series);
|
||||
var hc_plays_by_day = new Highcharts.Chart(hc_plays_by_day_options);
|
||||
}
|
||||
});
|
||||
@@ -405,8 +402,7 @@
|
||||
success: function(data) {
|
||||
if (yaxis === 'duration') { dataSecondsToHours(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;
|
||||
hc_plays_by_dayofweek_options.series = getGraphVisibility(hc_plays_by_dayofweek_options.chart.renderTo, data.series);
|
||||
var hc_plays_by_dayofweek = new Highcharts.Chart(hc_plays_by_dayofweek_options);
|
||||
}
|
||||
});
|
||||
@@ -419,8 +415,7 @@
|
||||
success: function(data) {
|
||||
if (yaxis === 'duration') { dataSecondsToHours(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;
|
||||
hc_plays_by_hourofday_options.series = getGraphVisibility(hc_plays_by_hourofday_options.chart.renderTo, data.series);
|
||||
var hc_plays_by_hourofday = new Highcharts.Chart(hc_plays_by_hourofday_options);
|
||||
}
|
||||
});
|
||||
@@ -433,8 +428,7 @@
|
||||
success: function(data) {
|
||||
if (yaxis === 'duration') { dataSecondsToHours(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;
|
||||
hc_plays_by_platform_options.series = getGraphVisibility(hc_plays_by_platform_options.chart.renderTo, data.series);
|
||||
var hc_plays_by_platform = new Highcharts.Chart(hc_plays_by_platform_options);
|
||||
}
|
||||
});
|
||||
@@ -447,11 +441,12 @@
|
||||
success: function(data) {
|
||||
if (yaxis === 'duration') { dataSecondsToHours(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;
|
||||
hc_plays_by_user_options.series = getGraphVisibility(hc_plays_by_user_options.chart.renderTo, data.series);
|
||||
var hc_plays_by_user = new Highcharts.Chart(hc_plays_by_user_options);
|
||||
}
|
||||
});
|
||||
|
||||
$('#graph-tabs a[href="#tabs-1"]').tab('show')
|
||||
}
|
||||
|
||||
function loadGraphsTab2(time_range, yaxis) {
|
||||
@@ -482,7 +477,7 @@
|
||||
if (yaxis === 'duration') { dataSecondsToHours(data); }
|
||||
hc_plays_by_stream_type_options.yAxis.min = 0;
|
||||
hc_plays_by_stream_type_options.xAxis.categories = dateArray;
|
||||
hc_plays_by_stream_type_options.series = data.series;
|
||||
hc_plays_by_stream_type_options.series = getGraphVisibility(hc_plays_by_stream_type_options.chart.renderTo, data.series);
|
||||
var hc_plays_by_stream_type = new Highcharts.Chart(hc_plays_by_stream_type_options);
|
||||
}
|
||||
});
|
||||
@@ -495,7 +490,7 @@
|
||||
success: function(data) {
|
||||
if (yaxis === 'duration') { dataSecondsToHours(data); }
|
||||
hc_plays_by_source_resolution_options.xAxis.categories = data.categories;
|
||||
hc_plays_by_source_resolution_options.series = data.series;
|
||||
hc_plays_by_source_resolution_options.series = getGraphVisibility(hc_plays_by_source_resolution_options.chart.renderTo, data.series);
|
||||
var hc_plays_by_source_resolution = new Highcharts.Chart(hc_plays_by_source_resolution_options);
|
||||
}
|
||||
});
|
||||
@@ -508,7 +503,7 @@
|
||||
success: function(data) {
|
||||
if (yaxis === 'duration') { dataSecondsToHours(data); }
|
||||
hc_plays_by_stream_resolution_options.xAxis.categories = data.categories;
|
||||
hc_plays_by_stream_resolution_options.series = data.series;
|
||||
hc_plays_by_stream_resolution_options.series = getGraphVisibility(hc_plays_by_stream_resolution_options.chart.renderTo, data.series);
|
||||
var hc_plays_by_stream_resolution = new Highcharts.Chart(hc_plays_by_stream_resolution_options);
|
||||
}
|
||||
});
|
||||
@@ -521,7 +516,7 @@
|
||||
success: function(data) {
|
||||
if (yaxis === 'duration') { dataSecondsToHours(data); }
|
||||
hc_plays_by_platform_by_stream_type_options.xAxis.categories = data.categories;
|
||||
hc_plays_by_platform_by_stream_type_options.series = data.series;
|
||||
hc_plays_by_platform_by_stream_type_options.series = getGraphVisibility(hc_plays_by_platform_by_stream_type_options.chart.renderTo, data.series);
|
||||
var hc_plays_by_platform_by_stream_type = new Highcharts.Chart(hc_plays_by_platform_by_stream_type_options);
|
||||
}
|
||||
});
|
||||
@@ -534,10 +529,12 @@
|
||||
success: function(data) {
|
||||
if (yaxis === 'duration') { dataSecondsToHours(data); }
|
||||
hc_plays_by_user_by_stream_type_options.xAxis.categories = data.categories;
|
||||
hc_plays_by_user_by_stream_type_options.series = data.series;
|
||||
hc_plays_by_user_by_stream_type_options.series = getGraphVisibility(hc_plays_by_user_by_stream_type_options.chart.renderTo, data.series);
|
||||
var hc_plays_by_user_by_stream_type = new Highcharts.Chart(hc_plays_by_user_by_stream_type_options);
|
||||
}
|
||||
});
|
||||
|
||||
$('#graph-tabs a[href="#tabs-2"]').tab('show')
|
||||
}
|
||||
|
||||
function loadGraphsTab3(time_range, yaxis) {
|
||||
@@ -555,51 +552,52 @@
|
||||
if (yaxis === 'duration') { dataSecondsToHours(data); }
|
||||
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;
|
||||
hc_plays_by_month_options.series = getGraphVisibility(hc_plays_by_month_options.chart.renderTo, data.series);
|
||||
var hc_plays_by_month = new Highcharts.Chart(hc_plays_by_month_options);
|
||||
}
|
||||
});
|
||||
|
||||
$('#graph-tabs a[href="#tabs-3"]').tab('show')
|
||||
}
|
||||
|
||||
// Set initial state
|
||||
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); }
|
||||
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');
|
||||
setLocalStorage('graph_tab', current_tab.replace('#',''));
|
||||
loadGraphsTab1(current_day_range, yaxis);
|
||||
$.post('set_graph_config', { graph_tab: current_tab.replace('#','') });
|
||||
})
|
||||
});
|
||||
|
||||
// Tab2 opened
|
||||
$('#graph-tabs a[href="#tabs-2"]').on('shown.bs.tab', function (e) {
|
||||
e.preventDefault();
|
||||
current_tab = $(this).attr('href');
|
||||
setLocalStorage('graph_tab', current_tab.replace('#',''));
|
||||
loadGraphsTab2(current_day_range, yaxis);
|
||||
$.post('set_graph_config', { graph_tab: current_tab.replace('#','') });
|
||||
})
|
||||
});
|
||||
|
||||
// Tab3 opened
|
||||
$('#graph-tabs a[href="#tabs-3"]').on('shown.bs.tab', function (e) {
|
||||
e.preventDefault();
|
||||
current_tab = $(this).attr('href');
|
||||
setLocalStorage('graph_tab', current_tab.replace('#',''));
|
||||
loadGraphsTab3(current_month_range, yaxis);
|
||||
$.post('set_graph_config', { graph_tab: current_tab.replace('#','') });
|
||||
})
|
||||
});
|
||||
|
||||
// Date range changed
|
||||
$('#graph-days').tooltip({ container: 'body', placement: 'top', html: true });
|
||||
$('#graph-days').on('change', function() {
|
||||
forceMinMax($(this));
|
||||
current_day_range = $(this).val();
|
||||
if (current_tab == '#tabs-1') { loadGraphsTab1(current_day_range, yaxis); }
|
||||
if (current_tab == '#tabs-2') { loadGraphsTab2(current_day_range, yaxis); }
|
||||
setLocalStorage('graph_days', current_day_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);
|
||||
$.post('set_graph_config', { graph_days: current_day_range });
|
||||
});
|
||||
|
||||
// Month range changed
|
||||
@@ -607,26 +605,26 @@
|
||||
$('#graph-months').on('change', function() {
|
||||
forceMinMax($(this));
|
||||
current_month_range = $(this).val();
|
||||
if (current_tab == '#tabs-3') { loadGraphsTab3(current_month_range, yaxis); }
|
||||
setLocalStorage('graph_months', current_month_range);
|
||||
if (current_tab === '#tabs-3') { loadGraphsTab3(current_month_range, yaxis); }
|
||||
$('.months').html(current_month_range);
|
||||
$.post('set_graph_config', { graph_months: current_month_range });
|
||||
});
|
||||
|
||||
// User changed
|
||||
$('#graph-user').on('change', function() {
|
||||
selected_user_id = $(this).val() || null;
|
||||
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); }
|
||||
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_day_range, yaxis); }
|
||||
if (current_tab == '#tabs-2') { loadGraphsTab2(current_day_range, yaxis); }
|
||||
if (current_tab == '#tabs-3') { loadGraphsTab3(current_month_range, yaxis); }
|
||||
$.post('set_graph_config', { graph_type: yaxis });
|
||||
setLocalStorage('graph_type', 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); }
|
||||
});
|
||||
|
||||
function setGraphFormat(type) {
|
||||
|
@@ -32,17 +32,17 @@
|
||||
</div>
|
||||
% endif
|
||||
<div class="btn-group" data-toggle="buttons" id="media_type-selection">
|
||||
<label class="btn btn-dark active">
|
||||
<input type="radio" name="media_type-filter" id="history-all" value="" autocomplete="off"> All
|
||||
<label class="btn btn-dark">
|
||||
<input type="radio" name="media_type-filter" id="history-all" value="all" autocomplete="off"> All
|
||||
</label>
|
||||
<label class="btn btn-dark">
|
||||
<input type="radio" name="media_type-filter" id="history-movies" value="movie" autocomplete="off"> Movies
|
||||
<input type="radio" name="media_type-filter" id="history-movie" value="movie" autocomplete="off"> Movies
|
||||
</label>
|
||||
<label class="btn btn-dark">
|
||||
<input type="radio" name="media_type-filter" id="history-tv_shows" value="episode" autocomplete="off"> TV Shows
|
||||
<input type="radio" name="media_type-filter" id="history-episode" value="episode" autocomplete="off"> TV Shows
|
||||
</label>
|
||||
<label class="btn btn-dark">
|
||||
<input type="radio" name="media_type-filter" id="history-music" value="track" autocomplete="off"> Music
|
||||
<input type="radio" name="media_type-filter" id="history-track" value="track" autocomplete="off"> Music
|
||||
</label>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
@@ -154,6 +154,7 @@
|
||||
selected_filter = $('input[name=media_type-filter]:checked', '#media_type-selection');
|
||||
$(selected_filter).closest('label').addClass('active');
|
||||
media_type = $(selected_filter).val();
|
||||
setLocalStorage('history_media_type', media_type);
|
||||
history_table.draw();
|
||||
});
|
||||
|
||||
@@ -163,8 +164,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
var media_type = null;
|
||||
var media_type = getLocalStorage('history_media_type', 'all');
|
||||
var selected_user_id = "${_session['user_group']}" == "admin" ? null : "${_session['user_id']}";
|
||||
|
||||
$('#history-' + media_type).prop('checked', true);
|
||||
$('#history-' + media_type).closest('label').addClass('active');
|
||||
|
||||
loadHistoryTable(media_type, selected_user_id);
|
||||
|
||||
% if _session['user_group'] == 'admin':
|
||||
|
@@ -44,25 +44,16 @@
|
||||
<h3 class="pull-left">Watch Statistics</h3>
|
||||
<div class="button-bar">
|
||||
<div class="btn-group pull-left" data-toggle="buttons" id="watch-stats-toggles" style="margin-right: 3px">
|
||||
% if config['home_stats_type'] == 0:
|
||||
<label class="btn btn-dark active">
|
||||
<input type="radio" class="watched-stats-toggle" name="watched-stats-type" id="watched-stats-plays" value="0" autocomplete="off" checked> Play Count
|
||||
<label class="btn btn-dark">
|
||||
<input type="radio" class="watched-stats-toggle" name="watched-stats-type" id="watched-stats-plays" value="plays" autocomplete="off"> Play Count
|
||||
</label>
|
||||
<label class="btn btn-dark">
|
||||
<input type="radio" class="watched-stats-toggle" name="watched-stats-type" id="watched-stats-duration" value="1" autocomplete="off"> Play Duration
|
||||
<input type="radio" class="watched-stats-toggle" name="watched-stats-type" id="watched-stats-duration" value="duration" autocomplete="off"> Play Duration
|
||||
</label>
|
||||
% else:
|
||||
<label class="btn btn-dark">
|
||||
<input type="radio" class="watched-stats-toggle" name="watched-stats-type" id="watched-stats-plays" value="0" autocomplete="off"> Play Count
|
||||
</label>
|
||||
<label class="btn btn-dark active">
|
||||
<input type="radio" class="watched-stats-toggle" name="watched-stats-type" id="watched-stats-duration" value="1" autocomplete="off" checked> Play Duration
|
||||
</label>
|
||||
% endif
|
||||
</div>
|
||||
<div class="input-group pull-left" style="width: 1px; margin-right: 3px" id="watched-stats-days-selection">
|
||||
<span class="input-group-addon btn-dark inactive">Last</span>
|
||||
<input type="number" class="form-control number-input" name="watched-stats-days" id="watched-stats-days" value="${config['home_stats_length']}" min="1" data-default="30" data-toggle="tooltip" title="Min: 1 day" />
|
||||
<input type="number" class="form-control number-input" name="watched-stats-days" id="watched-stats-days" value="30" min="1" data-default="30" data-toggle="tooltip" title="Min: 1 day" />
|
||||
<span class="input-group-addon btn-dark inactive">days</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -111,8 +102,8 @@
|
||||
</ul>
|
||||
<div class="button-bar">
|
||||
<div class="btn-group pull-left" data-toggle="buttons" id="recently-added-toggles" style="margin-right: 3px">
|
||||
<label class="btn btn-dark active" id="recently-added-label-all">
|
||||
<input type="radio" name="recently-added-toggle" id="recently-added-toggle-all" value="" autocomplete="off"> All
|
||||
<label class="btn btn-dark" id="recently-added-label-all">
|
||||
<input type="radio" name="recently-added-toggle" id="recently-added-toggle-all" value="all" autocomplete="off"> All
|
||||
</label>
|
||||
<label class="btn btn-dark" id="recently-added-label-movies">
|
||||
<input type="radio" name="recently-added-toggle" id="recently-added-toggle-movie" value="movie" autocomplete="off"> Movies
|
||||
@@ -121,11 +112,14 @@
|
||||
<input type="radio" name="recently-added-toggle" id="recently-added-toggle-show" value="show" autocomplete="off"> TV Shows
|
||||
</label>
|
||||
<label class="btn btn-dark" id="recently-added-label-music">
|
||||
<input type="radio" name="recently-added-toggle" id="recently-added-toggle-music" value="artist" autocomplete="off"> Music
|
||||
<input type="radio" name="recently-added-toggle" id="recently-added-toggle-artist" value="artist" autocomplete="off"> Music
|
||||
</label>
|
||||
<label class="btn btn-dark" id="recently-added-label-other_video">
|
||||
<input type="radio" name="recently-added-toggle" id="recently-added-toggle-other_video" value="other_video" autocomplete="off"> Videos
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-group pull-left" style="width: 1px;" id="recently-added-count-selection">
|
||||
<input type="number" class="form-control number-input" name="recently-added-count" id="recently-added-count" value="${config['home_stats_recently_added_count']}" min="1" max="50" data-default="50" data-toggle="tooltip" title="Min: 1 item<br>Max: 50 items" />
|
||||
<input type="number" class="form-control number-input" name="recently-added-count" id="recently-added-count" value="50" min="1" max="50" data-default="50" data-toggle="tooltip" title="Min: 1 item<br>Max: 50 items" />
|
||||
<span class="input-group-addon btn-dark inactive">items</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -724,20 +718,25 @@
|
||||
});
|
||||
}
|
||||
|
||||
var time_range = $('#watched-stats-days').val();
|
||||
var stats_type = $('input[name=watched-stats-type]:checked', '#watch-stats-toggles').val();
|
||||
var stats_type = getLocalStorage('home_stats_type', 'plays');
|
||||
var time_range = getLocalStorage('home_stats_days', 30);
|
||||
|
||||
$('#watched-stats-' + stats_type).prop('checked', true);
|
||||
$('#watched-stats-' + stats_type).closest('label').addClass('active');
|
||||
$('#watched-stats-days').val(time_range);
|
||||
|
||||
getHomeStats(time_range, stats_type);
|
||||
|
||||
$('input[name=watched-stats-type]').change(function () {
|
||||
stats_type = $(this).filter(':checked').val();
|
||||
setLocalStorage('home_stats_type', stats_type);
|
||||
getHomeStats(time_range, stats_type);
|
||||
$.post('set_home_stats_config', { stats_type: stats_type });
|
||||
});
|
||||
$('#watched-stats-days').change(function () {
|
||||
forceMinMax($(this));
|
||||
time_range = $(this).val();
|
||||
setLocalStorage('home_stats_days', time_range);
|
||||
getHomeStats(time_range, stats_type);
|
||||
$.post('set_home_stats_config', { time_range: time_range });
|
||||
});
|
||||
|
||||
$('#watched-stats-days').tooltip({ container: 'body', placement: 'top', html: true });
|
||||
@@ -771,7 +770,7 @@
|
||||
async: true,
|
||||
data: {
|
||||
count: recently_added_count,
|
||||
type: recently_added_type
|
||||
media_type: recently_added_type
|
||||
},
|
||||
complete: function (xhr, status) {
|
||||
$("#recentlyAdded").html(xhr.responseText);
|
||||
@@ -780,8 +779,14 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
var recently_added_count = $('#recently-added-count').val();
|
||||
var recently_added_type = '';
|
||||
|
||||
var recently_added_count = getLocalStorage('home_stats_recently_added_count', 50);
|
||||
var recently_added_type = getLocalStorage('home_stats_recently_added_type', 'all');;
|
||||
|
||||
$('#recently-added-toggle-' + recently_added_type).prop('checked', true);
|
||||
$('#recently-added-toggle-' + recently_added_type).closest('label').addClass('active');
|
||||
$('#recently-added-count').val(recently_added_count);
|
||||
|
||||
recentlyAdded(recently_added_count, recently_added_type);
|
||||
|
||||
function highlightAddedScrollerButton() {
|
||||
@@ -835,6 +840,7 @@
|
||||
$(selected_filter).closest('label').addClass('active');
|
||||
recently_added_type = $(selected_filter).val();
|
||||
resetScroller();
|
||||
setLocalStorage('home_stats_recently_added_type', recently_added_type);
|
||||
recentlyAdded(recently_added_count, recently_added_type);
|
||||
});
|
||||
|
||||
@@ -842,8 +848,8 @@
|
||||
forceMinMax($(this));
|
||||
recently_added_count = $(this).val();
|
||||
resetScroller();
|
||||
setLocalStorage('home_stats_recently_added_count', recently_added_count);
|
||||
recentlyAdded(recently_added_count, recently_added_type);
|
||||
$.post('set_home_stats_config', { recently_added_count: recently_added_count });
|
||||
});
|
||||
|
||||
$('#recently-added-count').tooltip({ container: 'body', placement: 'top', html: true });
|
||||
|
@@ -190,12 +190,12 @@ DOCUMENTATION :: END
|
||||
<li>
|
||||
<a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}">
|
||||
<div class="item-children-poster">
|
||||
<div class="item-children-poster-face cover-item style="background-image: url(pms_image_proxy?img=${child['thumb']}&width=300&height=300&fallback=cover);"></div>
|
||||
<div class="item-children-poster-face cover-item" style="background-image: url(pms_image_proxy?img=${child['thumb']}&width=300&height=300&fallback=cover);"></div>
|
||||
% if _session['user_group'] == 'admin':
|
||||
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
|
||||
% endif
|
||||
</div>
|
||||
<div class="item-children-instance-text-wrapper album-item">
|
||||
<div class="item-children-instance-text-wrapper cover-item">
|
||||
<h3 title="${child['title']}">${child['title']}</h3>
|
||||
</div>
|
||||
</a>
|
||||
@@ -219,7 +219,7 @@ DOCUMENTATION :: END
|
||||
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
|
||||
% endif
|
||||
</div>
|
||||
<div class="item-children-instance-text-wrapper album-item">
|
||||
<div class="item-children-instance-text-wrapper cover-item">
|
||||
<h3 title="${child['parent_title']}">${child['parent_title']}</h3>
|
||||
<h3 title="${child['title']}">${child['title']}</h3>
|
||||
</div>
|
||||
@@ -246,11 +246,11 @@ DOCUMENTATION :: END
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% if _session['user_group'] == 'admin':
|
||||
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
|
||||
% endif
|
||||
</div>
|
||||
% if _session['user_group'] == 'admin':
|
||||
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
|
||||
% endif
|
||||
<div class="item-children-instance-text-wrapper album-item">
|
||||
<div class="item-children-instance-text-wrapper cover-item">
|
||||
<h3 title="${child['original_title'] or child['grandparent_title']}">${child['original_title'] or child['grandparent_title']}</h3>
|
||||
<h3 title="${child['title']}">${child['title']}</h3>
|
||||
<h3 title="${child['parent_title']}" class="text-muted">${child['parent_title']}</h3>
|
||||
|
@@ -2,7 +2,7 @@ var hc_plays_by_day_options = {
|
||||
chart: {
|
||||
type: 'line',
|
||||
backgroundColor: 'rgba(0,0,0,0)',
|
||||
renderTo: 'chart_div_plays_by_day'
|
||||
renderTo: 'graph_plays_by_day'
|
||||
},
|
||||
title: {
|
||||
text: ''
|
||||
@@ -32,6 +32,11 @@ var hc_plays_by_day_options = {
|
||||
selectHandler(this.category, this.series.name);
|
||||
}
|
||||
}
|
||||
},
|
||||
events: {
|
||||
legendItemClick: function() {
|
||||
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -2,17 +2,11 @@ var hc_plays_by_dayofweek_options = {
|
||||
chart: {
|
||||
type: 'column',
|
||||
backgroundColor: 'rgba(0,0,0,0)',
|
||||
renderTo: 'chart_div_plays_by_dayofweek'
|
||||
renderTo: 'graph_plays_by_dayofweek'
|
||||
},
|
||||
title: {
|
||||
text: ''
|
||||
},
|
||||
plotOptions: {
|
||||
column: {
|
||||
pointPadding: 0.2,
|
||||
borderWidth: 0
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
enabled: true,
|
||||
itemStyle: {
|
||||
@@ -56,14 +50,21 @@ var hc_plays_by_dayofweek_options = {
|
||||
},
|
||||
plotOptions: {
|
||||
column: {
|
||||
borderWidth: 0,
|
||||
stacking: 'normal',
|
||||
borderWidth: '0',
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
style: {
|
||||
color: '#000'
|
||||
}
|
||||
}
|
||||
},
|
||||
series: {
|
||||
events: {
|
||||
legendItemClick: function () {
|
||||
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
|
@@ -2,17 +2,11 @@ var hc_plays_by_hourofday_options = {
|
||||
chart: {
|
||||
type: 'column',
|
||||
backgroundColor: 'rgba(0,0,0,0)',
|
||||
renderTo: 'chart_div_plays_by_hourofday'
|
||||
renderTo: 'graph_plays_by_hourofday'
|
||||
},
|
||||
title: {
|
||||
text: ''
|
||||
},
|
||||
plotOptions: {
|
||||
column: {
|
||||
pointPadding: 0.2,
|
||||
borderWidth: 0
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
enabled: true,
|
||||
itemStyle: {
|
||||
@@ -56,14 +50,21 @@ var hc_plays_by_hourofday_options = {
|
||||
},
|
||||
plotOptions: {
|
||||
column: {
|
||||
borderWidth: 0,
|
||||
stacking: 'normal',
|
||||
borderWidth: '0',
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
style: {
|
||||
color: '#000'
|
||||
}
|
||||
}
|
||||
},
|
||||
series: {
|
||||
events: {
|
||||
legendItemClick: function () {
|
||||
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
|
@@ -2,7 +2,7 @@ var hc_plays_by_month_options = {
|
||||
chart: {
|
||||
type: 'column',
|
||||
backgroundColor: 'rgba(0,0,0,0)',
|
||||
renderTo: 'chart_div_plays_by_month'
|
||||
renderTo: 'graph_plays_by_month'
|
||||
},
|
||||
title: {
|
||||
text: ''
|
||||
@@ -50,14 +50,21 @@ var hc_plays_by_month_options = {
|
||||
},
|
||||
plotOptions: {
|
||||
column: {
|
||||
borderWidth: 0,
|
||||
stacking: 'normal',
|
||||
borderWidth: '0',
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
style: {
|
||||
color: '#000'
|
||||
}
|
||||
}
|
||||
},
|
||||
series: {
|
||||
events: {
|
||||
legendItemClick: function () {
|
||||
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
|
@@ -2,17 +2,11 @@ var hc_plays_by_platform_options = {
|
||||
chart: {
|
||||
type: 'column',
|
||||
backgroundColor: 'rgba(0,0,0,0)',
|
||||
renderTo: 'chart_div_plays_by_platform'
|
||||
renderTo: 'graph_plays_by_platform'
|
||||
},
|
||||
title: {
|
||||
text: ''
|
||||
},
|
||||
plotOptions: {
|
||||
column: {
|
||||
pointPadding: 0.2,
|
||||
borderWidth: 0
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
enabled: true,
|
||||
itemStyle: {
|
||||
@@ -56,14 +50,21 @@ var hc_plays_by_platform_options = {
|
||||
},
|
||||
plotOptions: {
|
||||
column: {
|
||||
borderWidth: 0,
|
||||
stacking: 'normal',
|
||||
borderWidth: '0',
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
style: {
|
||||
color: '#000'
|
||||
}
|
||||
}
|
||||
},
|
||||
series: {
|
||||
events: {
|
||||
legendItemClick: function () {
|
||||
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
|
@@ -2,17 +2,11 @@ var hc_plays_by_platform_by_stream_type_options = {
|
||||
chart: {
|
||||
type: 'column',
|
||||
backgroundColor: 'rgba(0,0,0,0)',
|
||||
renderTo: 'chart_div_plays_by_platform_by_stream_type'
|
||||
renderTo: 'graph_plays_by_platform_by_stream_type'
|
||||
},
|
||||
title: {
|
||||
text: ''
|
||||
},
|
||||
plotOptions: {
|
||||
column: {
|
||||
pointPadding: 0.2,
|
||||
borderWidth: 0
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
enabled: true,
|
||||
itemStyle: {
|
||||
@@ -56,14 +50,21 @@ var hc_plays_by_platform_by_stream_type_options = {
|
||||
},
|
||||
plotOptions: {
|
||||
column: {
|
||||
borderWidth: 0,
|
||||
stacking: 'normal',
|
||||
borderWidth: '0',
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
style: {
|
||||
color: '#000'
|
||||
}
|
||||
}
|
||||
},
|
||||
series: {
|
||||
events: {
|
||||
legendItemClick: function () {
|
||||
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
|
@@ -2,17 +2,11 @@ var hc_plays_by_source_resolution_options = {
|
||||
chart: {
|
||||
type: 'column',
|
||||
backgroundColor: 'rgba(0,0,0,0)',
|
||||
renderTo: 'chart_div_plays_by_source_resolution'
|
||||
renderTo: 'graph_plays_by_source_resolution'
|
||||
},
|
||||
title: {
|
||||
text: ''
|
||||
},
|
||||
plotOptions: {
|
||||
column: {
|
||||
pointPadding: 0.2,
|
||||
borderWidth: 0
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
enabled: true,
|
||||
itemStyle: {
|
||||
@@ -56,14 +50,21 @@ var hc_plays_by_source_resolution_options = {
|
||||
},
|
||||
plotOptions: {
|
||||
column: {
|
||||
borderWidth: 0,
|
||||
stacking: 'normal',
|
||||
borderWidth: '0',
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
style: {
|
||||
color: '#000'
|
||||
}
|
||||
}
|
||||
},
|
||||
series: {
|
||||
events: {
|
||||
legendItemClick: function () {
|
||||
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
|
@@ -2,17 +2,11 @@ var hc_plays_by_stream_resolution_options = {
|
||||
chart: {
|
||||
type: 'column',
|
||||
backgroundColor: 'rgba(0,0,0,0)',
|
||||
renderTo: 'chart_div_plays_by_stream_resolution'
|
||||
renderTo: 'graph_plays_by_stream_resolution'
|
||||
},
|
||||
title: {
|
||||
text: ''
|
||||
},
|
||||
plotOptions: {
|
||||
column: {
|
||||
pointPadding: 0.2,
|
||||
borderWidth: 0
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
enabled: true,
|
||||
itemStyle: {
|
||||
@@ -56,14 +50,21 @@ var hc_plays_by_stream_resolution_options = {
|
||||
},
|
||||
plotOptions: {
|
||||
column: {
|
||||
borderWidth: 0,
|
||||
stacking: 'normal',
|
||||
borderWidth: '0',
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
style: {
|
||||
color: '#000'
|
||||
}
|
||||
}
|
||||
},
|
||||
series: {
|
||||
events: {
|
||||
legendItemClick: function () {
|
||||
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
|
@@ -2,7 +2,7 @@ var hc_plays_by_stream_type_options = {
|
||||
chart: {
|
||||
type: 'line',
|
||||
backgroundColor: 'rgba(0,0,0,0)',
|
||||
renderTo: 'chart_div_plays_by_stream_type'
|
||||
renderTo: 'graph_plays_by_stream_type'
|
||||
},
|
||||
title: {
|
||||
text: ''
|
||||
@@ -32,6 +32,11 @@ var hc_plays_by_stream_type_options = {
|
||||
selectHandler(this.category, this.series.name);
|
||||
}
|
||||
}
|
||||
},
|
||||
events: {
|
||||
legendItemClick: function() {
|
||||
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -2,17 +2,11 @@ var hc_plays_by_user_options = {
|
||||
chart: {
|
||||
type: 'column',
|
||||
backgroundColor: 'rgba(0,0,0,0)',
|
||||
renderTo: 'chart_div_plays_by_user'
|
||||
renderTo: 'graph_plays_by_user'
|
||||
},
|
||||
title: {
|
||||
text: ''
|
||||
},
|
||||
plotOptions: {
|
||||
column: {
|
||||
pointPadding: 0.2,
|
||||
borderWidth: 0
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
enabled: true,
|
||||
itemStyle: {
|
||||
@@ -56,14 +50,21 @@ var hc_plays_by_user_options = {
|
||||
},
|
||||
plotOptions: {
|
||||
column: {
|
||||
borderWidth: 0,
|
||||
stacking: 'normal',
|
||||
borderWidth: '0',
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
style: {
|
||||
color: '#000'
|
||||
}
|
||||
}
|
||||
},
|
||||
series: {
|
||||
events: {
|
||||
legendItemClick: function () {
|
||||
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
|
@@ -2,17 +2,11 @@ var hc_plays_by_user_by_stream_type_options = {
|
||||
chart: {
|
||||
type: 'column',
|
||||
backgroundColor: 'rgba(0,0,0,0)',
|
||||
renderTo: 'chart_div_plays_by_user_by_stream_type'
|
||||
renderTo: 'graph_plays_by_user_by_stream_type'
|
||||
},
|
||||
title: {
|
||||
text: ''
|
||||
},
|
||||
plotOptions: {
|
||||
column: {
|
||||
pointPadding: 0.2,
|
||||
borderWidth: 0
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
enabled: true,
|
||||
itemStyle: {
|
||||
@@ -56,14 +50,21 @@ var hc_plays_by_user_by_stream_type_options = {
|
||||
},
|
||||
plotOptions: {
|
||||
column: {
|
||||
borderWidth: 0,
|
||||
stacking: 'normal',
|
||||
borderWidth: '0',
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
style: {
|
||||
color: '#000'
|
||||
}
|
||||
}
|
||||
},
|
||||
series: {
|
||||
events: {
|
||||
legendItemClick: function () {
|
||||
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
|
@@ -1,3 +1,29 @@
|
||||
var p = {
|
||||
name: 'Unknown',
|
||||
version: 'Unknown',
|
||||
os: 'Unknown'
|
||||
};
|
||||
if (typeof platform !== 'undefined') {
|
||||
p.name = platform.name;
|
||||
p.version = platform.version;
|
||||
p.os = platform.os.toString();
|
||||
}
|
||||
|
||||
if (['IE', 'Microsoft Edge', 'IE Mobile'].indexOf(p.name) > -1) {
|
||||
$('body').prepend('<div id="browser-warning"><i class="fa fa-exclamation-circle"></i> ' +
|
||||
'Tautulli does not support Internet Explorer or Microsoft Edge! ' +
|
||||
'Please use a different browser such as Chrome or Firefox.</div>');
|
||||
var offset = $('#browser-warning').height();
|
||||
var navbar = $('.navbar-fixed-top');
|
||||
if (navbar.length) {
|
||||
navbar.offset({top: navbar.offset().top + offset});
|
||||
}
|
||||
var container = $('.body-container');
|
||||
if (container.length) {
|
||||
container.offset({top: container.offset().top + offset});
|
||||
}
|
||||
}
|
||||
|
||||
function initConfigCheckbox(elem, toggleElem, reverse) {
|
||||
toggleElem = (toggleElem === undefined) ? null : toggleElem;
|
||||
reverse = (reverse === undefined) ? false : reverse;
|
||||
@@ -491,14 +517,28 @@ function PopupCenter(url, title, w, h) {
|
||||
return newWindow;
|
||||
}
|
||||
|
||||
if (!localStorage.getItem('Tautulli_ClientId')) {
|
||||
localStorage.setItem('Tautulli_ClientId', uuidv4());
|
||||
function setLocalStorage(key, value) {
|
||||
localStorage.setItem(key, value);
|
||||
}
|
||||
function getLocalStorage(key, default_value) {
|
||||
var value = localStorage.getItem(key);
|
||||
if (value !== null) {
|
||||
return value
|
||||
} else if (default_value !== undefined) {
|
||||
setLocalStorage(key, default_value);
|
||||
return default_value
|
||||
}
|
||||
}
|
||||
|
||||
if (!getLocalStorage('Tautulli_ClientId')) {
|
||||
setLocalStorage('Tautulli_ClientId', uuidv4());
|
||||
}
|
||||
|
||||
function uuidv4() {
|
||||
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
|
||||
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
||||
)
|
||||
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, function(c) {
|
||||
var cryptoObj = window.crypto || window.msCrypto; // for IE 11
|
||||
return (c ^ cryptoObj.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
||||
});
|
||||
}
|
||||
|
||||
var x_plex_headers = {
|
||||
@@ -506,10 +546,10 @@ var x_plex_headers = {
|
||||
'X-Plex-Product': 'Tautulli',
|
||||
'X-Plex-Version': 'Plex OAuth',
|
||||
'X-Plex-Client-Identifier': localStorage.getItem('Tautulli_ClientId'),
|
||||
'X-Plex-Platform': platform.name,
|
||||
'X-Plex-Platform-Version': platform.version,
|
||||
'X-Plex-Device': platform.os.toString(),
|
||||
'X-Plex-Device-Name': platform.name
|
||||
'X-Plex-Platform': p.name,
|
||||
'X-Plex-Platform-Version': p.version,
|
||||
'X-Plex-Device': p.os,
|
||||
'X-Plex-Device-Name': p.name
|
||||
};
|
||||
|
||||
var plex_oauth_window = null;
|
||||
@@ -568,7 +608,6 @@ getPlexOAuthPin = function () {
|
||||
type: 'POST',
|
||||
headers: x_plex_headers,
|
||||
success: function(data) {
|
||||
plex_oauth_window.location = 'https://app.plex.tv/auth/#!?clientID=' + x_plex_headers['X-Plex-Client-Identifier'] + '&code=' + data.code;
|
||||
deferred.resolve({pin: data.id, code: data.code});
|
||||
},
|
||||
error: function() {
|
||||
@@ -585,7 +624,6 @@ function PlexOAuth(success, error, pre) {
|
||||
if (typeof pre === "function") {
|
||||
pre()
|
||||
}
|
||||
clearTimeout(polling);
|
||||
closePlexOAuthWindow();
|
||||
plex_oauth_window = PopupCenter('', 'Plex-OAuth', 600, 700);
|
||||
$(plex_oauth_window.document.body).html(plex_oauth_loader);
|
||||
@@ -593,40 +631,38 @@ function PlexOAuth(success, error, pre) {
|
||||
getPlexOAuthPin().then(function (data) {
|
||||
const pin = data.pin;
|
||||
const code = data.code;
|
||||
var keep_polling = true;
|
||||
|
||||
plex_oauth_window.location = 'https://app.plex.tv/auth/#!?clientID=' + x_plex_headers['X-Plex-Client-Identifier'] + '&code=' + code;
|
||||
polling = pin;
|
||||
|
||||
(function poll() {
|
||||
polling = setTimeout(function () {
|
||||
$.ajax({
|
||||
url: 'https://plex.tv/api/v2/pins/' + pin,
|
||||
type: 'GET',
|
||||
headers: x_plex_headers,
|
||||
success: function (data) {
|
||||
if (data.authToken){
|
||||
keep_polling = false;
|
||||
closePlexOAuthWindow();
|
||||
if (typeof success === "function") {
|
||||
success(data.authToken)
|
||||
}
|
||||
$.ajax({
|
||||
url: 'https://plex.tv/api/v2/pins/' + pin,
|
||||
type: 'GET',
|
||||
headers: x_plex_headers,
|
||||
success: function (data) {
|
||||
if (data.authToken){
|
||||
closePlexOAuthWindow();
|
||||
if (typeof success === "function") {
|
||||
success(data.authToken)
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
keep_polling = false;
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
if (textStatus !== "timeout") {
|
||||
closePlexOAuthWindow();
|
||||
if (typeof error === "function") {
|
||||
error()
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
if (keep_polling){
|
||||
poll();
|
||||
} else {
|
||||
clearTimeout(polling);
|
||||
}
|
||||
},
|
||||
timeout: 1000
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
if (!plex_oauth_window.closed && polling === pin){
|
||||
setTimeout(function() {poll()}, 1000);
|
||||
}
|
||||
},
|
||||
timeout: 10000
|
||||
});
|
||||
})();
|
||||
}, function () {
|
||||
closePlexOAuthWindow();
|
||||
|
@@ -20,6 +20,24 @@
|
||||
</div>
|
||||
<p class="help-block">Optional: Enter a friendly name for this device. Leave blank for default.</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="friendly_name">Device Token</label>
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<input type="text" class="form-control" id="device_token" value="${device['device_token']}" size="30" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<p class="help-block">Your app device token.</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="friendly_name">OneSignal Device ID</label>
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<input type="text" class="form-control" id="device_id" value="${device['device_id']}" size="30" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<p class="help-block">Your OneSignal device ID for notifications.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@@ -7,6 +7,9 @@
|
||||
from plexpy import common, notifiers, newsletters
|
||||
from plexpy.helpers import anon_url, checked
|
||||
|
||||
docker_setting = 'disabled' if plexpy.DOCKER else ''
|
||||
docker_msg = '<span class="docker-setting small">(Controlled by Docker Container)</span>' if plexpy.DOCKER else ''
|
||||
|
||||
available_notification_agents = sorted(notifiers.available_notification_agents(), key=lambda k: k['label'].lower())
|
||||
available_newsletter_agents = sorted(newsletters.available_newsletter_agents(), key=lambda k: k['label'].lower())
|
||||
%>
|
||||
@@ -230,12 +233,12 @@
|
||||
|
||||
% if plexpy.INSTALL_TYPE == 'git':
|
||||
<div class="form-group advanced-setting">
|
||||
<label for="git_branch">Git Remote / Branch</label>
|
||||
<label for="git_branch">Git Remote / Branch</label> ${docker_msg | n}
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="input-group git-group">
|
||||
<input type="text" class="form-control" id="git_remote" name="git_remote" value="${config['git_remote']}" data-parsley-trigger="change">
|
||||
<select class="form-control" id="git_branch" name="git_branch">
|
||||
<input type="text" class="form-control" id="git_remote" name="git_remote" value="${config['git_remote']}" data-parsley-trigger="change" ${docker_setting}>
|
||||
<select class="form-control" id="git_branch" name="git_branch" ${docker_setting}>
|
||||
<% branches = ('master', 'beta', 'nightly') %>
|
||||
% for branch in branches:
|
||||
<option value="${branch}" ${'selected' if config['git_branch'] == branch else ''}>${branch}</option>
|
||||
@@ -245,7 +248,7 @@
|
||||
% endif
|
||||
</select>
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-form" type="button" id="switch_git_branch">Checkout Branch</button>
|
||||
<button class="btn btn-form" type="button" id="switch_git_branch" ${docker_setting}>Checkout Branch</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -253,10 +256,10 @@
|
||||
<p class="help-block">The git tracking remote and branch (default "origin/master"). Select to switch the git branch (requires restart).</p>
|
||||
</div>
|
||||
<div class="form-group advanced-setting">
|
||||
<label for="git_path">Git Path</label>
|
||||
<label for="git_path">Git Path</label> ${docker_msg | n}
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="git_path" name="git_path" value="${config['git_path']}" size="30">
|
||||
<input type="text" class="form-control" id="git_path" name="git_path" value="${config['git_path']}" size="30" ${docker_setting}>
|
||||
</div>
|
||||
</div>
|
||||
<p class="help-block">Optional: The path to your git environment variable. Leave blank for default.</p>
|
||||
@@ -445,19 +448,19 @@
|
||||
<p class="help-block">Launch browser pointed to Tautulli on startup.</p>
|
||||
</div>
|
||||
<div class="form-group advanced-setting">
|
||||
<label for="http_host">HTTP Host</label>
|
||||
<label for="http_host">HTTP Host</label> ${docker_msg | n}
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control http-settings" id="http_host" name="http_host" value="${config['http_host']}" data-parsley-trigger="change" required>
|
||||
<input type="text" class="form-control http-settings" id="http_host" name="http_host" value="${config['http_host']}" data-parsley-trigger="change" required ${docker_setting}>
|
||||
</div>
|
||||
</div>
|
||||
<p class="help-block">localhost or an IP address to bind the web server to. Default 0.0.0.0 to bind to all interfaces.</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="http_port">HTTP Port</label>
|
||||
<label for="http_port">HTTP Port</label> ${docker_msg | n}
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<input type="text" class="form-control http-settings" data-parsley-type="integer" id="http_port" name="http_port" value="${config['http_port']}" data-parsley-trigger="change" data-parsley-errors-container="#http_port_error" required>
|
||||
<input type="text" class="form-control http-settings" data-parsley-type="integer" id="http_port" name="http_port" value="${config['http_port']}" data-parsley-trigger="change" data-parsley-errors-container="#http_port_error" required ${docker_setting}>
|
||||
</div>
|
||||
<div id="http_port_error" class="alert alert-danger settings-alert" role="alert"></div>
|
||||
</div>
|
||||
@@ -887,7 +890,6 @@
|
||||
<h3>Current Activity Notifications</h3>
|
||||
</div>
|
||||
|
||||
<p class="help-block">Note: Buffer warnings only work on certain Plex clients. Android and Plex Web do not report buffer events accurately or at all.</p>
|
||||
<div class="form-group">
|
||||
<label for="buffer_threshold">Buffer Threshold</label>
|
||||
<div class="row">
|
||||
@@ -896,7 +898,13 @@
|
||||
</div>
|
||||
<div id="buffer_threshold_error" class="alert alert-danger settings-alert" role="alert"></div>
|
||||
</div>
|
||||
<p class="help-block">How many buffer events should we wait before triggering the first warning. Buffer events increment on each monitor ping if play state is buffering. 0 to disable buffer warnings.</p>
|
||||
<p class="help-block">
|
||||
The number of buffer events required before triggering the first notification.
|
||||
Buffer events increment on each incoming websocket message if the play state is buffering.
|
||||
<br>
|
||||
Note: Buffer warnings only work on certain Plex clients. Some clients can send excessive buffer messages or no messages at all.
|
||||
This notification may be unreliable and not indicative of a real problem.
|
||||
</p>
|
||||
</div>
|
||||
<div class="form-group advanced-setting">
|
||||
<label for="buffer_wait">Buffer Wait</label>
|
||||
@@ -1034,10 +1042,10 @@
|
||||
<p class="help-block">Optional: Enter the full path to your custom newsletter templates folder. Leave blank for default.</p>
|
||||
</div>
|
||||
<div class="form-group advanced-setting">
|
||||
<label for="newsletter_dir">Newsletter Output Directory</label>
|
||||
<label for="newsletter_dir">Newsletter Output Directory</label> ${docker_msg | n}
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="newsletter_dir" name="newsletter_dir" value="${config['newsletter_dir']}">
|
||||
<input type="text" class="form-control" id="newsletter_dir" name="newsletter_dir" value="${config['newsletter_dir']}" ${docker_setting}>
|
||||
</div>
|
||||
</div>
|
||||
<p class="help-block">Enter the full path to where newsletter files will be saved.</p>
|
||||
@@ -1233,10 +1241,10 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="log_dir">Log Directory</label>
|
||||
<label for="log_dir">Log Directory</label> ${docker_msg | n}
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control directory-settings" id="log_dir" name="log_dir" value="${config['log_dir']}">
|
||||
<input type="text" class="form-control directory-settings" id="log_dir" name="log_dir" value="${config['log_dir']}" ${docker_setting}>
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-form" type="button" id="clear_logs">Clear Logs</button>
|
||||
</div>
|
||||
@@ -1244,10 +1252,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="backup_dir">Backup Directory</label>
|
||||
<label for="backup_dir">Backup Directory</label> ${docker_msg | n}
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control directory-settings" id="backup_dir" name="backup_dir" value="${config['backup_dir']}">
|
||||
<input type="text" class="form-control directory-settings" id="backup_dir" name="backup_dir" value="${config['backup_dir']}" ${docker_setting}>
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-form" type="button" id="backup_config">Backup Config</button>
|
||||
<button class="btn btn-form" type="button" id="backup_database">Backup Database</button>
|
||||
@@ -1256,10 +1264,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="cache_dir">Cache Directory</label>
|
||||
<label for="cache_dir">Cache Directory</label> ${docker_msg | n}
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control directory-settings" id="cache_dir" name="cache_dir" value="${config['cache_dir']}">
|
||||
<input type="text" class="form-control directory-settings" id="cache_dir" name="cache_dir" value="${config['cache_dir']}" ${docker_setting}>
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-form" type="button" id="clear_cache">Clear All Cache</button>
|
||||
<button class="btn btn-form" type="button" id="clear_image_cache">Clear Image Cache</button>
|
||||
@@ -2084,7 +2092,7 @@ $(document).ready(function() {
|
||||
if (!item.label) {
|
||||
$.extend(item,
|
||||
$(this.revertSettings.$children)
|
||||
.filter('[value=' + item.value + ']').data()
|
||||
.filter('[value="' + item.value + '"]').data()
|
||||
);
|
||||
}
|
||||
var label = item.label || item.value;
|
||||
|
@@ -156,17 +156,17 @@ DOCUMENTATION :: END
|
||||
</div>
|
||||
% endif
|
||||
<div class="btn-group" data-toggle="buttons" id="media_type-selection">
|
||||
<label class="btn btn-dark active">
|
||||
<input type="radio" name="media_type-filter" id="history-all" value="" autocomplete="off"> All
|
||||
<label class="btn btn-dark">
|
||||
<input type="radio" name="media_type-filter" id="history-all" value="all" autocomplete="off"> All
|
||||
</label>
|
||||
<label class="btn btn-dark">
|
||||
<input type="radio" name="media_type-filter" id="history-movies" value="movie" autocomplete="off"> Movies
|
||||
<input type="radio" name="media_type-filter" id="history-movie" value="movie" autocomplete="off"> Movies
|
||||
</label>
|
||||
<label class="btn btn-dark">
|
||||
<input type="radio" name="media_type-filter" id="history-tv_shows" value="episode" autocomplete="off"> TV Shows
|
||||
<input type="radio" name="media_type-filter" id="history-episode" value="episode" autocomplete="off"> TV Shows
|
||||
</label>
|
||||
<label class="btn btn-dark">
|
||||
<input type="radio" name="media_type-filter" id="history-music" value="track" autocomplete="off"> Music
|
||||
<input type="radio" name="media_type-filter" id="history-track" value="track" autocomplete="off"> Music
|
||||
</label>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
@@ -435,6 +435,7 @@ DOCUMENTATION :: END
|
||||
selected_filter = $('input[name=media_type-filter]:checked', '#media_type-selection');
|
||||
$(selected_filter).closest('label').addClass('active');
|
||||
media_type = $(selected_filter).val();
|
||||
setLocalStorage('user_' + user_id + '-history_media_type', media_type);
|
||||
history_table.draw();
|
||||
});
|
||||
}
|
||||
@@ -494,7 +495,9 @@ DOCUMENTATION :: END
|
||||
|
||||
$('a[href="#tabs-history"]').on('shown.bs.tab', function() {
|
||||
if (typeof(history_table) === 'undefined') {
|
||||
var media_type = null;
|
||||
var media_type = getLocalStorage('user_' + user_id + '-history_media_type', 'all');
|
||||
$('#history-' + media_type).prop('checked', true);
|
||||
$('#history-' + media_type).closest('label').addClass('active');
|
||||
loadHistoryTable(media_type);
|
||||
}
|
||||
});
|
||||
|
@@ -90,6 +90,7 @@
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<select class="form-control pms-settings selectize-pms-ip" id="pms_ip_selectize">
|
||||
% if config['pms_identifier']:
|
||||
<option value="${config['pms_ip']}:${config['pms_port']}"
|
||||
data-identifier="${config['pms_identifier']}"
|
||||
data-ip="${config['pms_ip']}"
|
||||
@@ -99,6 +100,7 @@
|
||||
data-is_cloud="${config['pms_is_cloud']}"
|
||||
data-label="${config['pms_name'] or 'Local'}"
|
||||
selected>${config['pms_ip']}</option>
|
||||
% endif
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -336,7 +338,7 @@ $(document).ready(function() {
|
||||
if (!item.label) {
|
||||
$.extend(item,
|
||||
$(this.revertSettings.$children)
|
||||
.filter('[value=' + item.value + ']').data()
|
||||
.filter('[value="' + item.value + '"]').data()
|
||||
);
|
||||
}
|
||||
var label = item.label || item.value;
|
||||
|
@@ -368,6 +368,7 @@
|
||||
line-height: 1.2rem;
|
||||
font-size: 0.9rem;
|
||||
padding: 5px;
|
||||
max-width: 320px;
|
||||
}
|
||||
.card-info-title a {
|
||||
text-decoration: none;
|
||||
@@ -952,6 +953,124 @@
|
||||
</td>
|
||||
</tr>
|
||||
% endif
|
||||
% if recently_added.get('other_video'):
|
||||
<tr>
|
||||
<td class="wrapper" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;box-sizing: border-box;padding: 5px;overflow: auto;">
|
||||
<div class="sub-header-bar" style="margin-left: auto;margin-right: auto;font-size: 30px;text-align: center;width: 200px;border-top: 1px solid #E5A00D;margin-top: 15px;margin-bottom: 25px;"></div>
|
||||
<div class="sub-header-title" style="margin-left: auto;margin-right: auto;font-size: 30px;text-align: center;font-weight: lighter;">
|
||||
<img src="${(base_url_image + 'images/libraries/video.png') if base_url_image else 'https://tautulli.com/images/libraries/video.png'}" class="sub-header-icon" width="30" height="30" style="border: none;-ms-interpolation-mode: bicubic;max-width: 100%;height: 30px;width: 30px;vertical-align: middle;margin-right: 5px;margin-bottom: 5px;"> Recently Added Videos
|
||||
</div>
|
||||
<div class="sub-header-count" style="margin-left: auto;margin-right: auto;font-size: 30px;text-align: center;">
|
||||
<span class="count" style="color: #E5A00D;">${len(recently_added['other_video'])}</span> <span class="count-units" style="color: #aaaaaa;font-size: 20px;text-transform: uppercase;">video${'s' if len(recently_added['other_video']) > 1 else ''}</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;">
|
||||
% for video_a, video_b in grouper(recently_added['other_video'], 2):
|
||||
<tr>
|
||||
<td style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;">
|
||||
<tr>
|
||||
% for video in (video_a, video_b):
|
||||
% if video:
|
||||
% if not video_b:
|
||||
<td align="center" valign="top" class="card-instance pad" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 0 !important;width: 251px !important;min-width: 251px !important;max-width: 251px !important;"></td>
|
||||
% endif
|
||||
<td align="center" valign="top" class="card-instance movie" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 3px;width: 502px;min-width: 502px;max-width: 502px;height: 233px;">
|
||||
<table border="0" cellpadding="0" cellspacing="3" width="100%" class="card-background" style="background-image: url(${(base_url_image + video['art_hash']) if base_url_image else video['art_url']});border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;background-color: #282828;background-position: center;background-size: cover;background-repeat: no-repeat;background-clip: padding-box;border: 1px solid rgba(255,255,255,.1);">
|
||||
<tr>
|
||||
<td class="card-poster-container" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;width: 152px;min-width: 152px;height: 227px;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="card-poster" style="background-image: url(${(base_url_image + video['thumb_hash']) if base_url_image else video['thumb_url']});border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;background-color: #3F4245;background-position: center;background-size: cover;background-repeat: no-repeat;background-clip: padding-box;border: 1px solid rgba(255,255,255,.1);">
|
||||
<tr>
|
||||
<td style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;">
|
||||
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${video['rating_key']}" title="${video['title']}" target="_blank" style="text-decoration: underline;">
|
||||
<img class="card-poster-overlay" src="${base_url_image + 'images/newsletter/view-on-plex-poster.png' if base_url_image else 'https://tautulli.com/images/newsletter/view-on-plex-poster.png'}" width="150" height="225" style="border: none;-ms-interpolation-mode: bicubic;max-width: 100%;display: block;">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="card-info-container" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;padding-left: 4px;text-align: left;height: 227px;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="card-info-container-table" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;height: 100%;">
|
||||
<tr>
|
||||
<td class="card-info-title nowrap" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 0.9rem;vertical-align: top;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;border-bottom: 1px solid rgba(255, 255, 255, .1);line-height: 1.2rem;padding: 5px;max-width: 320px;">
|
||||
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${video['rating_key']}" title="${video['title']}" target="_blank" style="text-decoration: none;color: #ffffff;">${video['title']}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="card-info-body" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 0.75rem;vertical-align: top;padding: 5px;height: 100%;">
|
||||
% if video['tagline']:
|
||||
<p class="nowrap mb5" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-weight: 400;margin: 0;margin-bottom: 5px;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;max-width: 325px;color: #ffffff;">
|
||||
<em>${video['tagline']}</em>
|
||||
</p>
|
||||
% endif
|
||||
<p style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-weight: 400;margin: 0;max-width: 325px;color: #ffffff;">
|
||||
${video['summary'][:450] + (video['summary'][450:] and '...')}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="card-info-footer nowrap" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 0.6rem;vertical-align: top;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;padding-top: 0px;padding-right: 5px;padding-bottom: 5px;padding-left: 5px;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;">
|
||||
<tr>
|
||||
<td class="badge-container" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;max-width: 260px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;">
|
||||
<tr>
|
||||
% if video['year']:
|
||||
<td class="badge" title="${video['year']}" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 11px;vertical-align: middle;display: inline-block;min-width: 10px;margin-right: 4px;padding: 3px 7px;line-height: 1;text-align: center;white-space: nowrap;background-color: rgba(0, 0, 0, .25);border-radius: 2px;text-overflow: ellipsis;overflow: hidden;color: #ffffff;">${video['year']}</td>
|
||||
% endif
|
||||
% if video['duration']:
|
||||
<% duration = int(int(video['duration'])/60000) %>
|
||||
<td class="badge" title="${duration} mins" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 11px;vertical-align: middle;display: inline-block;min-width: 10px;margin-right: 4px;padding: 3px 7px;line-height: 1;text-align: center;white-space: nowrap;background-color: rgba(0, 0, 0, .25);border-radius: 2px;text-overflow: ellipsis;overflow: hidden;color: #ffffff;">${duration} mins</td>
|
||||
% endif
|
||||
% if video['genres']:
|
||||
% for genre in video['genres'][:]:
|
||||
<td class="badge" title="${genre}" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 11px;vertical-align: middle;display: inline-block;min-width: 10px;margin-right: 4px;padding: 3px 7px;line-height: 1;text-align: center;white-space: nowrap;background-color: rgba(0, 0, 0, .25);border-radius: 2px;text-overflow: ellipsis;overflow: hidden;color: #ffffff;">${genre}</td>
|
||||
% endfor
|
||||
% endif
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
% if video['rating']:
|
||||
<% rating = int(round(float(video['rating']) / 2)) %>
|
||||
<td class="star-rating-container" title="${int(float(video['rating'])/0.1)}%" align="right" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;width: 65px;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;">
|
||||
<tr>
|
||||
% for _ in range(rating):
|
||||
<td class="star-rating full" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 0.8rem;vertical-align: bottom;margin-left: 4px;line-height: 1rem;width: 0.5rem;display: inline-block;color: #E5A00D;">★</td>
|
||||
% endfor
|
||||
% for _ in range(5-rating):
|
||||
<td class="star-rating empty" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 0.8rem;vertical-align: bottom;margin-left: 4px;line-height: 1rem;width: 0.5rem;display: inline-block;color: #aaaaaa;">☆</td>
|
||||
% endfor
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
% endif
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
% if not video_b:
|
||||
<td align="center" valign="top" class="card-instance pad" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 0 !important;width: 251px !important;min-width: 251px !important;max-width: 251px !important;"></td>
|
||||
% endif
|
||||
% endif
|
||||
% endfor
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
% endfor
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
% endif
|
||||
<tr>
|
||||
<td class="footer" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;clear: both;margin-top: 10px;text-align: center;width: 100%;">
|
||||
<div class="footer-bar" style="margin-left: auto;margin-right: auto;width: 200px;border-top: 1px solid #E5A00D;margin-top: 25px;"></div>
|
||||
|
@@ -953,6 +953,124 @@
|
||||
</td>
|
||||
</tr>
|
||||
% endif
|
||||
% if recently_added.get('other_video'):
|
||||
<tr>
|
||||
<td class="wrapper">
|
||||
<div class="sub-header-bar"></div>
|
||||
<div class="sub-header-title">
|
||||
<img src="${(base_url_image + 'images/libraries/video.png') if base_url_image else 'https://tautulli.com/images/libraries/video.png'}" class="sub-header-icon" width="30" height="30"/> Recently Added Videos
|
||||
</div>
|
||||
<div class="sub-header-count">
|
||||
<span class="count">${len(recently_added['other_video'])}</span> <span class="count-units">video${'s' if len(recently_added['other_video']) > 1 else ''}</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
% for video_a, video_b in grouper(recently_added['other_video'], 2):
|
||||
<tr>
|
||||
<td>
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
% for video in (video_a, video_b):
|
||||
% if video:
|
||||
% if not video_b:
|
||||
<td align="center" valign="top" class="card-instance pad"></td>
|
||||
% endif
|
||||
<td align="center" valign="top" class="card-instance movie">
|
||||
<table border="0" cellpadding="0" cellspacing="3" width="100%" class="card-background" style="background-image: url(${(base_url_image + video['art_hash']) if base_url_image else video['art_url']});">
|
||||
<tr>
|
||||
<td class="card-poster-container">
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="card-poster" style="background-image: url(${(base_url_image + video['thumb_hash']) if base_url_image else video['thumb_url']})">
|
||||
<tr>
|
||||
<td>
|
||||
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${video['rating_key']}" title="${video['title']}" target="_blank">
|
||||
<img class="card-poster-overlay" src="${base_url_image + 'images/newsletter/view-on-plex-poster.png' if base_url_image else 'https://tautulli.com/images/newsletter/view-on-plex-poster.png'}" width="150" height="225">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="card-info-container">
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="card-info-container-table">
|
||||
<tr>
|
||||
<td class="card-info-title nowrap">
|
||||
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${video['rating_key']}" title="${video['title']}" target="_blank">${video['title']}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="card-info-body">
|
||||
% if video['tagline']:
|
||||
<p class="nowrap mb5">
|
||||
<em>${video['tagline']}</em>
|
||||
</p>
|
||||
% endif
|
||||
<p>
|
||||
${video['summary'][:450] + (video['summary'][450:] and '...')}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="card-info-footer nowrap">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="badge-container">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
% if video['year']:
|
||||
<td class="badge" title="${video['year']}">${video['year']}</td>
|
||||
% endif
|
||||
% if video['duration']:
|
||||
<% duration = int(int(video['duration'])/60000) %>
|
||||
<td class="badge" title="${duration} mins">${duration} mins</td>
|
||||
% endif
|
||||
% if video['genres']:
|
||||
% for genre in video['genres'][:]:
|
||||
<td class="badge" title="${genre}">${genre}</td>
|
||||
% endfor
|
||||
% endif
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
% if video['rating']:
|
||||
<% rating = int(round(float(video['rating']) / 2)) %>
|
||||
<td class="star-rating-container" title="${int(float(video['rating'])/0.1)}%" align="right">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
% for _ in range(rating):
|
||||
<td class="star-rating full">★</td>
|
||||
% endfor
|
||||
% for _ in range(5-rating):
|
||||
<td class="star-rating empty">☆</td>
|
||||
% endfor
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
% endif
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
% if not video_b:
|
||||
<td align="center" valign="top" class="card-instance pad"></td>
|
||||
% endif
|
||||
% endif
|
||||
% endfor
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
% endfor
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
% endif
|
||||
<tr>
|
||||
<td class="footer">
|
||||
<div class="footer-bar"></div>
|
||||
|
0
init-scripts/init.fedora.centos.service
Normal file → Executable file
0
init-scripts/init.fedora.centos.service
Normal file → Executable file
5
init-scripts/init.systemd
Normal file → Executable file
5
init-scripts/init.systemd
Normal file → Executable file
@@ -24,7 +24,8 @@
|
||||
# - The example settings in this file assume that Tautulli is installed to: /opt/Tautulli
|
||||
#
|
||||
# - To create this user and give it ownership of the Tautulli directory:
|
||||
# sudo adduser --system --no-create-home tautulli
|
||||
# Ubuntu/Debian: sudo addgroup tautulli && sudo adduser --system --no-create-home tautulli --ingroup tautulli
|
||||
# CentOS/Fedora: sudo adduser --system --no-create-home tautulli
|
||||
# sudo chown tautulli:tautulli -R /opt/Tautulli
|
||||
#
|
||||
# - Adjust ExecStart= to point to:
|
||||
@@ -51,7 +52,7 @@ ExecStart=/opt/Tautulli/Tautulli.py --config /opt/Tautulli/config.ini --datadir
|
||||
GuessMainPID=no
|
||||
Type=forking
|
||||
User=tautulli
|
||||
Group=tautlli
|
||||
Group=tautulli
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@@ -68,6 +68,7 @@ DAEMON = False
|
||||
CREATEPID = False
|
||||
PIDFILE = None
|
||||
NOFORK = False
|
||||
DOCKER = False
|
||||
|
||||
SCHED = BackgroundScheduler()
|
||||
SCHED_LOCK = threading.Lock()
|
||||
@@ -140,21 +141,13 @@ def initialize(config_file):
|
||||
if not CONFIG.HTTPS_KEY:
|
||||
CONFIG.HTTPS_KEY = os.path.join(DATA_DIR, 'server.key')
|
||||
|
||||
if not CONFIG.LOG_DIR:
|
||||
CONFIG.LOG_DIR = os.path.join(DATA_DIR, 'logs')
|
||||
|
||||
if not os.path.exists(CONFIG.LOG_DIR):
|
||||
try:
|
||||
os.makedirs(CONFIG.LOG_DIR)
|
||||
except OSError:
|
||||
CONFIG.LOG_DIR = None
|
||||
|
||||
if not QUIET:
|
||||
sys.stderr.write("Unable to create the log directory. " \
|
||||
"Logging to screen only.\n")
|
||||
CONFIG.LOG_DIR, log_writable = check_folder_writable(
|
||||
CONFIG.LOG_DIR, os.path.join(DATA_DIR, 'logs'), 'logs')
|
||||
if not log_writable and not QUIET:
|
||||
sys.stderr.write("Unable to create the log directory. Logging to screen only.\n")
|
||||
|
||||
# Start the logger, disable console if needed
|
||||
logger.initLogger(console=not QUIET, log_dir=CONFIG.LOG_DIR,
|
||||
logger.initLogger(console=not QUIET, log_dir=CONFIG.LOG_DIR if log_writable else None,
|
||||
verbose=VERBOSE)
|
||||
|
||||
logger.info(u"Starting Tautulli {}".format(
|
||||
@@ -177,29 +170,12 @@ def initialize(config_file):
|
||||
DB_FILE
|
||||
))
|
||||
|
||||
if not CONFIG.BACKUP_DIR:
|
||||
CONFIG.BACKUP_DIR = os.path.join(DATA_DIR, 'backups')
|
||||
if not os.path.exists(CONFIG.BACKUP_DIR):
|
||||
try:
|
||||
os.makedirs(CONFIG.BACKUP_DIR)
|
||||
except OSError as e:
|
||||
logger.error(u"Could not create backup dir '%s': %s" % (CONFIG.BACKUP_DIR, e))
|
||||
|
||||
if not CONFIG.CACHE_DIR:
|
||||
CONFIG.CACHE_DIR = os.path.join(DATA_DIR, 'cache')
|
||||
if not os.path.exists(CONFIG.CACHE_DIR):
|
||||
try:
|
||||
os.makedirs(CONFIG.CACHE_DIR)
|
||||
except OSError as e:
|
||||
logger.error(u"Could not create cache dir '%s': %s" % (CONFIG.CACHE_DIR, e))
|
||||
|
||||
if not CONFIG.NEWSLETTER_DIR:
|
||||
CONFIG.NEWSLETTER_DIR = os.path.join(DATA_DIR, 'newsletters')
|
||||
if not os.path.exists(CONFIG.NEWSLETTER_DIR):
|
||||
try:
|
||||
os.makedirs(CONFIG.NEWSLETTER_DIR)
|
||||
except OSError as e:
|
||||
logger.error(u"Could not create newsletter dir '%s': %s" % (CONFIG.NEWSLETTER_DIR, e))
|
||||
CONFIG.BACKUP_DIR, _ = check_folder_writable(
|
||||
CONFIG.BACKUP_DIR, os.path.join(DATA_DIR, 'backups'), 'backups')
|
||||
CONFIG.CACHE_DIR, _ = check_folder_writable(
|
||||
CONFIG.CACHE_DIR, os.path.join(DATA_DIR, 'cache'), 'cache')
|
||||
CONFIG.NEWSLETTER_DIR, _ = check_folder_writable(
|
||||
CONFIG.NEWSLETTER_DIR, os.path.join(DATA_DIR, 'newsletters'), 'newsletters')
|
||||
|
||||
# Initialize the database
|
||||
logger.info(u"Checking if the database upgrades are required...")
|
||||
@@ -669,7 +645,7 @@ def dbcheck():
|
||||
# library_sections table :: This table keeps record of the servers library sections
|
||||
c_db.execute(
|
||||
'CREATE TABLE IF NOT EXISTS library_sections (id INTEGER PRIMARY KEY AUTOINCREMENT, '
|
||||
'server_id TEXT, section_id INTEGER, section_name TEXT, section_type TEXT, '
|
||||
'server_id TEXT, section_id INTEGER, section_name TEXT, section_type TEXT, agent TEXT, '
|
||||
'thumb TEXT, custom_thumb_url TEXT, art TEXT, count INTEGER, parent_count INTEGER, child_count INTEGER, '
|
||||
'do_notify INTEGER DEFAULT 1, do_notify_created INTEGER DEFAULT 1, keep_history INTEGER DEFAULT 1, '
|
||||
'deleted_section INTEGER DEFAULT 0, UNIQUE(server_id, section_id))'
|
||||
@@ -687,17 +663,17 @@ def dbcheck():
|
||||
'CREATE TABLE IF NOT EXISTS notifiers (id INTEGER PRIMARY KEY AUTOINCREMENT, '
|
||||
'agent_id INTEGER, agent_name TEXT, agent_label TEXT, friendly_name TEXT, notifier_config TEXT, '
|
||||
'on_play INTEGER DEFAULT 0, on_stop INTEGER DEFAULT 0, on_pause INTEGER DEFAULT 0, '
|
||||
'on_resume INTEGER DEFAULT 0, on_buffer INTEGER DEFAULT 0, on_watched INTEGER DEFAULT 0, '
|
||||
'on_resume INTEGER DEFAULT 0, on_change INTEGER DEFAULT 0, on_buffer INTEGER DEFAULT 0, on_watched INTEGER DEFAULT 0, '
|
||||
'on_created INTEGER DEFAULT 0, on_extdown INTEGER DEFAULT 0, on_intdown INTEGER DEFAULT 0, '
|
||||
'on_extup INTEGER DEFAULT 0, on_intup INTEGER DEFAULT 0, on_pmsupdate INTEGER DEFAULT 0, '
|
||||
'on_concurrent INTEGER DEFAULT 0, on_newdevice INTEGER DEFAULT 0, on_plexpyupdate INTEGER DEFAULT 0, '
|
||||
'on_play_subject TEXT, on_stop_subject TEXT, on_pause_subject TEXT, '
|
||||
'on_resume_subject TEXT, on_buffer_subject TEXT, on_watched_subject TEXT, '
|
||||
'on_resume_subject TEXT, on_change_subject TEXT, on_buffer_subject TEXT, on_watched_subject TEXT, '
|
||||
'on_created_subject TEXT, on_extdown_subject TEXT, on_intdown_subject TEXT, '
|
||||
'on_extup_subject TEXT, on_intup_subject TEXT, on_pmsupdate_subject TEXT, '
|
||||
'on_concurrent_subject TEXT, on_newdevice_subject TEXT, on_plexpyupdate_subject TEXT, '
|
||||
'on_play_body TEXT, on_stop_body TEXT, on_pause_body TEXT, '
|
||||
'on_resume_body TEXT, on_buffer_body TEXT, on_watched_body TEXT, '
|
||||
'on_resume_body TEXT, on_change_body TEXT, on_buffer_body TEXT, on_watched_body TEXT, '
|
||||
'on_created_body TEXT, on_extdown_body TEXT, on_intdown_body TEXT, '
|
||||
'on_extup_body TEXT, on_intup_body TEXT, on_pmsupdate_body TEXT, '
|
||||
'on_concurrent_body TEXT, on_newdevice_body TEXT, on_plexpyupdate_body TEXT, '
|
||||
@@ -1687,6 +1663,15 @@ def dbcheck():
|
||||
except sqlite3.OperationalError:
|
||||
logger.warn(u"Unable to remove duplicate libraries from library_sections table.")
|
||||
|
||||
# Upgrade library_sections table from earlier versions
|
||||
try:
|
||||
c_db.execute('SELECT agent FROM library_sections')
|
||||
except sqlite3.OperationalError:
|
||||
logger.debug(u"Altering database. Updating database table library_sections.")
|
||||
c_db.execute(
|
||||
'ALTER TABLE library_sections ADD COLUMN agent TEXT'
|
||||
)
|
||||
|
||||
# Upgrade users table from earlier versions (remove UNIQUE constraint on username)
|
||||
try:
|
||||
result = c_db.execute('SELECT SQL FROM sqlite_master WHERE type="table" AND name="users"').fetchone()
|
||||
@@ -1758,6 +1743,21 @@ def dbcheck():
|
||||
'ALTER TABLE notifiers ADD COLUMN custom_conditions_logic TEXT'
|
||||
)
|
||||
|
||||
# Upgrade notifiers table from earlier versions
|
||||
try:
|
||||
c_db.execute('SELECT on_change FROM notifiers')
|
||||
except sqlite3.OperationalError:
|
||||
logger.debug(u"Altering database. Updating database table notifiers.")
|
||||
c_db.execute(
|
||||
'ALTER TABLE notifiers ADD COLUMN on_change INTEGER DEFAULT 0'
|
||||
)
|
||||
c_db.execute(
|
||||
'ALTER TABLE notifiers ADD COLUMN on_change_subject TEXT'
|
||||
)
|
||||
c_db.execute(
|
||||
'ALTER TABLE notifiers ADD COLUMN on_change_body TEXT'
|
||||
)
|
||||
|
||||
# Upgrade tvmaze_lookup table from earlier versions
|
||||
try:
|
||||
c_db.execute('SELECT rating_key FROM tvmaze_lookup')
|
||||
@@ -1974,3 +1974,29 @@ def analytics_event(category, action, label=None, value=None, **kwargs):
|
||||
TRACKER.send('event', data)
|
||||
except Exception as e:
|
||||
logger.warn(u"Failed to send analytics event for category '%s', action '%s': %s" % (category, action, e))
|
||||
|
||||
|
||||
def check_folder_writable(folder, fallback, name):
|
||||
if not folder:
|
||||
folder = fallback
|
||||
|
||||
if not os.path.exists(folder):
|
||||
try:
|
||||
os.makedirs(folder)
|
||||
except OSError as e:
|
||||
logger.error(u"Could not create %s dir '%s': %s" % (name, folder, e))
|
||||
if folder != fallback:
|
||||
logger.warn(u"Falling back to %s dir '%s'" % (name, fallback))
|
||||
return check_folder_writable(None, fallback, name)
|
||||
else:
|
||||
return folder, None
|
||||
|
||||
if not os.access(folder, os.W_OK):
|
||||
logger.error(u"Cannot write to %s dir '%s'" % (name, folder))
|
||||
if folder != fallback:
|
||||
logger.warn(u"Falling back to %s dir '%s'" % (name, fallback))
|
||||
return check_folder_writable(None, fallback, name)
|
||||
else:
|
||||
return folder, False
|
||||
|
||||
return folder, True
|
||||
|
@@ -184,6 +184,19 @@ class ActivityHandler(object):
|
||||
|
||||
plexpy.NOTIFY_QUEUE.put({'stream_data': db_session.copy(), 'notify_action': 'on_resume'})
|
||||
|
||||
def on_change(self):
|
||||
if self.is_valid_session():
|
||||
logger.debug(u"Tautulli ActivityHandler :: Session %s has changed transcode decision." % str(self.get_session_key()))
|
||||
|
||||
# Update the session state and viewOffset
|
||||
self.update_db_session()
|
||||
|
||||
# Retrieve the session data from our temp table
|
||||
ap = activity_processor.ActivityProcessor()
|
||||
db_session = ap.get_session_by_key(session_key=self.get_session_key())
|
||||
|
||||
plexpy.NOTIFY_QUEUE.put({'stream_data': db_session.copy(), 'notify_action': 'on_change'})
|
||||
|
||||
def on_buffer(self):
|
||||
if self.is_valid_session():
|
||||
logger.debug(u"Tautulli ActivityHandler :: Session %s is buffering." % self.get_session_key())
|
||||
@@ -204,14 +217,14 @@ class ActivityHandler(object):
|
||||
# Update the session state and viewOffset
|
||||
self.update_db_session()
|
||||
|
||||
time_since_last_trigger = 0
|
||||
time_since_last_trigger = None
|
||||
if buffer_last_triggered:
|
||||
logger.debug(u"Tautulli ActivityHandler :: Session %s buffer last triggered at %s." %
|
||||
(self.get_session_key(), buffer_last_triggered))
|
||||
time_since_last_trigger = int(time.time()) - int(buffer_last_triggered)
|
||||
|
||||
if plexpy.CONFIG.BUFFER_THRESHOLD > 0 and (current_buffer_count >= plexpy.CONFIG.BUFFER_THRESHOLD and \
|
||||
time_since_last_trigger == 0 or time_since_last_trigger >= plexpy.CONFIG.BUFFER_WAIT):
|
||||
if current_buffer_count >= plexpy.CONFIG.BUFFER_THRESHOLD and time_since_last_trigger is None or \
|
||||
time_since_last_trigger >= plexpy.CONFIG.BUFFER_WAIT:
|
||||
ap.set_session_buffer_trigger_time(session_key=self.get_session_key())
|
||||
|
||||
# Retrieve the session data from our temp table
|
||||
@@ -228,6 +241,7 @@ class ActivityHandler(object):
|
||||
this_state = self.timeline['state']
|
||||
this_rating_key = str(self.timeline['ratingKey'])
|
||||
this_key = self.timeline['key']
|
||||
this_transcode_key = self.timeline.get('transcodeSession', '')
|
||||
|
||||
# Get the live tv session uuid
|
||||
this_live_uuid = this_key.split('/')[-1] if this_key.startswith('/livetv/sessions') else None
|
||||
@@ -241,13 +255,14 @@ class ActivityHandler(object):
|
||||
last_state = db_session['state']
|
||||
last_rating_key = str(db_session['rating_key'])
|
||||
last_live_uuid = db_session['live_uuid']
|
||||
last_transcode_key = db_session['transcode_key'].split('/')[-1]
|
||||
|
||||
# Make sure the same item is being played
|
||||
if this_rating_key == last_rating_key or this_live_uuid == last_live_uuid:
|
||||
# Update the session state and viewOffset
|
||||
if this_state == 'playing':
|
||||
# Update the session in our temp session table
|
||||
# if the last set temporary stopped time exceeds 15 seconds
|
||||
# if the last set temporary stopped time exceeds 60 seconds
|
||||
if int(time.time()) - db_session['stopped'] > 60:
|
||||
self.update_db_session()
|
||||
|
||||
@@ -260,13 +275,16 @@ class ActivityHandler(object):
|
||||
elif this_state == 'stopped':
|
||||
self.on_stop()
|
||||
|
||||
elif this_state == 'buffering':
|
||||
self.on_buffer()
|
||||
|
||||
elif this_state == 'paused':
|
||||
# Update the session last_paused timestamp
|
||||
self.on_pause(still_paused=True)
|
||||
|
||||
if this_state == 'buffering':
|
||||
self.on_buffer()
|
||||
|
||||
if this_transcode_key != last_transcode_key:
|
||||
self.on_change()
|
||||
|
||||
# If a client doesn't register stop events (I'm looking at you PHT!) check if the ratingKey has changed
|
||||
else:
|
||||
# Manually stop and start
|
||||
@@ -372,7 +390,7 @@ class TimelineHandler(object):
|
||||
if metadata:
|
||||
grandparent_rating_key = int(metadata['grandparent_rating_key'])
|
||||
parent_rating_key = int(metadata['parent_rating_key'])
|
||||
|
||||
|
||||
grandparent_set = RECENTLY_ADDED_QUEUE.get(grandparent_rating_key, set())
|
||||
grandparent_set.add(parent_rating_key)
|
||||
RECENTLY_ADDED_QUEUE[grandparent_rating_key] = grandparent_set
|
||||
@@ -421,7 +439,7 @@ class TimelineHandler(object):
|
||||
elif media_type in ('movie', 'show', 'artist') and section_id > 0 and \
|
||||
state_type == 5 and metadata_state is None and queue_size is None and \
|
||||
rating_key in RECENTLY_ADDED_QUEUE:
|
||||
|
||||
|
||||
logger.debug(u"Tautulli TimelineHandler :: Library item '%s' (%s) done processing metadata."
|
||||
% (title, str(rating_key)))
|
||||
|
||||
@@ -456,7 +474,7 @@ def schedule_callback(id, func=None, remove_job=False, args=None, **kwargs):
|
||||
ACTIVITY_SCHED.add_job(
|
||||
func, args=args, id=id, trigger=DateTrigger(
|
||||
run_date=datetime.datetime.now() + datetime.timedelta(**kwargs)))
|
||||
|
||||
|
||||
|
||||
def force_stop_stream(session_key):
|
||||
ap = activity_processor.ActivityProcessor()
|
||||
@@ -503,7 +521,7 @@ def clear_recently_added_queue(rating_key):
|
||||
elif child_keys:
|
||||
for child_key in child_keys:
|
||||
grandchild_keys = RECENTLY_ADDED_QUEUE.get(child_key, [])
|
||||
|
||||
|
||||
if plexpy.CONFIG.NOTIFY_GROUP_RECENTLY_ADDED_PARENT and len(grandchild_keys) > 1:
|
||||
on_created(child_key, child_keys=grandchild_keys)
|
||||
|
||||
@@ -550,7 +568,7 @@ def on_created(rating_key, **kwargs):
|
||||
all_keys = [rating_key]
|
||||
if 'child_keys' in kwargs:
|
||||
all_keys.extend(kwargs['child_keys'])
|
||||
|
||||
|
||||
for key in all_keys:
|
||||
data_factory.set_recently_added_item(key)
|
||||
|
||||
|
@@ -156,10 +156,11 @@ class ActivityProcessor(object):
|
||||
# Reload json from raw stream info
|
||||
if session.get('raw_stream_info'):
|
||||
raw_stream_info = json.loads(session['raw_stream_info'])
|
||||
# Don't overwrite id, session_key, stopped
|
||||
# Don't overwrite id, session_key, stopped, view_offset
|
||||
raw_stream_info.pop('id', None)
|
||||
raw_stream_info.pop('session_key', None)
|
||||
raw_stream_info.pop('stopped', None)
|
||||
raw_stream_info.pop('view_offset', None)
|
||||
session.update(raw_stream_info)
|
||||
|
||||
session = defaultdict(str, session)
|
||||
|
@@ -598,7 +598,7 @@ General optional parameters:
|
||||
if self._api_cmd == 'docs_md':
|
||||
return out['response']['data']
|
||||
|
||||
elif self._api_cmd == 'download_log':
|
||||
elif self._api_cmd.startswith('download_'):
|
||||
return
|
||||
|
||||
elif self._api_cmd == 'pms_image_proxy':
|
||||
|
@@ -433,7 +433,7 @@ NOTIFICATION_PARAMETERS = [
|
||||
{'name': 'Updated Date', 'type': 'str', 'value': 'updated_date', 'description': 'The date (in date format) the item was updated on Plex.'},
|
||||
{'name': 'Last Viewed Date', 'type': 'str', 'value': 'last_viewed_date', 'description': 'The date (in date format) the item was last viewed on Plex.'},
|
||||
{'name': 'Studio', 'type': 'str', 'value': 'studio', 'description': 'The studio for the item.'},
|
||||
{'name': 'Content Rating', 'type': 'int', 'value': 'content_rating', 'description': 'The content rating for the item.', 'example': 'e.g. TV-MA, TV-PG, etc.'},
|
||||
{'name': 'Content Rating', 'type': 'str', 'value': 'content_rating', 'description': 'The content rating for the item.', 'example': 'e.g. TV-MA, TV-PG, etc.'},
|
||||
{'name': 'Directors', 'type': 'str', 'value': 'directors', 'description': 'A list of directors for the item.'},
|
||||
{'name': 'Writers', 'type': 'str', 'value': 'writers', 'description': 'A list of writers for the item.'},
|
||||
{'name': 'Actors', 'type': 'str', 'value': 'actors', 'description': 'A list of actors for the item.'},
|
||||
|
@@ -104,7 +104,7 @@ _CONFIG_DEFINITIONS = {
|
||||
'BROWSER_ON_PMSUPDATE': (int, 'Browser', 0),
|
||||
'BROWSER_ON_CONCURRENT': (int, 'Browser', 0),
|
||||
'BROWSER_ON_NEWDEVICE': (int, 'Browser', 0),
|
||||
'BUFFER_THRESHOLD': (int, 'Monitoring', 3),
|
||||
'BUFFER_THRESHOLD': (int, 'Monitoring', 10),
|
||||
'BUFFER_WAIT': (int, 'Monitoring', 900),
|
||||
'BACKUP_DAYS': (int, 'General', 3),
|
||||
'BACKUP_DIR': (str, 'General', ''),
|
||||
@@ -182,10 +182,6 @@ _CONFIG_DEFINITIONS = {
|
||||
'GIT_TOKEN': (str, 'General', ''),
|
||||
'GIT_USER': (str, 'General', 'Tautulli'),
|
||||
'GIT_REPO': (str, 'General', 'Tautulli'),
|
||||
'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', 1),
|
||||
'GROWL_ENABLED': (int, 'Growl', 0),
|
||||
'GROWL_HOST': (str, 'Growl', ''),
|
||||
@@ -207,12 +203,8 @@ _CONFIG_DEFINITIONS = {
|
||||
'HISTORY_TABLE_ACTIVITY': (int, 'General', 1),
|
||||
'HOME_SECTIONS': (list, 'General', ['current_activity','watch_stats','library_stats','recently_added']),
|
||||
'HOME_LIBRARY_CARDS': (list, 'General', ['first_run']),
|
||||
'HOME_STATS_LENGTH': (int, 'General', 30),
|
||||
'HOME_STATS_TYPE': (int, 'General', 0),
|
||||
'HOME_STATS_COUNT': (int, 'General', 5),
|
||||
'HOME_STATS_CARDS': (list, 'General', ['top_movies', 'popular_movies', 'top_tv', 'popular_tv', 'top_music', \
|
||||
'popular_music', 'last_watched', 'top_users', 'top_platforms', 'most_concurrent']),
|
||||
'HOME_STATS_RECENTLY_ADDED_COUNT': (int, 'General', 50),
|
||||
'HOME_REFRESH_INTERVAL': (int, 'General', 10),
|
||||
'HTTPS_CREATE_CERT': (int, 'General', 1),
|
||||
'HTTPS_CERT': (str, 'General', ''),
|
||||
@@ -921,3 +913,9 @@ class Config(object):
|
||||
if self.CONFIG_VERSION == 11:
|
||||
self.ANON_REDIRECT = self.ANON_REDIRECT.replace('http://www.nullrefer.com/?',
|
||||
'https://www.nullrefer.com/?')
|
||||
self.CONFIG_VERSION = 12
|
||||
|
||||
if self.CONFIG_VERSION == 12:
|
||||
self.BUFFER_THRESHOLD = max(self.BUFFER_THRESHOLD, 10)
|
||||
|
||||
self.CONFIG_VERSION = 13
|
||||
|
@@ -261,17 +261,11 @@ class DataFactory(object):
|
||||
|
||||
return dict
|
||||
|
||||
def get_home_stats(self, grouping=None, time_range=None, stats_type=None, stats_count=None, stats_cards=None):
|
||||
def get_home_stats(self, grouping=None, time_range=30, stats_type='plays', stats_count=10, stats_cards=None):
|
||||
monitor_db = database.MonitorDatabase()
|
||||
|
||||
if grouping is None:
|
||||
grouping = plexpy.CONFIG.GROUP_HISTORY_TABLES
|
||||
if time_range is None:
|
||||
time_range = plexpy.CONFIG.HOME_STATS_LENGTH
|
||||
if stats_type is None:
|
||||
stats_type = plexpy.CONFIG.HOME_STATS_TYPE
|
||||
if stats_count is None:
|
||||
stats_count = plexpy.CONFIG.HOME_STATS_COUNT
|
||||
if stats_cards is None:
|
||||
stats_cards = plexpy.CONFIG.HOME_STATS_CARDS
|
||||
|
||||
@@ -280,7 +274,7 @@ class DataFactory(object):
|
||||
music_watched_percent = plexpy.CONFIG.MUSIC_WATCHED_PERCENT
|
||||
|
||||
group_by = 'session_history.reference_id' if grouping else 'session_history.id'
|
||||
sort_type = 'total_duration' if helpers.cast_to_int(stats_type) == 1 else 'total_plays'
|
||||
sort_type = 'total_duration' if stats_type == 'duration' else 'total_plays'
|
||||
|
||||
home_stats = []
|
||||
|
||||
@@ -926,7 +920,7 @@ class DataFactory(object):
|
||||
pre_tautulli = 0
|
||||
|
||||
# For backwards compatibility. Pick one new Tautulli key to check and override with old values.
|
||||
if not item['stream_video_resolution']:
|
||||
if not item['stream_container']:
|
||||
item['stream_video_resolution'] = item['video_resolution']
|
||||
item['stream_container'] = item['transcode_container'] or item['container']
|
||||
item['stream_video_decision'] = item['video_decision']
|
||||
@@ -1449,7 +1443,8 @@ class DataFactory(object):
|
||||
'media_index, parent_media_index ' \
|
||||
'FROM session_history_metadata ' \
|
||||
'WHERE {0} = ? ' \
|
||||
'GROUP BY {1} '
|
||||
'GROUP BY {1} ' \
|
||||
'ORDER BY {1} DESC '
|
||||
|
||||
# get grandparent_rating_keys
|
||||
grandparents = {}
|
||||
|
@@ -50,6 +50,7 @@ def refresh_libraries():
|
||||
'section_id': section['section_id'],
|
||||
'section_name': section['section_name'],
|
||||
'section_type': section['section_type'],
|
||||
'agent': section['agent'],
|
||||
'thumb': section['thumb'],
|
||||
'art': section['art'],
|
||||
'count': section['count'],
|
||||
@@ -923,7 +924,7 @@ class Libraries(object):
|
||||
monitor_db = database.MonitorDatabase()
|
||||
|
||||
try:
|
||||
query = 'SELECT section_id, section_name, section_type FROM library_sections WHERE deleted_section = 0'
|
||||
query = 'SELECT section_id, section_name, section_type, agent FROM library_sections WHERE deleted_section = 0'
|
||||
result = monitor_db.select(query=query)
|
||||
except Exception as e:
|
||||
logger.warn(u"Tautulli Libraries :: Unable to execute database query for get_sections: %s." % e)
|
||||
@@ -933,7 +934,8 @@ class Libraries(object):
|
||||
for item in result:
|
||||
library = {'section_id': item['section_id'],
|
||||
'section_name': item['section_name'],
|
||||
'section_type': item['section_type']
|
||||
'section_type': item['section_type'],
|
||||
'agent': item['agent']
|
||||
}
|
||||
libraries.append(library)
|
||||
|
||||
|
@@ -130,6 +130,32 @@ class PublicIPFilter(logging.Filter):
|
||||
return True
|
||||
|
||||
|
||||
class PlexTokenFilter(logging.Filter):
|
||||
"""
|
||||
Log filter for X-Plex-Token
|
||||
"""
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def filter(self, record):
|
||||
try:
|
||||
tokens = re.findall(r'X-Plex-Token(?:=|%3D)([a-zA-Z0-9]+)', record.msg)
|
||||
for token in tokens:
|
||||
record.msg = record.msg.replace(token, 8 * '*' + token[-2:])
|
||||
|
||||
args = []
|
||||
for arg in record.args:
|
||||
tokens = re.findall(r'X-Plex-Token(?:=|%3D)([a-zA-Z0-9]+)', arg) if isinstance(arg, basestring) else []
|
||||
for token in tokens:
|
||||
arg = arg.replace(token, 8 * '*' + token[-2:])
|
||||
args.append(arg)
|
||||
record.args = tuple(args)
|
||||
except:
|
||||
pass
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def listener():
|
||||
"""
|
||||
@@ -268,6 +294,7 @@ def initLogger(console=False, log_dir=False, verbose=False):
|
||||
for handler in logger.handlers + logger_api.handlers + logger_plex_websocket.handlers:
|
||||
handler.addFilter(BlacklistFilter())
|
||||
handler.addFilter(PublicIPFilter())
|
||||
handler.addFilter(PlexTokenFilter())
|
||||
|
||||
# Install exception hooks
|
||||
initHooks()
|
||||
|
@@ -14,6 +14,7 @@
|
||||
# along with Tautulli. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import arrow
|
||||
from collections import OrderedDict
|
||||
import json
|
||||
from itertools import groupby
|
||||
from mako.lookup import TemplateLookup
|
||||
@@ -683,7 +684,7 @@ class RecentlyAdded(Newsletter):
|
||||
start = 0
|
||||
|
||||
while not done:
|
||||
recent_items = pms_connect.get_recently_added_details(start=str(start), count='10', type=media_type)
|
||||
recent_items = pms_connect.get_recently_added_details(start=str(start), count='10', media_type=media_type)
|
||||
filtered_items = [i for i in recent_items['recently_added']
|
||||
if self.start_time < helpers.cast_to_int(i['added_at']) < self.end_time]
|
||||
if len(filtered_items) < 10:
|
||||
@@ -693,7 +694,7 @@ class RecentlyAdded(Newsletter):
|
||||
|
||||
recently_added.extend(filtered_items)
|
||||
|
||||
if media_type == 'movie':
|
||||
if media_type in ('movie', 'other_video'):
|
||||
movie_list = []
|
||||
for item in recently_added:
|
||||
# Filter included libraries
|
||||
@@ -795,8 +796,13 @@ class RecentlyAdded(Newsletter):
|
||||
if not self.config['incl_libraries']:
|
||||
logger.warn(u"Tautulli Newsletters :: Failed to retrieve %s newsletter data: no libraries selected." % self.NAME)
|
||||
|
||||
media_types = {s['section_type'] for s in self._get_sections()
|
||||
if str(s['section_id']) in self.config['incl_libraries']}
|
||||
media_types = set()
|
||||
for s in self._get_sections():
|
||||
if str(s['section_id']) in self.config['incl_libraries']:
|
||||
if s['section_type'] == 'movie' and s['agent'] == 'com.plexapp.agents.none':
|
||||
media_types.add('other_video')
|
||||
else:
|
||||
media_types.add(s['section_type'])
|
||||
|
||||
recently_added = {}
|
||||
for media_type in media_types:
|
||||
@@ -807,9 +813,10 @@ class RecentlyAdded(Newsletter):
|
||||
shows = recently_added.get('show', [])
|
||||
artists = recently_added.get('artist', [])
|
||||
albums = [a for artist in artists for a in artist['album']]
|
||||
other_video = recently_added.get('other_video', [])
|
||||
|
||||
if self.is_preview or helpers.get_img_service(include_self=True) == 'self-hosted':
|
||||
for item in movies + shows + albums:
|
||||
for item in movies + shows + albums + other_video:
|
||||
if item['media_type'] == 'album':
|
||||
height = 150
|
||||
fallback = 'cover'
|
||||
@@ -833,7 +840,7 @@ class RecentlyAdded(Newsletter):
|
||||
|
||||
elif helpers.get_img_service():
|
||||
# Upload posters and art to image hosting service
|
||||
for item in movies + shows + albums:
|
||||
for item in movies + shows + albums + other_video:
|
||||
if item['media_type'] == 'album':
|
||||
height = 150
|
||||
fallback = 'cover'
|
||||
@@ -858,7 +865,7 @@ class RecentlyAdded(Newsletter):
|
||||
item['poster_url'] = item['thumb_url'] # Keep for backwards compatibility
|
||||
|
||||
else:
|
||||
for item in movies + shows + albums:
|
||||
for item in movies + shows + albums + other_video:
|
||||
item['thumb_hash'] = ''
|
||||
item['art_hash'] = ''
|
||||
item['thumb_url'] = ''
|
||||
@@ -871,10 +878,11 @@ class RecentlyAdded(Newsletter):
|
||||
|
||||
def _has_data(self):
|
||||
recently_added = self.data.get('recently_added')
|
||||
if recently_added and \
|
||||
recently_added.get('movie') or \
|
||||
recently_added.get('show') or \
|
||||
recently_added.get('artist'):
|
||||
if recently_added and (
|
||||
recently_added.get('movie') or
|
||||
recently_added.get('show') or
|
||||
recently_added.get('artist') or
|
||||
recently_added.get('other_video')):
|
||||
return True
|
||||
|
||||
return False
|
||||
@@ -883,18 +891,26 @@ class RecentlyAdded(Newsletter):
|
||||
return libraries.Libraries().get_sections()
|
||||
|
||||
def _get_sections_options(self):
|
||||
library_types = {'movie': 'Movie Libraries',
|
||||
'show': 'TV Show Libraries',
|
||||
'artist': 'Music Libraries'}
|
||||
sections = {}
|
||||
for s in self._get_sections():
|
||||
if s['section_type'] != 'photo':
|
||||
library_type = library_types[s['section_type']]
|
||||
if s['section_type'] == 'movie' and s['agent'] == 'com.plexapp.agents.none':
|
||||
library_type = 'other_video'
|
||||
else:
|
||||
library_type = s['section_type']
|
||||
group = sections.get(library_type, [])
|
||||
group.append({'value': s['section_id'],
|
||||
'text': s['section_name']})
|
||||
sections[library_type] = group
|
||||
return sections
|
||||
|
||||
groups = OrderedDict([(k, v) for k, v in [
|
||||
('Movie Libraries', sections.get('movie')),
|
||||
('TV Show Libraries', sections.get('show')),
|
||||
('Music Libraries', sections.get('artist')),
|
||||
('Other Video Libraries', sections.get('other_video'))
|
||||
] if v is not None])
|
||||
|
||||
return groups
|
||||
|
||||
def build_params(self):
|
||||
parameters = self._build_params()
|
||||
|
@@ -1052,7 +1052,16 @@ def build_notify_text(subject='', body='', notify_action=None, parameters=None,
|
||||
logger.error(u"Tautulli NotificationHandler :: Unable to parse custom script arguments: %s. Using fallback." % e)
|
||||
script_args = []
|
||||
|
||||
elif agent_id == 25:
|
||||
try:
|
||||
subject = custom_formatter.format(unicode(subject), **parameters)
|
||||
except LookupError as e:
|
||||
logger.error(u"Tautulli NotificationHandler :: Unable to parse parameter %s in notification subject. Using fallback." % e)
|
||||
subject = unicode(default_subject).format(**parameters)
|
||||
except Exception as e:
|
||||
logger.error(u"Tautulli NotificationHandler :: Unable to parse custom notification subject: %s. Using fallback." % e)
|
||||
subject = unicode(default_subject).format(**parameters)
|
||||
|
||||
if agent_id == 25:
|
||||
if body:
|
||||
try:
|
||||
body = json.loads(body)
|
||||
@@ -1076,15 +1085,6 @@ def build_notify_text(subject='', body='', notify_action=None, parameters=None,
|
||||
body = ''
|
||||
|
||||
else:
|
||||
try:
|
||||
subject = custom_formatter.format(unicode(subject), **parameters)
|
||||
except LookupError as e:
|
||||
logger.error(u"Tautulli NotificationHandler :: Unable to parse parameter %s in notification subject. Using fallback." % e)
|
||||
subject = unicode(default_subject).format(**parameters)
|
||||
except Exception as e:
|
||||
logger.error(u"Tautulli NotificationHandler :: Unable to parse custom notification subject: %s. Using fallback." % e)
|
||||
subject = unicode(default_subject).format(**parameters)
|
||||
|
||||
try:
|
||||
body = custom_formatter.format(unicode(body), **parameters)
|
||||
except LookupError as e:
|
||||
|
@@ -244,6 +244,14 @@ def available_notification_actions():
|
||||
'icon': 'fa-play',
|
||||
'media_types': ('movie', 'episode', 'track')
|
||||
},
|
||||
{'label': 'Transcode Decision Change',
|
||||
'name': 'on_change',
|
||||
'description': 'Trigger a notification when a stream changes transcode decision.',
|
||||
'subject': 'Tautulli ({server_name})',
|
||||
'body': '{user} ({player}) has changed transcode decision for {title}.',
|
||||
'icon': 'fa-exchange-alt',
|
||||
'media_types': ('movie', 'episode', 'track')
|
||||
},
|
||||
{'label': 'Watched',
|
||||
'name': 'on_watched',
|
||||
'description': 'Trigger a notification when a video stream reaches the specified watch percentage.',
|
||||
@@ -403,7 +411,9 @@ def get_notify_agents():
|
||||
return tuple(a['name'] for a in sorted(available_notification_agents(), key=lambda k: k['label']))
|
||||
|
||||
|
||||
def get_notify_actions():
|
||||
def get_notify_actions(return_dict=False):
|
||||
if return_dict:
|
||||
return {a.pop('name'): a for a in available_notification_actions()}
|
||||
return tuple(a['name'] for a in available_notification_actions())
|
||||
|
||||
|
||||
@@ -467,15 +477,23 @@ def get_notifier_config(notifier_id=None):
|
||||
logger.error(u"Tautulli Notifiers :: Failed to get notifier config options: %s." % e)
|
||||
return
|
||||
|
||||
notify_actions = get_notify_actions()
|
||||
notify_actions = get_notify_actions(return_dict=True)
|
||||
|
||||
notifier_actions = {}
|
||||
notifier_text = {}
|
||||
for k in result.keys():
|
||||
if k in notify_actions:
|
||||
subject = result.pop(k + '_subject')
|
||||
body = result.pop(k + '_body')
|
||||
|
||||
if subject is None:
|
||||
subject = "" if result['agent_name'] in ('scripts', 'webhook') else notify_actions[k]['subject']
|
||||
if body is None:
|
||||
body = "" if result['agent_name'] in ('scripts', 'webhook') else notify_actions[k]['body']
|
||||
|
||||
notifier_actions[k] = helpers.cast_to_int(result.pop(k))
|
||||
notifier_text[k] = {'subject': result.pop(k + '_subject'),
|
||||
'body': result.pop(k + '_body')}
|
||||
notifier_text[k] = {'subject': subject,
|
||||
'body': body}
|
||||
|
||||
try:
|
||||
result['custom_conditions'] = json.loads(result['custom_conditions'])
|
||||
@@ -2091,25 +2109,26 @@ class JOIN(Notifier):
|
||||
if self.config['api_key']:
|
||||
params = {'apikey': self.config['api_key']}
|
||||
|
||||
r = requests.get('https://joinjoaomgcd.appspot.com/_ah/api/registration/v1/listDevices', params=params)
|
||||
try:
|
||||
r = requests.get('https://joinjoaomgcd.appspot.com/_ah/api/registration/v1/listDevices', params=params)
|
||||
|
||||
if r.status_code == 200:
|
||||
response_data = r.json()
|
||||
if response_data.get('success'):
|
||||
response_devices = response_data.get('records', [])
|
||||
devices.update({d['deviceName']: d['deviceName'] for d in response_devices})
|
||||
else:
|
||||
error_msg = response_data.get('errorMessage')
|
||||
logger.error(u"Tautulli Notifiers :: Unable to retrieve {name} devices list: {msg}".format(name=self.NAME, msg=error_msg))
|
||||
|
||||
if r.status_code == 200:
|
||||
response_data = r.json()
|
||||
if response_data.get('success'):
|
||||
response_devices = response_data.get('records', [])
|
||||
devices.update({d['deviceName']: d['deviceName'] for d in response_devices})
|
||||
return devices
|
||||
else:
|
||||
error_msg = response_data.get('errorMessage')
|
||||
logger.info(u"Tautulli Notifiers :: Unable to retrieve {name} devices list: {msg}".format(name=self.NAME, msg=error_msg))
|
||||
return devices
|
||||
else:
|
||||
logger.error(u"Tautulli Notifiers :: Unable to retrieve {name} devices list: [{r.status_code}] {r.reason}".format(name=self.NAME, r=r))
|
||||
logger.debug(u"Tautulli Notifiers :: Request response: {}".format(request.server_message(r, True)))
|
||||
return devices
|
||||
logger.error(u"Tautulli Notifiers :: Unable to retrieve {name} devices list: [{r.status_code}] {r.reason}".format(name=self.NAME, r=r))
|
||||
logger.debug(u"Tautulli Notifiers :: Request response: {}".format(request.server_message(r, True)))
|
||||
|
||||
else:
|
||||
return devices
|
||||
except Exception as e:
|
||||
logger.error(u"Tautulli Notifiers :: Unable to retrieve {name} devices list: {msg}".format(name=self.NAME, msg=e))
|
||||
|
||||
return devices
|
||||
|
||||
def return_config_options(self):
|
||||
config_option = [{'label': 'Join API Key',
|
||||
@@ -2679,27 +2698,28 @@ class PUSHBULLET(Notifier):
|
||||
return self.make_request('https://api.pushbullet.com/v2/pushes', headers=headers, json=data)
|
||||
|
||||
def get_devices(self):
|
||||
devices = {'': ''}
|
||||
|
||||
if self.config['api_key']:
|
||||
headers = {'Content-type': "application/json",
|
||||
'Access-Token': self.config['api_key']
|
||||
}
|
||||
try:
|
||||
r = requests.get('https://api.pushbullet.com/v2/devices', headers=headers)
|
||||
|
||||
r = requests.get('https://api.pushbullet.com/v2/devices', headers=headers)
|
||||
if r.status_code == 200:
|
||||
response_data = r.json()
|
||||
pushbullet_devices = response_data.get('devices', [])
|
||||
devices.update({d['iden']: d['nickname'] for d in pushbullet_devices if d['active']})
|
||||
else:
|
||||
logger.error(u"Tautulli Notifiers :: Unable to retrieve {name} devices list: "
|
||||
u"[{r.status_code}] {r.reason}".format(name=self.NAME, r=r))
|
||||
logger.debug(u"Tautulli Notifiers :: Request response: {}".format(request.server_message(r, True)))
|
||||
|
||||
if r.status_code == 200:
|
||||
response_data = r.json()
|
||||
devices = response_data.get('devices', [])
|
||||
devices = {d['iden']: d['nickname'] for d in devices if d['active']}
|
||||
devices.update({'': ''})
|
||||
return devices
|
||||
else:
|
||||
logger.error(u"Tautulli Notifiers :: Unable to retrieve {name} devices list: "
|
||||
u"[{r.status_code}] {r.reason}".format(name=self.NAME, r=r))
|
||||
logger.debug(u"Tautulli Notifiers :: Request response: {}".format(request.server_message(r, True)))
|
||||
return {'': ''}
|
||||
except Exception as e:
|
||||
logger.error(u"Tautulli Notifiers :: Unable to retrieve {name} devices list: {msg}".format(name=self.NAME, msg=e))
|
||||
|
||||
else:
|
||||
return {'': ''}
|
||||
return devices
|
||||
|
||||
def return_config_options(self):
|
||||
config_option = [{'label': 'Pushbullet Access Token',
|
||||
|
@@ -418,25 +418,27 @@ class PmsConnect(object):
|
||||
|
||||
return request
|
||||
|
||||
def get_hub_recently_added(self, start='0', count='0', type='', output_format=''):
|
||||
def get_hub_recently_added(self, start='0', count='0', media_type='', other_video=False, output_format=''):
|
||||
"""
|
||||
Return Plex hub recently added.
|
||||
|
||||
Parameters required: start { item number to start from }
|
||||
count { number of results to return }
|
||||
type { str }
|
||||
media_type { str }
|
||||
Optional parameters: output_format { dict, json }
|
||||
|
||||
Output: array
|
||||
"""
|
||||
uri = '/hubs/home/recentlyAdded?X-Plex-Container-Start=%s&X-Plex-Container-Size=%s&type=%s' % (start, count, type)
|
||||
personal = '&personal=1' if other_video else ''
|
||||
uri = '/hubs/home/recentlyAdded?X-Plex-Container-Start=%s&X-Plex-Container-Size=%s&type=%s%s' \
|
||||
% (start, count, media_type, personal)
|
||||
request = self.request_handler.make_request(uri=uri,
|
||||
request_type='GET',
|
||||
output_format=output_format)
|
||||
|
||||
return request
|
||||
|
||||
def get_recently_added_details(self, start='0', count='0', type='', section_id=''):
|
||||
def get_recently_added_details(self, start='0', count='0', media_type='', section_id=''):
|
||||
"""
|
||||
Return processed and validated list of recently added items.
|
||||
|
||||
@@ -444,14 +446,18 @@ class PmsConnect(object):
|
||||
|
||||
Output: array
|
||||
"""
|
||||
if type in ('movie', 'show', 'artist'):
|
||||
if type == 'movie':
|
||||
type = '1'
|
||||
elif type == 'show':
|
||||
type = '2'
|
||||
elif type == 'artist':
|
||||
type = '8'
|
||||
recent = self.get_hub_recently_added(start, count, type, output_format='xml')
|
||||
if media_type in ('movie', 'show', 'artist', 'other_video'):
|
||||
other_video = False
|
||||
if media_type == 'movie':
|
||||
media_type = '1'
|
||||
elif media_type == 'show':
|
||||
media_type = '2'
|
||||
elif media_type == 'artist':
|
||||
media_type = '8'
|
||||
elif media_type == 'other_video':
|
||||
media_type = '1'
|
||||
other_video = True
|
||||
recent = self.get_hub_recently_added(start, count, media_type, other_video, output_format='xml')
|
||||
elif section_id:
|
||||
recent = self.get_library_recently_added(section_id, start, count, output_format='xml')
|
||||
else:
|
||||
@@ -2290,6 +2296,7 @@ class PmsConnect(object):
|
||||
libraries_output = {'section_id': helpers.get_xml_attr(result, 'key'),
|
||||
'section_type': helpers.get_xml_attr(result, 'type'),
|
||||
'section_name': helpers.get_xml_attr(result, 'title'),
|
||||
'agent': helpers.get_xml_attr(result, 'agent'),
|
||||
'thumb': helpers.get_xml_attr(result, 'thumb'),
|
||||
'art': helpers.get_xml_attr(result, 'art')
|
||||
}
|
||||
@@ -2450,6 +2457,7 @@ class PmsConnect(object):
|
||||
library_stats = {'section_id': section_id,
|
||||
'section_name': library['section_name'],
|
||||
'section_type': section_type,
|
||||
'agent': library['agent'],
|
||||
'thumb': library['thumb'],
|
||||
'art': library['art'],
|
||||
'count': children_list['library_count']
|
||||
|
@@ -1,2 +1,2 @@
|
||||
PLEXPY_BRANCH = "beta"
|
||||
PLEXPY_RELEASE_VERSION = "v2.1.20-beta"
|
||||
PLEXPY_RELEASE_VERSION = "v2.1.23-beta"
|
||||
|
@@ -173,10 +173,6 @@ class WebInterface(object):
|
||||
def home(self, **kwargs):
|
||||
config = {
|
||||
"home_sections": plexpy.CONFIG.HOME_SECTIONS,
|
||||
"home_stats_length": plexpy.CONFIG.HOME_STATS_LENGTH,
|
||||
"home_stats_type": plexpy.CONFIG.HOME_STATS_TYPE,
|
||||
"home_stats_count": plexpy.CONFIG.HOME_STATS_COUNT,
|
||||
"home_stats_recently_added_count": plexpy.CONFIG.HOME_STATS_RECENTLY_ADDED_COUNT,
|
||||
"home_refresh_interval": plexpy.CONFIG.HOME_REFRESH_INTERVAL,
|
||||
"pms_name": plexpy.CONFIG.PMS_NAME,
|
||||
"pms_is_cloud": plexpy.CONFIG.PMS_IS_CLOUD,
|
||||
@@ -293,7 +289,7 @@ class WebInterface(object):
|
||||
|
||||
@cherrypy.expose
|
||||
@requireAuth()
|
||||
def home_stats(self, time_range=30, stats_type=0, stats_count=10, **kwargs):
|
||||
def home_stats(self, time_range=30, stats_type='plays', stats_count=10, **kwargs):
|
||||
data_factory = datafactory.DataFactory()
|
||||
stats_data = data_factory.get_home_stats(time_range=time_range,
|
||||
stats_type=stats_type,
|
||||
@@ -301,24 +297,6 @@ class WebInterface(object):
|
||||
|
||||
return serve_template(templatename="home_stats.html", title="Stats", data=stats_data)
|
||||
|
||||
@cherrypy.expose
|
||||
@requireAuth(member_of("admin"))
|
||||
def set_home_stats_config(self, time_range=None, stats_type=None, stats_count=None, recently_added_count=None, **kwargs):
|
||||
if time_range:
|
||||
plexpy.CONFIG.__setattr__('HOME_STATS_LENGTH', time_range)
|
||||
plexpy.CONFIG.write()
|
||||
if stats_type:
|
||||
plexpy.CONFIG.__setattr__('HOME_STATS_TYPE', stats_type)
|
||||
plexpy.CONFIG.write()
|
||||
if stats_count:
|
||||
plexpy.CONFIG.__setattr__('HOME_STATS_COUNT', stats_count)
|
||||
plexpy.CONFIG.write()
|
||||
if recently_added_count:
|
||||
plexpy.CONFIG.__setattr__('HOME_STATS_RECENTLY_ADDED_COUNT', recently_added_count)
|
||||
plexpy.CONFIG.write()
|
||||
|
||||
return "Updated home stats config values."
|
||||
|
||||
@cherrypy.expose
|
||||
@requireAuth()
|
||||
def library_stats(self, **kwargs):
|
||||
@@ -332,11 +310,11 @@ class WebInterface(object):
|
||||
|
||||
@cherrypy.expose
|
||||
@requireAuth()
|
||||
def get_recently_added(self, count='0', type='', **kwargs):
|
||||
def get_recently_added(self, count='0', media_type='', **kwargs):
|
||||
|
||||
try:
|
||||
pms_connect = pmsconnect.PmsConnect()
|
||||
result = pms_connect.get_recently_added_details(count=count, type=type)
|
||||
result = pms_connect.get_recently_added_details(count=count, media_type=media_type)
|
||||
except IOError as e:
|
||||
return serve_template(templatename="recently_added.html", data=None)
|
||||
|
||||
@@ -1718,7 +1696,7 @@ class WebInterface(object):
|
||||
custom_where.append(['session_history_metadata.section_id', section_id])
|
||||
if 'media_type' in kwargs:
|
||||
media_type = kwargs.get('media_type', "")
|
||||
if media_type:
|
||||
if media_type != 'all':
|
||||
custom_where.append(['session_history.media_type', media_type])
|
||||
if 'transcode_decision' in kwargs:
|
||||
transcode_decision = kwargs.get('transcode_decision', "")
|
||||
@@ -1838,34 +1816,7 @@ class WebInterface(object):
|
||||
@cherrypy.expose
|
||||
@requireAuth()
|
||||
def graphs(self, **kwargs):
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
return serve_template(templatename="graphs.html", title="Graphs", config=config)
|
||||
|
||||
@cherrypy.expose
|
||||
@requireAuth(member_of("admin"))
|
||||
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()
|
||||
|
||||
return "Updated graphs config values."
|
||||
return serve_template(templatename="graphs.html", title="Graphs")
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
@@ -2990,7 +2941,8 @@ class WebInterface(object):
|
||||
# Get new server URLs for SSL communications and get new server friendly name
|
||||
if server_changed:
|
||||
plextv.get_server_resources()
|
||||
web_socket.reconnect()
|
||||
if plexpy.WS_CONNECTED:
|
||||
web_socket.reconnect()
|
||||
|
||||
# If first run, start websocket
|
||||
if first_run:
|
||||
@@ -4700,8 +4652,8 @@ class WebInterface(object):
|
||||
@cherrypy.tools.json_out()
|
||||
@requireAuth(member_of("admin"))
|
||||
@addtoapi("get_recently_added")
|
||||
def get_recently_added_details(self, start='0', count='0', type='', section_id='', **kwargs):
|
||||
""" Get all items that where recelty added to plex.
|
||||
def get_recently_added_details(self, start='0', count='0', media_type='', section_id='', **kwargs):
|
||||
""" Get all items that where recently added to plex.
|
||||
|
||||
```
|
||||
Required parameters:
|
||||
@@ -4709,7 +4661,7 @@ class WebInterface(object):
|
||||
|
||||
Optional parameters:
|
||||
start (str): The item number to start at
|
||||
type (str): The media type: movie, show, artist
|
||||
media_type (str): The media type: movie, show, artist
|
||||
section_id (str): The id of the Plex library section
|
||||
|
||||
Returns:
|
||||
@@ -4739,8 +4691,12 @@ class WebInterface(object):
|
||||
}
|
||||
```
|
||||
"""
|
||||
# For backwards compatibility
|
||||
if 'type' in kwargs:
|
||||
media_type = kwargs['type']
|
||||
|
||||
pms_connect = pmsconnect.PmsConnect()
|
||||
result = pms_connect.get_recently_added_details(start=start, count=count, type=type, section_id=section_id)
|
||||
result = pms_connect.get_recently_added_details(start=start, count=count, media_type=media_type, section_id=section_id)
|
||||
|
||||
if result:
|
||||
return result
|
||||
@@ -5334,7 +5290,7 @@ class WebInterface(object):
|
||||
@cherrypy.tools.json_out()
|
||||
@requireAuth(member_of("admin"))
|
||||
@addtoapi()
|
||||
def get_home_stats(self, grouping=0, time_range='30', stats_type=0, stats_count='10', **kwargs):
|
||||
def get_home_stats(self, grouping=0, time_range=30, stats_type='plays', stats_count=10, **kwargs):
|
||||
""" Get the homepage watch statistics.
|
||||
|
||||
```
|
||||
@@ -5344,7 +5300,7 @@ class WebInterface(object):
|
||||
Optional parameters:
|
||||
grouping (int): 0 or 1
|
||||
time_range (str): The time range to calculate statistics, '30'
|
||||
stats_type (int): 0 for plays, 1 for duration
|
||||
stats_type (str): plays or duration
|
||||
stats_count (str): The number of top items to list, '5'
|
||||
|
||||
Returns:
|
||||
@@ -5408,6 +5364,12 @@ class WebInterface(object):
|
||||
]
|
||||
```
|
||||
"""
|
||||
# For backwards compatibility
|
||||
if stats_type in (0, "0"):
|
||||
stats_type = 'plays'
|
||||
elif stats_type in (1, '1'):
|
||||
stats_type = 'duration'
|
||||
|
||||
data_factory = datafactory.DataFactory()
|
||||
result = data_factory.get_home_stats(grouping=grouping,
|
||||
time_range=time_range,
|
||||
|
@@ -67,6 +67,10 @@ def initialize(options):
|
||||
else:
|
||||
protocol = "http"
|
||||
|
||||
if options['http_proxy']:
|
||||
# Overwrite cherrypy.tools.proxy with our own proxy handler
|
||||
cherrypy.tools.proxy = cherrypy.Tool('before_handler', proxy, priority=1)
|
||||
|
||||
if options['http_password']:
|
||||
login_allowed = ["Tautulli admin (username is '%s')" % options['http_username']]
|
||||
if plexpy.CONFIG.HTTP_PLEX_ADMIN:
|
||||
@@ -80,7 +84,7 @@ def initialize(options):
|
||||
else:
|
||||
auth_enabled = True
|
||||
basic_auth_enabled = False
|
||||
cherrypy.tools.auth = cherrypy.Tool('before_handler', webauth.check_auth)
|
||||
cherrypy.tools.auth = cherrypy.Tool('before_handler', webauth.check_auth, priority=2)
|
||||
else:
|
||||
auth_enabled = basic_auth_enabled = False
|
||||
|
||||
@@ -94,7 +98,7 @@ def initialize(options):
|
||||
conf = {
|
||||
'/': {
|
||||
'tools.staticdir.root': os.path.join(plexpy.PROG_DIR, 'data'),
|
||||
'tools.proxy.on': options['http_proxy'], # pay attention to X-Forwarded-Proto header
|
||||
'tools.proxy.on': bool(options['http_proxy']),
|
||||
'tools.gzip.on': True,
|
||||
'tools.gzip.mime_types': ['text/html', 'text/plain', 'text/css',
|
||||
'text/javascript', 'application/json',
|
||||
@@ -226,3 +230,26 @@ class BaseRedirect(object):
|
||||
@cherrypy.expose
|
||||
def index(self):
|
||||
raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT)
|
||||
|
||||
|
||||
def proxy():
|
||||
# logger.debug(u"REQUEST URI: %s, HEADER [X-Forwarded-Host]: %s, [X-Host]: %s, [Origin]: %s, [Host]: %s",
|
||||
# cherrypy.request.wsgi_environ['REQUEST_URI'],
|
||||
# cherrypy.request.headers.get('X-Forwarded-Host'),
|
||||
# cherrypy.request.headers.get('X-Host'),
|
||||
# cherrypy.request.headers.get('Origin'),
|
||||
# cherrypy.request.headers.get('Host'))
|
||||
|
||||
# Change cherrpy.tools.proxy.local header if X-Forwarded-Host header is not present
|
||||
local = 'X-Forwarded-Host'
|
||||
if not cherrypy.request.headers.get('X-Forwarded-Host'):
|
||||
if cherrypy.request.headers.get('X-Host'): # lighttpd
|
||||
local = 'X-Host'
|
||||
elif cherrypy.request.headers.get('Origin'): # Squid
|
||||
local = 'Origin'
|
||||
elif cherrypy.request.headers.get('Host'): # nginx
|
||||
local = 'Host'
|
||||
# logger.debug(u"cherrypy.tools.proxy.local set to [%s]", local)
|
||||
|
||||
# Call original cherrypy proxy tool with the new local
|
||||
cherrypy.lib.cptools.proxy(local=local)
|
||||
|
Reference in New Issue
Block a user