Use plex.direct url instead of local ip to use correct SSL certificate; thus fix artwork caching
- Fixes #461 - Migration necessary: re-connect to PMS to use plex.direct URI
This commit is contained in:
parent
8b1d04af79
commit
f0195f14aa
2 changed files with 30 additions and 40 deletions
|
@ -212,38 +212,28 @@ def discover_pms(token=None):
|
||||||
LOG.info('No plex token supplied, only checked LAN for available PMS')
|
LOG.info('No plex token supplied, only checked LAN for available PMS')
|
||||||
plex_pms_list = []
|
plex_pms_list = []
|
||||||
|
|
||||||
# See if we found a PMS both locally and using plex.tv. If so, use local
|
# Add PMS found only in the LAN to the Plex.tv PMS list
|
||||||
# connection data
|
|
||||||
all_pms = []
|
|
||||||
for pms in local_pms_list:
|
for pms in local_pms_list:
|
||||||
for i, plex_pms in enumerate(plex_pms_list):
|
for plex_pms in plex_pms_list:
|
||||||
if pms['machineIdentifier'] == plex_pms['machineIdentifier']:
|
if pms['machineIdentifier'] == plex_pms['machineIdentifier']:
|
||||||
# Update with GDM data - potentially more reliable than plex.tv
|
continue
|
||||||
LOG.debug('Found this PMS also in the LAN: %s', plex_pms)
|
else:
|
||||||
plex_pms['ip'] = pms['ip']
|
# Only found PMS using GDM - add it to the PMS from plex.tv
|
||||||
plex_pms['port'] = pms['port']
|
|
||||||
plex_pms['local'] = True
|
|
||||||
# Use all the other data we know from plex.tv
|
|
||||||
pms = plex_pms
|
|
||||||
# Remove this particular pms since we already know it
|
|
||||||
plex_pms_list.pop(i)
|
|
||||||
break
|
|
||||||
https = _pms_https_enabled('%s:%s' % (pms['ip'], pms['port']))
|
https = _pms_https_enabled('%s:%s' % (pms['ip'], pms['port']))
|
||||||
if https is None:
|
if https is None:
|
||||||
# Error contacting url. Skip and ignore this PMS for now
|
# Error contacting url. Skip and ignore this PMS for now
|
||||||
|
LOG.error('Could not contact PMS %s but we should have', pms)
|
||||||
continue
|
continue
|
||||||
elif https is True:
|
elif https is True:
|
||||||
pms['scheme'] = 'https'
|
pms['scheme'] = 'https'
|
||||||
pms['baseURL'] = 'https://%s:%s' % (pms['ip'], pms['port'])
|
|
||||||
else:
|
else:
|
||||||
pms['scheme'] = 'http'
|
pms['scheme'] = 'http'
|
||||||
pms['baseURL'] = 'http://%s:%s' % (pms['ip'], pms['port'])
|
pms['baseURL'] = '%s://%s:%s' % (pms['scheme'],
|
||||||
all_pms.append(pms)
|
pms['ip'],
|
||||||
# Now add the remaining PMS from plex.tv (where we already checked connect.)
|
pms['port'])
|
||||||
for plex_pms in plex_pms_list:
|
plex_pms_list.append(pms)
|
||||||
all_pms.append(plex_pms)
|
LOG.debug('Found the following PMS in total: %s', plex_pms_list)
|
||||||
LOG.debug('Found the following PMS in total: %s', all_pms)
|
return plex_pms_list
|
||||||
return all_pms
|
|
||||||
|
|
||||||
|
|
||||||
def _plex_gdm():
|
def _plex_gdm():
|
||||||
|
@ -414,12 +404,6 @@ def _pms_list_from_plex_tv(token):
|
||||||
|
|
||||||
def _poke_pms(pms, queue):
|
def _poke_pms(pms, queue):
|
||||||
data = pms['connections'][0].attrib
|
data = pms['connections'][0].attrib
|
||||||
if data['local'] == '1':
|
|
||||||
protocol = data['protocol']
|
|
||||||
address = data['address']
|
|
||||||
port = data['port']
|
|
||||||
url = '%s://%s:%s' % (protocol, address, port)
|
|
||||||
else:
|
|
||||||
url = data['uri']
|
url = data['uri']
|
||||||
if url.count(':') == 1:
|
if url.count(':') == 1:
|
||||||
url = '%s:%s' % (url, data['port'])
|
url = '%s:%s' % (url, data['port'])
|
||||||
|
|
|
@ -21,4 +21,10 @@ def check_migration():
|
||||||
# Set the new PKC theMovieDB key
|
# Set the new PKC theMovieDB key
|
||||||
settings('themoviedbAPIKey', value='19c90103adb9e98f2172c6a6a3d85dc4')
|
settings('themoviedbAPIKey', value='19c90103adb9e98f2172c6a6a3d85dc4')
|
||||||
|
|
||||||
|
if not compare_version(v.ADDON_VERSION, '2.0.24'):
|
||||||
|
log.info('Migrating to version 2.0.24')
|
||||||
|
# Need to re-connect with PMS to pick up on plex.direct URIs
|
||||||
|
settings('ipaddress', value='')
|
||||||
|
settings('port', value='')
|
||||||
|
|
||||||
settings('last_migrated_PKC_version', value=v.ADDON_VERSION)
|
settings('last_migrated_PKC_version', value=v.ADDON_VERSION)
|
||||||
|
|
Loading…
Reference in a new issue