Compare commits
27 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
03751abc0e | ||
![]() |
a94207691f | ||
![]() |
dbc53ca710 | ||
![]() |
4c9ddbd8b7 | ||
![]() |
045c69f5d8 | ||
![]() |
71ae314c46 | ||
![]() |
c8575bbc0f | ||
![]() |
f1b3a6f7b6 | ||
![]() |
8a94f6d63a | ||
![]() |
9b8fb73a7a | ||
![]() |
67c333e86e | ||
![]() |
cfa0b20419 | ||
![]() |
4b2930c890 | ||
![]() |
d98565ea12 | ||
![]() |
471f7c184a | ||
![]() |
3d4a5e6547 | ||
![]() |
382322d5e7 | ||
![]() |
c0ae25611b | ||
![]() |
f025533582 | ||
![]() |
fd28e5183a | ||
![]() |
185099f183 | ||
![]() |
cd6289046e | ||
![]() |
955dc795ff | ||
![]() |
1b772e60a9 | ||
![]() |
c6f4c17a81 | ||
![]() |
1e68a81fe1 | ||
![]() |
634e003bb7 |
28
CHANGELOG.md
28
CHANGELOG.md
@@ -1,5 +1,33 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 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)
|
## v2.1.20 (2018-09-05)
|
||||||
* No changes.
|
* No changes.
|
||||||
|
|
||||||
|
@@ -4163,3 +4163,15 @@ a[data-tab-destination] {
|
|||||||
.fa-blank {
|
.fa-blank {
|
||||||
visibility: hidden;
|
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;
|
||||||
|
}
|
@@ -190,12 +190,12 @@ DOCUMENTATION :: END
|
|||||||
<li>
|
<li>
|
||||||
<a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}">
|
<a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}">
|
||||||
<div class="item-children-poster">
|
<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':
|
% if _session['user_group'] == 'admin':
|
||||||
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
|
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
|
||||||
% endif
|
% endif
|
||||||
</div>
|
</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>
|
<h3 title="${child['title']}">${child['title']}</h3>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</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>
|
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
|
||||||
% endif
|
% endif
|
||||||
</div>
|
</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['parent_title']}">${child['parent_title']}</h3>
|
||||||
<h3 title="${child['title']}">${child['title']}</h3>
|
<h3 title="${child['title']}">${child['title']}</h3>
|
||||||
</div>
|
</div>
|
||||||
@@ -246,11 +246,11 @@ DOCUMENTATION :: END
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
% if _session['user_group'] == 'admin':
|
<div class="item-children-instance-text-wrapper cover-item">
|
||||||
<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">
|
|
||||||
<h3 title="${child['original_title'] or child['grandparent_title']}">${child['original_title'] or child['grandparent_title']}</h3>
|
<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['title']}">${child['title']}</h3>
|
||||||
<h3 title="${child['parent_title']}" class="text-muted">${child['parent_title']}</h3>
|
<h3 title="${child['parent_title']}" class="text-muted">${child['parent_title']}</h3>
|
||||||
|
@@ -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) {
|
function initConfigCheckbox(elem, toggleElem, reverse) {
|
||||||
toggleElem = (toggleElem === undefined) ? null : toggleElem;
|
toggleElem = (toggleElem === undefined) ? null : toggleElem;
|
||||||
reverse = (reverse === undefined) ? false : reverse;
|
reverse = (reverse === undefined) ? false : reverse;
|
||||||
@@ -496,9 +522,10 @@ if (!localStorage.getItem('Tautulli_ClientId')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function uuidv4() {
|
function uuidv4() {
|
||||||
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
|
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, function(c) {
|
||||||
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
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 = {
|
var x_plex_headers = {
|
||||||
@@ -506,10 +533,10 @@ var x_plex_headers = {
|
|||||||
'X-Plex-Product': 'Tautulli',
|
'X-Plex-Product': 'Tautulli',
|
||||||
'X-Plex-Version': 'Plex OAuth',
|
'X-Plex-Version': 'Plex OAuth',
|
||||||
'X-Plex-Client-Identifier': localStorage.getItem('Tautulli_ClientId'),
|
'X-Plex-Client-Identifier': localStorage.getItem('Tautulli_ClientId'),
|
||||||
'X-Plex-Platform': platform.name,
|
'X-Plex-Platform': p.name,
|
||||||
'X-Plex-Platform-Version': platform.version,
|
'X-Plex-Platform-Version': p.version,
|
||||||
'X-Plex-Device': platform.os.toString(),
|
'X-Plex-Device': p.os,
|
||||||
'X-Plex-Device-Name': platform.name
|
'X-Plex-Device-Name': p.name
|
||||||
};
|
};
|
||||||
|
|
||||||
var plex_oauth_window = null;
|
var plex_oauth_window = null;
|
||||||
@@ -568,7 +595,6 @@ getPlexOAuthPin = function () {
|
|||||||
type: 'POST',
|
type: 'POST',
|
||||||
headers: x_plex_headers,
|
headers: x_plex_headers,
|
||||||
success: function(data) {
|
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});
|
deferred.resolve({pin: data.id, code: data.code});
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
@@ -585,7 +611,6 @@ function PlexOAuth(success, error, pre) {
|
|||||||
if (typeof pre === "function") {
|
if (typeof pre === "function") {
|
||||||
pre()
|
pre()
|
||||||
}
|
}
|
||||||
clearTimeout(polling);
|
|
||||||
closePlexOAuthWindow();
|
closePlexOAuthWindow();
|
||||||
plex_oauth_window = PopupCenter('', 'Plex-OAuth', 600, 700);
|
plex_oauth_window = PopupCenter('', 'Plex-OAuth', 600, 700);
|
||||||
$(plex_oauth_window.document.body).html(plex_oauth_loader);
|
$(plex_oauth_window.document.body).html(plex_oauth_loader);
|
||||||
@@ -593,40 +618,38 @@ function PlexOAuth(success, error, pre) {
|
|||||||
getPlexOAuthPin().then(function (data) {
|
getPlexOAuthPin().then(function (data) {
|
||||||
const pin = data.pin;
|
const pin = data.pin;
|
||||||
const code = data.code;
|
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() {
|
(function poll() {
|
||||||
polling = setTimeout(function () {
|
$.ajax({
|
||||||
$.ajax({
|
url: 'https://plex.tv/api/v2/pins/' + pin,
|
||||||
url: 'https://plex.tv/api/v2/pins/' + pin,
|
type: 'GET',
|
||||||
type: 'GET',
|
headers: x_plex_headers,
|
||||||
headers: x_plex_headers,
|
success: function (data) {
|
||||||
success: function (data) {
|
if (data.authToken){
|
||||||
if (data.authToken){
|
closePlexOAuthWindow();
|
||||||
keep_polling = false;
|
if (typeof success === "function") {
|
||||||
closePlexOAuthWindow();
|
success(data.authToken)
|
||||||
if (typeof success === "function") {
|
|
||||||
success(data.authToken)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
error: function () {
|
},
|
||||||
keep_polling = false;
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
|
if (textStatus !== "timeout") {
|
||||||
closePlexOAuthWindow();
|
closePlexOAuthWindow();
|
||||||
if (typeof error === "function") {
|
if (typeof error === "function") {
|
||||||
error()
|
error()
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
complete: function () {
|
},
|
||||||
if (keep_polling){
|
complete: function () {
|
||||||
poll();
|
if (!plex_oauth_window.closed && polling === pin){
|
||||||
} else {
|
setTimeout(function() {poll()}, 1000);
|
||||||
clearTimeout(polling);
|
}
|
||||||
}
|
},
|
||||||
},
|
timeout: 10000
|
||||||
timeout: 1000
|
});
|
||||||
});
|
|
||||||
}, 1000);
|
|
||||||
})();
|
})();
|
||||||
}, function () {
|
}, function () {
|
||||||
closePlexOAuthWindow();
|
closePlexOAuthWindow();
|
||||||
|
@@ -90,6 +90,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<select class="form-control pms-settings selectize-pms-ip" id="pms_ip_selectize">
|
<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']}"
|
<option value="${config['pms_ip']}:${config['pms_port']}"
|
||||||
data-identifier="${config['pms_identifier']}"
|
data-identifier="${config['pms_identifier']}"
|
||||||
data-ip="${config['pms_ip']}"
|
data-ip="${config['pms_ip']}"
|
||||||
@@ -99,6 +100,7 @@
|
|||||||
data-is_cloud="${config['pms_is_cloud']}"
|
data-is_cloud="${config['pms_is_cloud']}"
|
||||||
data-label="${config['pms_name'] or 'Local'}"
|
data-label="${config['pms_name'] or 'Local'}"
|
||||||
selected>${config['pms_ip']}</option>
|
selected>${config['pms_ip']}</option>
|
||||||
|
% endif
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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
|
# - 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:
|
# - 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
|
# sudo chown tautulli:tautulli -R /opt/Tautulli
|
||||||
#
|
#
|
||||||
# - Adjust ExecStart= to point to:
|
# - Adjust ExecStart= to point to:
|
||||||
@@ -51,7 +52,7 @@ ExecStart=/opt/Tautulli/Tautulli.py --config /opt/Tautulli/config.ini --datadir
|
|||||||
GuessMainPID=no
|
GuessMainPID=no
|
||||||
Type=forking
|
Type=forking
|
||||||
User=tautulli
|
User=tautulli
|
||||||
Group=tautlli
|
Group=tautulli
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
@@ -140,21 +140,13 @@ def initialize(config_file):
|
|||||||
if not CONFIG.HTTPS_KEY:
|
if not CONFIG.HTTPS_KEY:
|
||||||
CONFIG.HTTPS_KEY = os.path.join(DATA_DIR, 'server.key')
|
CONFIG.HTTPS_KEY = os.path.join(DATA_DIR, 'server.key')
|
||||||
|
|
||||||
if not CONFIG.LOG_DIR:
|
CONFIG.LOG_DIR, log_writable = check_folder_writable(
|
||||||
CONFIG.LOG_DIR = os.path.join(DATA_DIR, 'logs')
|
CONFIG.LOG_DIR, os.path.join(DATA_DIR, 'logs'), 'logs')
|
||||||
|
if not log_writable and not QUIET:
|
||||||
if not os.path.exists(CONFIG.LOG_DIR):
|
sys.stderr.write("Unable to create the log directory. Logging to screen only.\n")
|
||||||
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")
|
|
||||||
|
|
||||||
# Start the logger, disable console if needed
|
# 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)
|
verbose=VERBOSE)
|
||||||
|
|
||||||
logger.info(u"Starting Tautulli {}".format(
|
logger.info(u"Starting Tautulli {}".format(
|
||||||
@@ -177,29 +169,12 @@ def initialize(config_file):
|
|||||||
DB_FILE
|
DB_FILE
|
||||||
))
|
))
|
||||||
|
|
||||||
if not CONFIG.BACKUP_DIR:
|
CONFIG.BACKUP_DIR, _ = check_folder_writable(
|
||||||
CONFIG.BACKUP_DIR = os.path.join(DATA_DIR, 'backups')
|
CONFIG.BACKUP_DIR, os.path.join(DATA_DIR, 'backups'), 'backups')
|
||||||
if not os.path.exists(CONFIG.BACKUP_DIR):
|
CONFIG.CACHE_DIR, _ = check_folder_writable(
|
||||||
try:
|
CONFIG.CACHE_DIR, os.path.join(DATA_DIR, 'cache'), 'cache')
|
||||||
os.makedirs(CONFIG.BACKUP_DIR)
|
CONFIG.NEWSLETTER_DIR, _ = check_folder_writable(
|
||||||
except OSError as e:
|
CONFIG.NEWSLETTER_DIR, os.path.join(DATA_DIR, 'newsletters'), 'newsletters')
|
||||||
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))
|
|
||||||
|
|
||||||
# Initialize the database
|
# Initialize the database
|
||||||
logger.info(u"Checking if the database upgrades are required...")
|
logger.info(u"Checking if the database upgrades are required...")
|
||||||
@@ -1974,3 +1949,29 @@ def analytics_event(category, action, label=None, value=None, **kwargs):
|
|||||||
TRACKER.send('event', data)
|
TRACKER.send('event', data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warn(u"Failed to send analytics event for category '%s', action '%s': %s" % (category, action, 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
|
||||||
|
@@ -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': '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': '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': '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': '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': '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.'},
|
{'name': 'Actors', 'type': 'str', 'value': 'actors', 'description': 'A list of actors for the item.'},
|
||||||
|
@@ -926,7 +926,7 @@ class DataFactory(object):
|
|||||||
pre_tautulli = 0
|
pre_tautulli = 0
|
||||||
|
|
||||||
# For backwards compatibility. Pick one new Tautulli key to check and override with old values.
|
# 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_video_resolution'] = item['video_resolution']
|
||||||
item['stream_container'] = item['transcode_container'] or item['container']
|
item['stream_container'] = item['transcode_container'] or item['container']
|
||||||
item['stream_video_decision'] = item['video_decision']
|
item['stream_video_decision'] = item['video_decision']
|
||||||
|
@@ -130,6 +130,32 @@ class PublicIPFilter(logging.Filter):
|
|||||||
return True
|
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
|
@contextlib.contextmanager
|
||||||
def listener():
|
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:
|
for handler in logger.handlers + logger_api.handlers + logger_plex_websocket.handlers:
|
||||||
handler.addFilter(BlacklistFilter())
|
handler.addFilter(BlacklistFilter())
|
||||||
handler.addFilter(PublicIPFilter())
|
handler.addFilter(PublicIPFilter())
|
||||||
|
handler.addFilter(PlexTokenFilter())
|
||||||
|
|
||||||
# Install exception hooks
|
# Install exception hooks
|
||||||
initHooks()
|
initHooks()
|
||||||
|
@@ -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)
|
logger.error(u"Tautulli NotificationHandler :: Unable to parse custom script arguments: %s. Using fallback." % e)
|
||||||
script_args = []
|
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:
|
if body:
|
||||||
try:
|
try:
|
||||||
body = json.loads(body)
|
body = json.loads(body)
|
||||||
@@ -1076,15 +1085,6 @@ def build_notify_text(subject='', body='', notify_action=None, parameters=None,
|
|||||||
body = ''
|
body = ''
|
||||||
|
|
||||||
else:
|
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:
|
try:
|
||||||
body = custom_formatter.format(unicode(body), **parameters)
|
body = custom_formatter.format(unicode(body), **parameters)
|
||||||
except LookupError as e:
|
except LookupError as e:
|
||||||
|
@@ -2091,25 +2091,26 @@ class JOIN(Notifier):
|
|||||||
if self.config['api_key']:
|
if self.config['api_key']:
|
||||||
params = {'apikey': 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:
|
else:
|
||||||
error_msg = response_data.get('errorMessage')
|
logger.error(u"Tautulli Notifiers :: Unable to retrieve {name} devices list: [{r.status_code}] {r.reason}".format(name=self.NAME, r=r))
|
||||||
logger.info(u"Tautulli Notifiers :: Unable to retrieve {name} devices list: {msg}".format(name=self.NAME, msg=error_msg))
|
logger.debug(u"Tautulli Notifiers :: Request response: {}".format(request.server_message(r, True)))
|
||||||
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
|
|
||||||
|
|
||||||
else:
|
except Exception as e:
|
||||||
return devices
|
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):
|
def return_config_options(self):
|
||||||
config_option = [{'label': 'Join API Key',
|
config_option = [{'label': 'Join API Key',
|
||||||
@@ -2679,27 +2680,28 @@ class PUSHBULLET(Notifier):
|
|||||||
return self.make_request('https://api.pushbullet.com/v2/pushes', headers=headers, json=data)
|
return self.make_request('https://api.pushbullet.com/v2/pushes', headers=headers, json=data)
|
||||||
|
|
||||||
def get_devices(self):
|
def get_devices(self):
|
||||||
|
devices = {'': ''}
|
||||||
|
|
||||||
if self.config['api_key']:
|
if self.config['api_key']:
|
||||||
headers = {'Content-type': "application/json",
|
headers = {'Content-type': "application/json",
|
||||||
'Access-Token': self.config['api_key']
|
'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:
|
except Exception as e:
|
||||||
response_data = r.json()
|
logger.error(u"Tautulli Notifiers :: Unable to retrieve {name} devices list: {msg}".format(name=self.NAME, msg=e))
|
||||||
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 {'': ''}
|
|
||||||
|
|
||||||
else:
|
return devices
|
||||||
return {'': ''}
|
|
||||||
|
|
||||||
def return_config_options(self):
|
def return_config_options(self):
|
||||||
config_option = [{'label': 'Pushbullet Access Token',
|
config_option = [{'label': 'Pushbullet Access Token',
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
PLEXPY_BRANCH = "master"
|
PLEXPY_BRANCH = "master"
|
||||||
PLEXPY_RELEASE_VERSION = "v2.1.20"
|
PLEXPY_RELEASE_VERSION = "v2.1.22"
|
||||||
|
@@ -2990,7 +2990,8 @@ class WebInterface(object):
|
|||||||
# Get new server URLs for SSL communications and get new server friendly name
|
# Get new server URLs for SSL communications and get new server friendly name
|
||||||
if server_changed:
|
if server_changed:
|
||||||
plextv.get_server_resources()
|
plextv.get_server_resources()
|
||||||
web_socket.reconnect()
|
if plexpy.WS_CONNECTED:
|
||||||
|
web_socket.reconnect()
|
||||||
|
|
||||||
# If first run, start websocket
|
# If first run, start websocket
|
||||||
if first_run:
|
if first_run:
|
||||||
|
@@ -67,6 +67,10 @@ def initialize(options):
|
|||||||
else:
|
else:
|
||||||
protocol = "http"
|
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']:
|
if options['http_password']:
|
||||||
login_allowed = ["Tautulli admin (username is '%s')" % options['http_username']]
|
login_allowed = ["Tautulli admin (username is '%s')" % options['http_username']]
|
||||||
if plexpy.CONFIG.HTTP_PLEX_ADMIN:
|
if plexpy.CONFIG.HTTP_PLEX_ADMIN:
|
||||||
@@ -80,7 +84,7 @@ def initialize(options):
|
|||||||
else:
|
else:
|
||||||
auth_enabled = True
|
auth_enabled = True
|
||||||
basic_auth_enabled = False
|
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:
|
else:
|
||||||
auth_enabled = basic_auth_enabled = False
|
auth_enabled = basic_auth_enabled = False
|
||||||
|
|
||||||
@@ -94,7 +98,7 @@ def initialize(options):
|
|||||||
conf = {
|
conf = {
|
||||||
'/': {
|
'/': {
|
||||||
'tools.staticdir.root': os.path.join(plexpy.PROG_DIR, 'data'),
|
'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.on': True,
|
||||||
'tools.gzip.mime_types': ['text/html', 'text/plain', 'text/css',
|
'tools.gzip.mime_types': ['text/html', 'text/plain', 'text/css',
|
||||||
'text/javascript', 'application/json',
|
'text/javascript', 'application/json',
|
||||||
@@ -226,3 +230,26 @@ class BaseRedirect(object):
|
|||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def index(self):
|
def index(self):
|
||||||
raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT)
|
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