This commit is contained in:
Otger 2016-04-24 02:43:46 +02:00
commit dacb4ea7d6
39 changed files with 82 additions and 27 deletions

View file

@ -1776,7 +1776,7 @@ class SLACK(object):
if urlparse(self.icon_emoji).scheme == '':
data['icon_emoji'] = self.icon_emoji
else:
data['icon_url'] = self.icon_url
data['icon_url'] = self.icon_emoji
url = urlparse(self.slack_hook).path

View file

@ -71,37 +71,37 @@ def get_real_pms_url():
if plexpy.CONFIG.PMS_SSL:
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:
result = PlexTV().get_server_urls(include_https=False)
process_urls = False
if process_urls:
found_url = False
# Only need to retrieve PMS_URL if using SSL
if plexpy.CONFIG.PMS_SSL:
if result:
for item in result:
if plexpy.CONFIG.PMS_IS_REMOTE and item['local'] == '0':
found_url = True
plexpy.CONFIG.__setattr__('PMS_URL', item['uri'])
plexpy.CONFIG.write()
logger.info(u"PlexPy PlexTV :: Server URL retrieved.")
if not plexpy.CONFIG.PMS_IS_REMOTE and item['local'] == '1' and 'plex.direct' in item['uri']:
found_url = True
plexpy.CONFIG.__setattr__('PMS_URL', item['uri'])
plexpy.CONFIG.write()
logger.info(u"PlexPy PlexTV :: Server URL retrieved.")
if plexpy.CONFIG.PMS_IS_REMOTE:
# Get all remote connections
connections = [c for c in result if c['local'] == '0' and 'plex.direct' in c['uri']]
else:
# Get all local connections
connections = [c for c in result if c['local'] == '1' and 'plex.direct' in c['uri']]
if not found_url:
if connections:
# Get connection with matching address, otherwise return first connection
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.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:
plexpy.CONFIG.__setattr__('PMS_URL', fallback_url)
plexpy.CONFIG.write()
logger.info(u"PlexPy PlexTV :: Using user-defined URL.")
class PlexTV(object):

View file

@ -939,7 +939,7 @@ class PmsConnect(object):
try:
xml_head = session_data.getElementsByTagName('MediaContainer')
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 []
session_list = []
@ -1348,6 +1348,7 @@ class PmsConnect(object):
transcode_container = helpers.get_xml_attr(transcode_session, 'container')
transcode_protocol = helpers.get_xml_attr(transcode_session, 'protocol')
else:
transcode_key = ''
throttled = '0'
transcode_progress = '0'
transcode_speed = ''

View file

@ -1,2 +1,2 @@
PLEXPY_VERSION = "master"
PLEXPY_RELEASE_VERSION = "1.3.14"
PLEXPY_RELEASE_VERSION = "1.3.15"