Merge branch 'dev'
11
CHANGELOG.md
|
@ -1,5 +1,16 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v1.3.15 (2016-04-18)
|
||||||
|
|
||||||
|
* Fix: Slack notifications failing when using and icon URL.
|
||||||
|
* Fix: 127.0.0.1 showing as an external IP address on the history tables.
|
||||||
|
* Fix: Regression file sizes not shown in the media info table footer.
|
||||||
|
* Fix: Retrieving proper PMS URL when multiple connections are published to plex.tv.
|
||||||
|
* Fix: Some typos in the logger.
|
||||||
|
* Fix: Some other typos in the WebUI. (Thanks @xtjoeytx)
|
||||||
|
* Change: Optimized mobile web app icons and spash screens. (Thanks @alotufo)
|
||||||
|
|
||||||
|
|
||||||
## v1.3.14 (2016-03-29)
|
## v1.3.14 (2016-03-29)
|
||||||
|
|
||||||
* Fix: Regression for missing notify_action for script notifications.
|
* Fix: Regression for missing notify_action for script notifications.
|
||||||
|
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 391 KiB After Width: | Height: | Size: 349 KiB |
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 148 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
Before Width: | Height: | Size: 5.2 MiB After Width: | Height: | Size: 4.4 MiB |
Before Width: | Height: | Size: 5.2 MiB After Width: | Height: | Size: 4.5 MiB |
Before Width: | Height: | Size: 6.2 MiB After Width: | Height: | Size: 4.7 MiB |
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.4 MiB |
Before Width: | Height: | Size: 6.2 MiB After Width: | Height: | Size: 4.6 MiB |
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.4 MiB |
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 137 KiB |
Before Width: | Height: | Size: 977 KiB After Width: | Height: | Size: 788 KiB |
Before Width: | Height: | Size: 207 KiB After Width: | Height: | Size: 167 KiB |
Before Width: | Height: | Size: 457 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 461 KiB After Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 455 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 458 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 456 KiB After Width: | Height: | Size: 3 KiB |
Before Width: | Height: | Size: 460 KiB After Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 466 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 457 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 463 KiB After Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 458 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 464 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 454 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 456 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 456 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 461 KiB After Width: | Height: | Size: 7.4 KiB |
|
@ -39,7 +39,6 @@ function showMsg(msg,loader,timeout,ms,error) {
|
||||||
}
|
}
|
||||||
if (error) {
|
if (error) {
|
||||||
feedback.css("background-color", "rgba(255,0,0,0.5)");
|
feedback.css("background-color", "rgba(255,0,0,0.5)");
|
||||||
console.log('is error');
|
|
||||||
}
|
}
|
||||||
$(feedback).html(message);
|
$(feedback).html(message);
|
||||||
feedback.fadeIn();
|
feedback.fadeIn();
|
||||||
|
@ -48,7 +47,8 @@ function showMsg(msg,loader,timeout,ms,error) {
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
message.fadeOut(function(){
|
message.fadeOut(function(){
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
feedback.fadeOut();
|
feedback.fadeOut();
|
||||||
|
feedback.css("background-color", "");
|
||||||
});
|
});
|
||||||
},ms);
|
},ms);
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,8 @@ function isPrivateIP(ip_address) {
|
||||||
// get IPv4 mapped address (xxx.xxx.xxx.xxx) from IPv6 addresss (::ffff:xxx.xxx.xxx.xxx)
|
// get IPv4 mapped address (xxx.xxx.xxx.xxx) from IPv6 addresss (::ffff:xxx.xxx.xxx.xxx)
|
||||||
var parts = ip_address.split(":");
|
var parts = ip_address.split(":");
|
||||||
var parts = parts[parts.length - 1].split('.');
|
var parts = parts[parts.length - 1].split('.');
|
||||||
if (parts[0] === '10' ||
|
if ((parts[0] === '127' && parts[1] === '0' && parts[2] === '0' && parts[3] === '1') ||
|
||||||
|
(parts[0] === '10') ||
|
||||||
(parts[0] === '172' && (parseInt(parts[1], 10) >= 16 && parseInt(parts[1], 10) <= 31)) ||
|
(parts[0] === '172' && (parseInt(parts[1], 10) >= 16 && parseInt(parts[1], 10) <= 31)) ||
|
||||||
(parts[0] === '192' && parts[1] === '168')) {
|
(parts[0] === '192' && parts[1] === '168')) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -276,7 +276,7 @@ media_info_table_options = {
|
||||||
get_file_sizes = false;
|
get_file_sizes = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#media_info_table_info").append('<span class="hidden-md hidden-sm hidden-xs"> with a total file size of ' +
|
$("#media_info_table-SID-" + section_id + "_info").append('<span class="hidden-md hidden-sm hidden-xs"> with a total file size of ' +
|
||||||
Math.round(settings.json.filtered_file_size / Math.pow(1024, 3)).toString() + ' GiB' +
|
Math.round(settings.json.filtered_file_size / Math.pow(1024, 3)).toString() + ' GiB' +
|
||||||
' (filtered from ' + Math.round(settings.json.total_file_size / Math.pow(1024, 3)).toString() + ' GiB)</span>');
|
' (filtered from ' + Math.round(settings.json.total_file_size / Math.pow(1024, 3)).toString() + ' GiB)</span>');
|
||||||
},
|
},
|
||||||
|
|
|
@ -832,7 +832,7 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
|
||||||
</div>
|
</div>
|
||||||
<div id="notify_recently_added_delay_error" class="alert alert-danger settings-alert" role="alert"></div>
|
<div id="notify_recently_added_delay_error" class="alert alert-danger settings-alert" role="alert"></div>
|
||||||
</div>
|
</div>
|
||||||
<p class="help-block">Set the delay for recently added notifications to allow metadata to be processed. Minimum 60 seconds.</p>
|
<p class="help-block">Set the delay (in seconds) for recently added notifications to allow metadata to be processed. Minimum 60 seconds.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="padded-header">
|
<div class="padded-header">
|
||||||
|
@ -1484,6 +1484,10 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>{user}</strong></td>
|
<td><strong>{user}</strong></td>
|
||||||
|
<td>The friendly name of the person streaming.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><strong>{username}</strong></td>
|
||||||
<td>The username of the person streaming.</td>
|
<td>The username of the person streaming.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -1604,7 +1608,11 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>{session_key}</strong></td>
|
<td><strong>{session_key}</strong></td>
|
||||||
<td>The unique identifier for the session.</td>
|
<td>The unique identifier for the stream session.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><strong>{transcode_key}</strong></td>
|
||||||
|
<td>The unique identifier for the transcode session.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>{user_id}</strong></td>
|
<td><strong>{user_id}</strong></td>
|
||||||
|
|
|
@ -127,7 +127,7 @@ from plexpy import common
|
||||||
</div>
|
</div>
|
||||||
<div class="wizard-card" data-cardname="card5" data-validate="validateNotifications">
|
<div class="wizard-card" data-cardname="card5" data-validate="validateNotifications">
|
||||||
<h3>Notifications</h3>
|
<h3>Notifications</h3>
|
||||||
<p class="help-block">PlexPy supports a wide variety of notification options. To set up a notification agent conifgure this in <strong>Settings -> Notification Agents</strong>
|
<p class="help-block">PlexPy supports a wide variety of notification options. To set up a notification agent configure this in <strong>Settings -> Notification Agents</strong>
|
||||||
after you have completed this setup wizard.</p><br/>
|
after you have completed this setup wizard.</p><br/>
|
||||||
<div class="wizard-input-section">
|
<div class="wizard-input-section">
|
||||||
<input type="checkbox" name="movie_notify_enable" id="movie_notify_enable" value="1" ${config['movie_notify_enable']}> Enable notifications on Movie playback
|
<input type="checkbox" name="movie_notify_enable" id="movie_notify_enable" value="1" ${config['movie_notify_enable']}> Enable notifications on Movie playback
|
||||||
|
|
|
@ -396,8 +396,8 @@ def dbcheck():
|
||||||
|
|
||||||
# sessions table :: This is a temp table that logs currently active sessions
|
# sessions table :: This is a temp table that logs currently active sessions
|
||||||
c_db.execute(
|
c_db.execute(
|
||||||
'CREATE TABLE IF NOT EXISTS sessions (id INTEGER PRIMARY KEY AUTOINCREMENT, '
|
'CREATE TABLE IF NOT EXISTS sessions (id INTEGER PRIMARY KEY AUTOINCREMENT, session_key INTEGER, '
|
||||||
'session_key INTEGER, rating_key INTEGER, section_id INTEGER, media_type TEXT, started INTEGER, stopped INTEGER, '
|
'transcode_key TEXT, rating_key INTEGER, section_id INTEGER, media_type TEXT, started INTEGER, stopped INTEGER, '
|
||||||
'paused_counter INTEGER DEFAULT 0, state TEXT, user_id INTEGER, user TEXT, friendly_name TEXT, '
|
'paused_counter INTEGER DEFAULT 0, state TEXT, user_id INTEGER, user TEXT, friendly_name TEXT, '
|
||||||
'ip_address TEXT, machine_id TEXT, player TEXT, platform TEXT, title TEXT, parent_title TEXT, '
|
'ip_address TEXT, machine_id TEXT, player TEXT, platform TEXT, title TEXT, parent_title TEXT, '
|
||||||
'grandparent_title TEXT, parent_rating_key INTEGER, grandparent_rating_key INTEGER, '
|
'grandparent_title TEXT, parent_rating_key INTEGER, grandparent_rating_key INTEGER, '
|
||||||
|
@ -630,6 +630,15 @@ def dbcheck():
|
||||||
'ALTER TABLE sessions ADD COLUMN stopped INTEGER'
|
'ALTER TABLE sessions ADD COLUMN stopped INTEGER'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Upgrade sessions table from earlier versions
|
||||||
|
try:
|
||||||
|
c_db.execute('SELECT transcode_key FROM sessions')
|
||||||
|
except sqlite3.OperationalError:
|
||||||
|
logger.debug(u"Altering database. Updating database table sessions.")
|
||||||
|
c_db.execute(
|
||||||
|
'ALTER TABLE sessions ADD COLUMN transcode_key TEXT'
|
||||||
|
)
|
||||||
|
|
||||||
# Upgrade session_history table from earlier versions
|
# Upgrade session_history table from earlier versions
|
||||||
try:
|
try:
|
||||||
c_db.execute('SELECT reference_id FROM session_history')
|
c_db.execute('SELECT reference_id FROM session_history')
|
||||||
|
|
|
@ -29,6 +29,7 @@ class ActivityProcessor(object):
|
||||||
def write_session(self, session=None, notify=True):
|
def write_session(self, session=None, notify=True):
|
||||||
if session:
|
if session:
|
||||||
values = {'session_key': session['session_key'],
|
values = {'session_key': session['session_key'],
|
||||||
|
'transcode_key': session['transcode_key'],
|
||||||
'section_id': session['section_id'],
|
'section_id': session['section_id'],
|
||||||
'rating_key': session['rating_key'],
|
'rating_key': session['rating_key'],
|
||||||
'media_type': session['media_type'],
|
'media_type': session['media_type'],
|
||||||
|
|
|
@ -598,4 +598,4 @@ class Config(object):
|
||||||
self.NOTIFY_ON_WATCHED_SUBJECT_TEXT = self.NOTIFY_ON_WATCHED_SUBJECT_TEXT.replace('{progress}','{progress_duration}')
|
self.NOTIFY_ON_WATCHED_SUBJECT_TEXT = self.NOTIFY_ON_WATCHED_SUBJECT_TEXT.replace('{progress}','{progress_duration}')
|
||||||
self.NOTIFY_ON_WATCHED_BODY_TEXT = self.NOTIFY_ON_WATCHED_BODY_TEXT.replace('{progress}','{progress_duration}')
|
self.NOTIFY_ON_WATCHED_BODY_TEXT = self.NOTIFY_ON_WATCHED_BODY_TEXT.replace('{progress}','{progress_duration}')
|
||||||
self.NOTIFY_SCRIPTS_ARGS_TEXT = self.NOTIFY_SCRIPTS_ARGS_TEXT.replace('{progress}','{progress_duration}')
|
self.NOTIFY_SCRIPTS_ARGS_TEXT = self.NOTIFY_SCRIPTS_ARGS_TEXT.replace('{progress}','{progress_duration}')
|
||||||
self.CONFIG_VERSION = '3'
|
self.CONFIG_VERSION = '3'
|
|
@ -463,12 +463,8 @@ def build_notify_text(session=None, timeline=None, notify_action=None, agent_id=
|
||||||
plex_tv = plextv.PlexTV()
|
plex_tv = plextv.PlexTV()
|
||||||
server_times = plex_tv.get_server_times()
|
server_times = plex_tv.get_server_times()
|
||||||
|
|
||||||
# Get the server version
|
|
||||||
pms_connect = pmsconnect.PmsConnect()
|
|
||||||
server_identity = pms_connect.get_server_identity()
|
|
||||||
|
|
||||||
if server_times:
|
if server_times:
|
||||||
updated_at = server_times[0]['updated_at']
|
updated_at = server_times['updated_at']
|
||||||
server_uptime = helpers.human_duration(int(time.time() - helpers.cast_to_int(updated_at)))
|
server_uptime = helpers.human_duration(int(time.time() - helpers.cast_to_int(updated_at)))
|
||||||
else:
|
else:
|
||||||
logger.error(u"PlexPy NotificationHandler :: Unable to retrieve server uptime.")
|
logger.error(u"PlexPy NotificationHandler :: Unable to retrieve server uptime.")
|
||||||
|
@ -653,13 +649,14 @@ def build_notify_text(session=None, timeline=None, notify_action=None, agent_id=
|
||||||
available_params = {# Global paramaters
|
available_params = {# Global paramaters
|
||||||
'server_name': server_name,
|
'server_name': server_name,
|
||||||
'server_uptime': server_uptime,
|
'server_uptime': server_uptime,
|
||||||
'server_version': server_identity.get('version',''),
|
'server_version': server_times.get('version',''),
|
||||||
'action': notify_action.title(),
|
'action': notify_action.title(),
|
||||||
'datestamp': arrow.now().format(date_format),
|
'datestamp': arrow.now().format(date_format),
|
||||||
'timestamp': arrow.now().format(time_format),
|
'timestamp': arrow.now().format(time_format),
|
||||||
# Stream parameters
|
# Stream parameters
|
||||||
'streams': stream_count,
|
'streams': stream_count,
|
||||||
'user': session.get('friendly_name',''),
|
'user': session.get('friendly_name',''),
|
||||||
|
'username': session.get('user',''),
|
||||||
'platform': session.get('platform',''),
|
'platform': session.get('platform',''),
|
||||||
'player': session.get('player',''),
|
'player': session.get('player',''),
|
||||||
'ip_address': session.get('ip_address','N/A'),
|
'ip_address': session.get('ip_address','N/A'),
|
||||||
|
@ -690,6 +687,7 @@ def build_notify_text(session=None, timeline=None, notify_action=None, agent_id=
|
||||||
'transcode_audio_codec': session.get('transcode_audio_codec',''),
|
'transcode_audio_codec': session.get('transcode_audio_codec',''),
|
||||||
'transcode_audio_channels': session.get('transcode_audio_channels',''),
|
'transcode_audio_channels': session.get('transcode_audio_channels',''),
|
||||||
'session_key': session.get('session_key',''),
|
'session_key': session.get('session_key',''),
|
||||||
|
'transcode_key': session.get('transcode_key',''),
|
||||||
'user_id': session.get('user_id',''),
|
'user_id': session.get('user_id',''),
|
||||||
'machine_id': session.get('machine_id',''),
|
'machine_id': session.get('machine_id',''),
|
||||||
# Metadata parameters
|
# Metadata parameters
|
||||||
|
@ -743,9 +741,9 @@ def build_notify_text(session=None, timeline=None, notify_action=None, agent_id=
|
||||||
try:
|
try:
|
||||||
script_args = [unicode(arg).format(**available_params) for arg in script_args_text.split()]
|
script_args = [unicode(arg).format(**available_params) for arg in script_args_text.split()]
|
||||||
except LookupError as e:
|
except LookupError as e:
|
||||||
logger.error(u"PlexPy Notifier :: Unable to parse field %s in script argument. Using fallback." % e)
|
logger.error(u"PlexPy NotificationHandler :: Unable to parse field %s in script argument. Using fallback." % e)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(u"PlexPy Notifier :: Unable to parse custom script arguments %s. Using fallback." % e)
|
logger.error(u"PlexPy NotificationHandler :: Unable to parse custom script arguments %s. Using fallback." % e)
|
||||||
|
|
||||||
if notify_action == 'play':
|
if notify_action == 'play':
|
||||||
# Default body text
|
# Default body text
|
||||||
|
@ -929,16 +927,12 @@ def build_server_notify_text(notify_action=None, agent_id=None):
|
||||||
plex_tv = plextv.PlexTV()
|
plex_tv = plextv.PlexTV()
|
||||||
server_times = plex_tv.get_server_times()
|
server_times = plex_tv.get_server_times()
|
||||||
|
|
||||||
# Get the server version
|
|
||||||
pms_connect = pmsconnect.PmsConnect()
|
|
||||||
server_identity = pms_connect.get_server_identity()
|
|
||||||
|
|
||||||
update_status = {}
|
update_status = {}
|
||||||
if notify_action == 'pmsupdate':
|
if notify_action == 'pmsupdate':
|
||||||
update_status = pms_connect.get_update_staus()
|
update_status = pms_connect.get_update_staus()
|
||||||
|
|
||||||
if server_times:
|
if server_times:
|
||||||
updated_at = server_times[0]['updated_at']
|
updated_at = server_times['updated_at']
|
||||||
server_uptime = helpers.human_duration(int(time.time() - helpers.cast_to_int(updated_at)))
|
server_uptime = helpers.human_duration(int(time.time() - helpers.cast_to_int(updated_at)))
|
||||||
else:
|
else:
|
||||||
logger.error(u"PlexPy NotificationHandler :: Unable to retrieve server uptime.")
|
logger.error(u"PlexPy NotificationHandler :: Unable to retrieve server uptime.")
|
||||||
|
@ -961,7 +955,7 @@ def build_server_notify_text(notify_action=None, agent_id=None):
|
||||||
available_params = {# Global paramaters
|
available_params = {# Global paramaters
|
||||||
'server_name': server_name,
|
'server_name': server_name,
|
||||||
'server_uptime': server_uptime,
|
'server_uptime': server_uptime,
|
||||||
'server_version': server_identity.get('version',''),
|
'server_version': server_times.get('version',''),
|
||||||
'action': notify_action.title(),
|
'action': notify_action.title(),
|
||||||
'datestamp': arrow.now().format(date_format),
|
'datestamp': arrow.now().format(date_format),
|
||||||
'timestamp': arrow.now().format(time_format),
|
'timestamp': arrow.now().format(time_format),
|
||||||
|
@ -980,9 +974,9 @@ def build_server_notify_text(notify_action=None, agent_id=None):
|
||||||
try:
|
try:
|
||||||
script_args = [unicode(arg).format(**available_params) for arg in script_args_text.split()]
|
script_args = [unicode(arg).format(**available_params) for arg in script_args_text.split()]
|
||||||
except LookupError as e:
|
except LookupError as e:
|
||||||
logger.error(u"PlexPy Notifier :: Unable to parse field %s in script argument. Using fallback." % e)
|
logger.error(u"PlexPy NotificationHandler :: Unable to parse field %s in script argument. Using fallback." % e)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(u"PlexPy Notifier :: Unable to parse custom script arguments %s. Using fallback." % e)
|
logger.error(u"PlexPy NotificationHandler :: Unable to parse custom script arguments %s. Using fallback." % e)
|
||||||
|
|
||||||
if notify_action == 'extdown':
|
if notify_action == 'extdown':
|
||||||
# Default body text
|
# Default body text
|
||||||
|
|
|
@ -1776,7 +1776,7 @@ class SLACK(object):
|
||||||
if urlparse(self.icon_emoji).scheme == '':
|
if urlparse(self.icon_emoji).scheme == '':
|
||||||
data['icon_emoji'] = self.icon_emoji
|
data['icon_emoji'] = self.icon_emoji
|
||||||
else:
|
else:
|
||||||
data['icon_url'] = self.icon_url
|
data['icon_url'] = self.icon_emoji
|
||||||
|
|
||||||
url = urlparse(self.slack_hook).path
|
url = urlparse(self.slack_hook).path
|
||||||
|
|
||||||
|
@ -1884,7 +1884,7 @@ class Scripts(object):
|
||||||
script_args(list): ["python2", '-p', '-zomg']
|
script_args(list): ["python2", '-p', '-zomg']
|
||||||
"""
|
"""
|
||||||
logger.debug(u"PlexPy Notifiers :: Trying to run notify script, action: %s, arguments: %s" %
|
logger.debug(u"PlexPy Notifiers :: Trying to run notify script, action: %s, arguments: %s" %
|
||||||
(notify_action if notify_action else None, script_args if script_args else None))
|
(notify_action or None, script_args or None))
|
||||||
|
|
||||||
if script_args is None:
|
if script_args is None:
|
||||||
script_args = []
|
script_args = []
|
||||||
|
|
|
@ -71,32 +71,37 @@ def get_real_pms_url():
|
||||||
|
|
||||||
if plexpy.CONFIG.PMS_SSL:
|
if plexpy.CONFIG.PMS_SSL:
|
||||||
result = PlexTV().get_server_urls(include_https=True)
|
result = PlexTV().get_server_urls(include_https=True)
|
||||||
process_urls = True
|
|
||||||
elif plexpy.CONFIG.PMS_IS_REMOTE:
|
|
||||||
result = PlexTV().get_server_urls(include_https=False)
|
|
||||||
process_urls = True
|
|
||||||
else:
|
else:
|
||||||
result = PlexTV().get_server_urls(include_https=False)
|
result = PlexTV().get_server_urls(include_https=False)
|
||||||
process_urls = False
|
|
||||||
|
|
||||||
if process_urls:
|
# Only need to retrieve PMS_URL if using SSL
|
||||||
|
if plexpy.CONFIG.PMS_SSL:
|
||||||
if result:
|
if result:
|
||||||
for item in result:
|
if plexpy.CONFIG.PMS_IS_REMOTE:
|
||||||
if plexpy.CONFIG.PMS_IS_REMOTE and item['local'] == '0':
|
# Get all remote connections
|
||||||
plexpy.CONFIG.__setattr__('PMS_URL', item['uri'])
|
connections = [c for c in result if c['local'] == '0' and 'plex.direct' in c['uri']]
|
||||||
plexpy.CONFIG.write()
|
else:
|
||||||
logger.info(u"PlexPy PlexTV :: Server URL retrieved.")
|
# Get all local connections
|
||||||
if not plexpy.CONFIG.PMS_IS_REMOTE and item['local'] == '1' and 'plex.direct' in item['uri']:
|
connections = [c for c in result if c['local'] == '1' and 'plex.direct' in c['uri']]
|
||||||
plexpy.CONFIG.__setattr__('PMS_URL', item['uri'])
|
|
||||||
plexpy.CONFIG.write()
|
if connections:
|
||||||
logger.info(u"PlexPy PlexTV :: Server URL retrieved.")
|
# Get connection with matching address, otherwise return first connection
|
||||||
else:
|
conn = next((c for c in connections if c['address'] == plexpy.CONFIG.PMS_IP), connections[0])
|
||||||
|
plexpy.CONFIG.__setattr__('PMS_URL', conn['uri'])
|
||||||
|
plexpy.CONFIG.write()
|
||||||
|
logger.info(u"PlexPy PlexTV :: Server URL retrieved.")
|
||||||
|
|
||||||
|
# get_server_urls() failed or PMS_URL not found, fallback url doesn't use SSL
|
||||||
|
if not plexpy.CONFIG.PMS_URL:
|
||||||
plexpy.CONFIG.__setattr__('PMS_URL', fallback_url)
|
plexpy.CONFIG.__setattr__('PMS_URL', fallback_url)
|
||||||
plexpy.CONFIG.write()
|
plexpy.CONFIG.write()
|
||||||
logger.warn(u"PlexPy PlexTV :: Unable to retrieve server URLs. Using user-defined value.")
|
logger.warn(u"PlexPy PlexTV :: Unable to retrieve server URLs. Using user-defined value without SSL.")
|
||||||
|
|
||||||
|
# Not using SSL, remote has no effect
|
||||||
else:
|
else:
|
||||||
plexpy.CONFIG.__setattr__('PMS_URL', fallback_url)
|
plexpy.CONFIG.__setattr__('PMS_URL', fallback_url)
|
||||||
plexpy.CONFIG.write()
|
plexpy.CONFIG.write()
|
||||||
|
logger.info(u"PlexPy PlexTV :: Using user-defined URL.")
|
||||||
|
|
||||||
|
|
||||||
class PlexTV(object):
|
class PlexTV(object):
|
||||||
|
@ -450,19 +455,20 @@ class PlexTV(object):
|
||||||
|
|
||||||
def get_server_times(self):
|
def get_server_times(self):
|
||||||
servers = self.get_plextv_server_list(output_format='xml')
|
servers = self.get_plextv_server_list(output_format='xml')
|
||||||
server_times = []
|
server_times = {}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
xml_head = servers.getElementsByTagName('Server')
|
xml_head = servers.getElementsByTagName('Server')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warn(u"PlexPy PlexTV :: Unable to parse XML for get_server_times: %s." % e)
|
logger.warn(u"PlexPy PlexTV :: Unable to parse XML for get_server_times: %s." % e)
|
||||||
return []
|
return {}
|
||||||
|
|
||||||
for a in xml_head:
|
for a in xml_head:
|
||||||
if helpers.get_xml_attr(a, 'machineIdentifier') == plexpy.CONFIG.PMS_IDENTIFIER:
|
if helpers.get_xml_attr(a, 'machineIdentifier') == plexpy.CONFIG.PMS_IDENTIFIER:
|
||||||
server_times.append({"created_at": helpers.get_xml_attr(a, 'createdAt'),
|
server_times = {"created_at": helpers.get_xml_attr(a, 'createdAt'),
|
||||||
"updated_at": helpers.get_xml_attr(a, 'updatedAt')
|
"updated_at": helpers.get_xml_attr(a, 'updatedAt'),
|
||||||
})
|
"version": helpers.get_xml_attr(a, 'version')
|
||||||
|
}
|
||||||
break
|
break
|
||||||
|
|
||||||
return server_times
|
return server_times
|
||||||
|
|
|
@ -939,7 +939,7 @@ class PmsConnect(object):
|
||||||
try:
|
try:
|
||||||
xml_head = session_data.getElementsByTagName('MediaContainer')
|
xml_head = session_data.getElementsByTagName('MediaContainer')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warn(u"PlexPy Pmsconnect :: Unable to parse XML for get_sessions: %s." % e)
|
logger.warn(u"PlexPy Pmsconnect :: Unable to parse XML for get_current_activity: %s." % e)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
session_list = []
|
session_list = []
|
||||||
|
@ -1001,6 +1001,7 @@ class PmsConnect(object):
|
||||||
|
|
||||||
if session.getElementsByTagName('TranscodeSession'):
|
if session.getElementsByTagName('TranscodeSession'):
|
||||||
transcode_session = session.getElementsByTagName('TranscodeSession')[0]
|
transcode_session = session.getElementsByTagName('TranscodeSession')[0]
|
||||||
|
transcode_key = helpers.get_xml_attr(transcode_session, 'key')
|
||||||
throttled = helpers.get_xml_attr(transcode_session, 'throttled')
|
throttled = helpers.get_xml_attr(transcode_session, 'throttled')
|
||||||
transcode_progress = helpers.get_xml_attr(transcode_session, 'progress')
|
transcode_progress = helpers.get_xml_attr(transcode_session, 'progress')
|
||||||
transcode_speed = helpers.get_xml_attr(transcode_session, 'speed')
|
transcode_speed = helpers.get_xml_attr(transcode_session, 'speed')
|
||||||
|
@ -1011,6 +1012,7 @@ class PmsConnect(object):
|
||||||
transcode_protocol = helpers.get_xml_attr(transcode_session, 'protocol')
|
transcode_protocol = helpers.get_xml_attr(transcode_session, 'protocol')
|
||||||
duration = helpers.get_xml_attr(transcode_session, 'duration')
|
duration = helpers.get_xml_attr(transcode_session, 'duration')
|
||||||
else:
|
else:
|
||||||
|
transcode_key = ''
|
||||||
throttled = '0'
|
throttled = '0'
|
||||||
transcode_progress = '0'
|
transcode_progress = '0'
|
||||||
transcode_speed = ''
|
transcode_speed = ''
|
||||||
|
@ -1051,6 +1053,7 @@ class PmsConnect(object):
|
||||||
'rating_key': helpers.get_xml_attr(session, 'ratingKey'),
|
'rating_key': helpers.get_xml_attr(session, 'ratingKey'),
|
||||||
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
|
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
|
||||||
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
|
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
|
||||||
|
'transcode_key': transcode_key,
|
||||||
'throttled': throttled,
|
'throttled': throttled,
|
||||||
'transcode_progress': int(round(helpers.cast_to_float(transcode_progress), 0)),
|
'transcode_progress': int(round(helpers.cast_to_float(transcode_progress), 0)),
|
||||||
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
|
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
|
||||||
|
@ -1099,6 +1102,7 @@ class PmsConnect(object):
|
||||||
|
|
||||||
if session.getElementsByTagName('TranscodeSession'):
|
if session.getElementsByTagName('TranscodeSession'):
|
||||||
transcode_session = session.getElementsByTagName('TranscodeSession')[0]
|
transcode_session = session.getElementsByTagName('TranscodeSession')[0]
|
||||||
|
transcode_key = helpers.get_xml_attr(transcode_session, 'key')
|
||||||
throttled = helpers.get_xml_attr(transcode_session, 'throttled')
|
throttled = helpers.get_xml_attr(transcode_session, 'throttled')
|
||||||
transcode_progress = helpers.get_xml_attr(transcode_session, 'progress')
|
transcode_progress = helpers.get_xml_attr(transcode_session, 'progress')
|
||||||
transcode_speed = helpers.get_xml_attr(transcode_session, 'speed')
|
transcode_speed = helpers.get_xml_attr(transcode_session, 'speed')
|
||||||
|
@ -1112,6 +1116,7 @@ class PmsConnect(object):
|
||||||
transcode_container = helpers.get_xml_attr(transcode_session, 'container')
|
transcode_container = helpers.get_xml_attr(transcode_session, 'container')
|
||||||
transcode_protocol = helpers.get_xml_attr(transcode_session, 'protocol')
|
transcode_protocol = helpers.get_xml_attr(transcode_session, 'protocol')
|
||||||
else:
|
else:
|
||||||
|
transcode_key = ''
|
||||||
throttled = '0'
|
throttled = '0'
|
||||||
transcode_progress = '0'
|
transcode_progress = '0'
|
||||||
transcode_speed = ''
|
transcode_speed = ''
|
||||||
|
@ -1174,6 +1179,7 @@ class PmsConnect(object):
|
||||||
'rating_key': helpers.get_xml_attr(session, 'ratingKey'),
|
'rating_key': helpers.get_xml_attr(session, 'ratingKey'),
|
||||||
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
|
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
|
||||||
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
|
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
|
||||||
|
'transcode_key': transcode_key,
|
||||||
'throttled': throttled,
|
'throttled': throttled,
|
||||||
'transcode_progress': int(round(helpers.cast_to_float(transcode_progress), 0)),
|
'transcode_progress': int(round(helpers.cast_to_float(transcode_progress), 0)),
|
||||||
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
|
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
|
||||||
|
@ -1232,6 +1238,7 @@ class PmsConnect(object):
|
||||||
'rating_key': helpers.get_xml_attr(session, 'ratingKey'),
|
'rating_key': helpers.get_xml_attr(session, 'ratingKey'),
|
||||||
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
|
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
|
||||||
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
|
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
|
||||||
|
'transcode_key': transcode_key,
|
||||||
'throttled': throttled,
|
'throttled': throttled,
|
||||||
'transcode_progress': int(round(helpers.cast_to_float(transcode_progress), 0)),
|
'transcode_progress': int(round(helpers.cast_to_float(transcode_progress), 0)),
|
||||||
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
|
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
|
||||||
|
@ -1290,6 +1297,7 @@ class PmsConnect(object):
|
||||||
'rating_key': helpers.get_xml_attr(session, 'ratingKey'),
|
'rating_key': helpers.get_xml_attr(session, 'ratingKey'),
|
||||||
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
|
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
|
||||||
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
|
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
|
||||||
|
'transcode_key': transcode_key,
|
||||||
'throttled': throttled,
|
'throttled': throttled,
|
||||||
'transcode_progress': int(round(helpers.cast_to_float(transcode_progress), 0)),
|
'transcode_progress': int(round(helpers.cast_to_float(transcode_progress), 0)),
|
||||||
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
|
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
|
||||||
|
@ -1329,6 +1337,7 @@ class PmsConnect(object):
|
||||||
|
|
||||||
if session.getElementsByTagName('TranscodeSession'):
|
if session.getElementsByTagName('TranscodeSession'):
|
||||||
transcode_session = session.getElementsByTagName('TranscodeSession')[0]
|
transcode_session = session.getElementsByTagName('TranscodeSession')[0]
|
||||||
|
transcode_key = helpers.get_xml_attr(transcode_session, 'key')
|
||||||
throttled = helpers.get_xml_attr(transcode_session, 'throttled')
|
throttled = helpers.get_xml_attr(transcode_session, 'throttled')
|
||||||
transcode_progress = helpers.get_xml_attr(transcode_session, 'progress')
|
transcode_progress = helpers.get_xml_attr(transcode_session, 'progress')
|
||||||
transcode_speed = helpers.get_xml_attr(transcode_session, 'speed')
|
transcode_speed = helpers.get_xml_attr(transcode_session, 'speed')
|
||||||
|
@ -1381,6 +1390,7 @@ class PmsConnect(object):
|
||||||
'rating_key': helpers.get_xml_attr(session, 'ratingKey'),
|
'rating_key': helpers.get_xml_attr(session, 'ratingKey'),
|
||||||
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
|
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
|
||||||
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
|
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
|
||||||
|
'transcode_key': transcode_key,
|
||||||
'throttled': throttled,
|
'throttled': throttled,
|
||||||
'transcode_progress': int(round(helpers.cast_to_float(transcode_progress), 0)),
|
'transcode_progress': int(round(helpers.cast_to_float(transcode_progress), 0)),
|
||||||
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
|
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
PLEXPY_VERSION = "master"
|
PLEXPY_VERSION = "master"
|
||||||
PLEXPY_RELEASE_VERSION = "1.3.14"
|
PLEXPY_RELEASE_VERSION = "1.3.15"
|
||||||
|
|