Beta Plex Cloud support

This commit is contained in:
JonnyWong16 2017-12-31 19:44:01 -08:00
parent 6c6493fe31
commit 83f1519932
4 changed files with 40 additions and 17 deletions

View file

@ -528,9 +528,16 @@
</div>
<div class="checkbox">
% if config['pms_is_cloud']:
<label>
<input type="checkbox" id="monitor_pms_updates" name="monitor_pms_updates" value="1" disabled> Monitor Plex Updates
</label>
<span style="color: #eb8600; padding-left: 10px;"> Not available for Plex Cloud servers.</span>
% else:
<label>
<input type="checkbox" id="monitor_pms_updates" name="monitor_pms_updates" value="1" ${config['monitor_pms_updates']}> Monitor Plex Updates
</label>
% endif
<p class="help-block">Enable to have Tautulli check if updates are available for the Plex Media Server.</p>
</div>
<div id="pms_update_options">
@ -552,10 +559,17 @@
</div>
</div>
<div class="checkbox">
% if config['pms_is_cloud']:
<label>
<input type="checkbox" id="monitor_remote_access" name="monitor_remote_access" value="1" disabled> Monitor Plex Remote Access
</label>
<span style="color: #eb8600; padding-left: 10px;"> Not available for Plex Cloud servers.</span>
% else:
<label>
<input type="checkbox" id="monitor_remote_access" name="monitor_remote_access" value="1" ${config['monitor_remote_access']}> Monitor Plex Remote Access
</label>
<span id="remoteAccessCheck" style="color: #eb8600; padding-left: 10px;"></span>
% endif
<p class="help-block">Enable to have Tautulli check if remote access to the Plex Media Server goes down.</p>
</div>
@ -598,9 +612,16 @@
<p class="help-block">If you have secure connections enabled on your Plex Server, communicate with it securely.</p>
</div>
<div class="checkbox">
% if config['pms_is_cloud']:
<label>
<input type="checkbox" id="pms_url_manual" name="pms_url_manual" value="1" disabled> Manual Connection
</label>
<span style="color: #eb8600; padding-left: 10px;"> Not available for Plex Cloud servers.</span>
% else:
<label>
<input type="checkbox" id="pms_url_manual" name="pms_url_manual" value="1" ${config['pms_url_manual']}> Manual Connection
</label>
% endif
<p class="help-block">Use the user defined connection details. Do not retrieve the server connection URL automatically.</p>
</div>
<div class="form-group">

View file

@ -51,7 +51,7 @@
<form>
<div class="wizard-card" data-cardname="card1">
<div style="float: right;">
<img alt="Tautulli" src="${http_root}images/logo-tautulli-50.png" />
<object data="${http_root}images/logo-tautulli.svg" type="image/svg+xml" style="height: 45px;"></object>
</div>
<h3 style="line-height: 50px;">Welcome!</h3>
<br />
@ -469,9 +469,9 @@
function getServerOptions(token) {
/* Set token and returns server options */
$.ajax({
url: "discover/" + token + '?include_cloud=false',
url: "discover/" + token,
success: function (result) {
$('#pms_ip').html("")
$('#pms_ip').html("");
// Add all servers to the "combobox"
$select_pms[0].selectize.addOption(result);
}

View file

@ -121,18 +121,19 @@ class PlexTV(object):
self.timeout = plexpy.CONFIG.PMS_TIMEOUT
self.ssl_verify = plexpy.CONFIG.VERIFY_SSL_CERT
if not self.token:
# Check if we should use the admin token, or the guest server token
if session.get_session_user_id():
user_data = users.Users()
user_tokens = user_data.get_tokens(user_id=session.get_session_user_id())
self.token = user_tokens['server_token']
else:
self.token = plexpy.CONFIG.PMS_TOKEN
if self.username is None and self.password is None:
if not self.token:
# Check if we should use the admin token, or the guest server token
if session.get_session_user_id():
user_data = users.Users()
user_tokens = user_data.get_tokens(user_id=session.get_session_user_id())
self.token = user_tokens['server_token']
else:
self.token = plexpy.CONFIG.PMS_TOKEN
if not self.token:
logger.error(u"Tautulli PlexTV :: PlexTV called, but no token provided.")
return
if not self.token:
logger.error(u"Tautulli PlexTV :: PlexTV called, but no token provided.")
return
self.request_handler = http_handler.HTTPHandler(urls=self.urls,
token=self.token,
@ -606,7 +607,8 @@ class PlexTV(object):
helpers.get_xml_attr(d, 'owned') == '1' and \
helpers.get_xml_attr(d, 'provides') == 'server':
if not include_cloud and helpers.get_xml_attr(d, 'platform').lower() == 'cloud':
is_cloud = (helpers.get_xml_attr(d, 'platform').lower() == 'cloud')
if not include_cloud and is_cloud:
continue
connections = d.getElementsByTagName('Connection')
@ -623,7 +625,7 @@ class PlexTV(object):
helpers.get_xml_attr(c, 'local') == '0':
continue
server = {'httpsRequired': helpers.get_xml_attr(d, 'httpsRequired'),
server = {'httpsRequired': '1' if is_cloud else helpers.get_xml_attr(d, 'httpsRequired'),
'clientIdentifier': helpers.get_xml_attr(d, 'clientIdentifier'),
'label': helpers.get_xml_attr(d, 'name'),
'ip': helpers.get_xml_attr(c, 'address'),

View file

@ -148,7 +148,7 @@ class WebInterface(object):
plexpy.CONFIG.write()
include_cloud = not (include_cloud == 'false')
all_servers = all_servers == 'true'
all_servers = (all_servers == 'true')
plex_tv = plextv.PlexTV()
servers_list = plex_tv.discover(include_cloud=include_cloud,