Remove some obsolete code for Kodi Krypton
This commit is contained in:
parent
b4a7a9ec41
commit
6fa19e3495
6 changed files with 32 additions and 66 deletions
|
@ -67,8 +67,7 @@ class Connection(object):
|
||||||
# Shall we verify SSL certificates? "None" will leave SSL enabled
|
# Shall we verify SSL certificates? "None" will leave SSL enabled
|
||||||
# Ignore this setting for Kodi >= 18 as Kodi 18 is much stricter
|
# Ignore this setting for Kodi >= 18 as Kodi 18 is much stricter
|
||||||
# with checking SSL certs
|
# with checking SSL certs
|
||||||
self.verify_ssl_cert = None if v.KODIVERSION >= 18 or utils.settings('sslverify') == 'true' \
|
self.verify_ssl_cert = None
|
||||||
else False
|
|
||||||
# Do we have an ssl certificate for PKC we need to use?
|
# Do we have an ssl certificate for PKC we need to use?
|
||||||
self.ssl_cert_path = utils.settings('sslcert') \
|
self.ssl_cert_path = utils.settings('sslcert') \
|
||||||
if utils.settings('sslcert') != 'None' else None
|
if utils.settings('sslcert') != 'None' else None
|
||||||
|
@ -89,8 +88,7 @@ class Connection(object):
|
||||||
self.server_name, self.machine_identifier, self.server)
|
self.server_name, self.machine_identifier, self.server)
|
||||||
|
|
||||||
def load_entrypoint(self):
|
def load_entrypoint(self):
|
||||||
self.verify_ssl_cert = None if v.KODIVERSION >= 18 or utils.settings('sslverify') == 'true' \
|
self.verify_ssl_cert = None
|
||||||
else False
|
|
||||||
self.ssl_cert_path = utils.settings('sslcert') \
|
self.ssl_cert_path = utils.settings('sslcert') \
|
||||||
if utils.settings('sslcert') != 'None' else None
|
if utils.settings('sslcert') != 'None' else None
|
||||||
self.https = utils.settings('https') == 'true'
|
self.https = utils.settings('https') == 'true'
|
||||||
|
|
|
@ -211,8 +211,7 @@ class InitialSetup(object):
|
||||||
not set before
|
not set before
|
||||||
"""
|
"""
|
||||||
answer = True
|
answer = True
|
||||||
chk = PF.check_connection(app.CONN.server,
|
chk = PF.check_connection(app.CONN.server, verifySSL=True)
|
||||||
verifySSL=True if v.KODIVERSION >= 18 else False)
|
|
||||||
if chk is False:
|
if chk is False:
|
||||||
LOG.warn('Could not reach PMS %s', app.CONN.server)
|
LOG.warn('Could not reach PMS %s', app.CONN.server)
|
||||||
answer = False
|
answer = False
|
||||||
|
@ -240,18 +239,13 @@ class InitialSetup(object):
|
||||||
"""
|
"""
|
||||||
Checks for server's connectivity. Returns check_connection result
|
Checks for server's connectivity. Returns check_connection result
|
||||||
"""
|
"""
|
||||||
if server['local']:
|
|
||||||
# Deactive SSL verification if the server is local for Kodi 17
|
|
||||||
verifySSL = True if v.KODIVERSION >= 18 else False
|
|
||||||
else:
|
|
||||||
verifySSL = True
|
|
||||||
if not server['token']:
|
if not server['token']:
|
||||||
# Plex GDM: we only get the token from plex.tv after
|
# Plex GDM: we only get the token from plex.tv after
|
||||||
# Sign-in to plex.tv
|
# Sign-in to plex.tv
|
||||||
server['token'] = utils.settings('plexToken') or None
|
server['token'] = utils.settings('plexToken') or None
|
||||||
return PF.check_connection(server['baseURL'],
|
return PF.check_connection(server['baseURL'],
|
||||||
token=server['token'],
|
token=server['token'],
|
||||||
verifySSL=verifySSL)
|
verifySSL=True)
|
||||||
|
|
||||||
def pick_pms(self, showDialog=False, inform_of_search=False):
|
def pick_pms(self, showDialog=False, inform_of_search=False):
|
||||||
"""
|
"""
|
||||||
|
@ -550,9 +544,7 @@ class InitialSetup(object):
|
||||||
|
|
||||||
# Display a warning if Kodi puts ALL movies into the queue, basically
|
# Display a warning if Kodi puts ALL movies into the queue, basically
|
||||||
# breaking playback reporting for PKC
|
# breaking playback reporting for PKC
|
||||||
warn = False
|
|
||||||
settings = js.settings_getsettingvalue('videoplayer.autoplaynextitem')
|
settings = js.settings_getsettingvalue('videoplayer.autoplaynextitem')
|
||||||
if v.KODIVERSION >= 18:
|
|
||||||
# Answer for videoplayer.autoplaynextitem:
|
# Answer for videoplayer.autoplaynextitem:
|
||||||
# [{u'label': u'Music videos', u'value': 0},
|
# [{u'label': u'Music videos', u'value': 0},
|
||||||
# {u'label': u'TV shows', u'value': 1},
|
# {u'label': u'TV shows', u'value': 1},
|
||||||
|
@ -560,12 +552,6 @@ class InitialSetup(object):
|
||||||
# {u'label': u'Movies', u'value': 3},
|
# {u'label': u'Movies', u'value': 3},
|
||||||
# {u'label': u'Uncategorized', u'value': 4}]
|
# {u'label': u'Uncategorized', u'value': 4}]
|
||||||
if 1 in settings or 2 in settings or 3 in settings:
|
if 1 in settings or 2 in settings or 3 in settings:
|
||||||
warn = True
|
|
||||||
else:
|
|
||||||
# Kodi Krypton: answer is boolean
|
|
||||||
if settings:
|
|
||||||
warn = True
|
|
||||||
if warn:
|
|
||||||
LOG.warn('Kodi setting videoplayer.autoplaynextitem is: %s',
|
LOG.warn('Kodi setting videoplayer.autoplaynextitem is: %s',
|
||||||
settings)
|
settings)
|
||||||
if utils.settings('warned_setting_videoplayer.autoplaynextitem') == 'false':
|
if utils.settings('warned_setting_videoplayer.autoplaynextitem') == 'false':
|
||||||
|
@ -575,7 +561,6 @@ class InitialSetup(object):
|
||||||
# Warning: Kodi setting "Play next video automatically" is
|
# Warning: Kodi setting "Play next video automatically" is
|
||||||
# enabled. This could break PKC. Deactivate?
|
# enabled. This could break PKC. Deactivate?
|
||||||
if utils.yesno_dialog(utils.lang(29999), utils.lang(30003)):
|
if utils.yesno_dialog(utils.lang(29999), utils.lang(30003)):
|
||||||
if v.KODIVERSION >= 18:
|
|
||||||
for i in (1, 2, 3):
|
for i in (1, 2, 3):
|
||||||
try:
|
try:
|
||||||
settings.remove(i)
|
settings.remove(i)
|
||||||
|
@ -583,9 +568,6 @@ class InitialSetup(object):
|
||||||
pass
|
pass
|
||||||
js.settings_setsettingvalue('videoplayer.autoplaynextitem',
|
js.settings_setsettingvalue('videoplayer.autoplaynextitem',
|
||||||
settings)
|
settings)
|
||||||
else:
|
|
||||||
js.settings_setsettingvalue('videoplayer.autoplaynextitem',
|
|
||||||
False)
|
|
||||||
# Set any video library updates to happen in the background in order to
|
# Set any video library updates to happen in the background in order to
|
||||||
# hide "Compressing database"
|
# hide "Compressing database"
|
||||||
js.settings_setsettingvalue('videolibrary.backgroundupdate', True)
|
js.settings_setsettingvalue('videolibrary.backgroundupdate', True)
|
||||||
|
|
|
@ -48,7 +48,6 @@ class KodiMusicDB(common.KodiDBBase):
|
||||||
strRole)
|
strRole)
|
||||||
VALUES (?, ?)
|
VALUES (?, ?)
|
||||||
''', (1, 'Artist'))
|
''', (1, 'Artist'))
|
||||||
if v.KODIVERSION >= 18:
|
|
||||||
self.cursor.execute('DELETE FROM versiontagscan')
|
self.cursor.execute('DELETE FROM versiontagscan')
|
||||||
self.cursor.execute('''
|
self.cursor.execute('''
|
||||||
INSERT INTO versiontagscan(
|
INSERT INTO versiontagscan(
|
||||||
|
@ -487,9 +486,6 @@ class KodiMusicDB(common.KodiDBBase):
|
||||||
|
|
||||||
@db.catch_operationalerrors
|
@db.catch_operationalerrors
|
||||||
def remove_album(self, kodi_id):
|
def remove_album(self, kodi_id):
|
||||||
if v.KODIVERSION < 18:
|
|
||||||
self.cursor.execute('DELETE FROM albuminfosong WHERE idAlbumInfo = ?',
|
|
||||||
(kodi_id, ))
|
|
||||||
self.cursor.execute('DELETE FROM album_artist WHERE idAlbum = ?',
|
self.cursor.execute('DELETE FROM album_artist WHERE idAlbum = ?',
|
||||||
(kodi_id, ))
|
(kodi_id, ))
|
||||||
self.cursor.execute('DELETE FROM album WHERE idAlbum = ?', (kodi_id, ))
|
self.cursor.execute('DELETE FROM album WHERE idAlbum = ?', (kodi_id, ))
|
||||||
|
|
|
@ -127,12 +127,6 @@ def check_connection(url, token=None, verifySSL=None):
|
||||||
header_options = None
|
header_options = None
|
||||||
if token is not None:
|
if token is not None:
|
||||||
header_options = {'X-Plex-Token': token}
|
header_options = {'X-Plex-Token': token}
|
||||||
if verifySSL is True:
|
|
||||||
if v.KODIVERSION >= 18:
|
|
||||||
# Always verify with Kodi >= 18
|
|
||||||
verifySSL = True
|
|
||||||
else:
|
|
||||||
verifySSL = True if utils.settings('sslverify') == 'true' else False
|
|
||||||
if 'plex.tv' in url:
|
if 'plex.tv' in url:
|
||||||
url = 'https://plex.tv/api/home/users'
|
url = 'https://plex.tv/api/home/users'
|
||||||
LOG.debug("Checking connection to server %s with verifySSL=%s",
|
LOG.debug("Checking connection to server %s with verifySSL=%s",
|
||||||
|
@ -432,7 +426,7 @@ def _poke_pms(pms, queue):
|
||||||
xml = DU().downloadUrl('%s/identity' % url,
|
xml = DU().downloadUrl('%s/identity' % url,
|
||||||
authenticate=False,
|
authenticate=False,
|
||||||
headerOptions={'X-Plex-Token': pms['token']},
|
headerOptions={'X-Plex-Token': pms['token']},
|
||||||
verifySSL=True if v.KODIVERSION >= 18 else False,
|
verifySSL=True,
|
||||||
timeout=(3.0, 5.0))
|
timeout=(3.0, 5.0))
|
||||||
try:
|
try:
|
||||||
xml.attrib['machineIdentifier']
|
xml.attrib['machineIdentifier']
|
||||||
|
@ -888,7 +882,7 @@ def GetMachineIdentifier(url):
|
||||||
"""
|
"""
|
||||||
xml = DU().downloadUrl('%s/identity' % url,
|
xml = DU().downloadUrl('%s/identity' % url,
|
||||||
authenticate=False,
|
authenticate=False,
|
||||||
verifySSL=True if v.KODIVERSION >= 18 else False,
|
verifySSL=True,
|
||||||
timeout=10,
|
timeout=10,
|
||||||
reraise=True)
|
reraise=True)
|
||||||
try:
|
try:
|
||||||
|
@ -1000,7 +994,7 @@ def pms_root(url, token):
|
||||||
return DU().downloadUrl(
|
return DU().downloadUrl(
|
||||||
url,
|
url,
|
||||||
authenticate=False,
|
authenticate=False,
|
||||||
verifySSL=True if v.KODIVERSION >= 18 else False,
|
verifySSL=True,
|
||||||
headerOptions={'X-Plex-Token': token} if token else None)
|
headerOptions={'X-Plex-Token': token} if token else None)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1013,7 +1007,7 @@ def get_PMS_settings(url, token):
|
||||||
return DU().downloadUrl(
|
return DU().downloadUrl(
|
||||||
'%s/:/prefs' % url,
|
'%s/:/prefs' % url,
|
||||||
authenticate=False,
|
authenticate=False,
|
||||||
verifySSL=True if v.KODIVERSION >= 18 else False,
|
verifySSL=True,
|
||||||
headerOptions={'X-Plex-Token': token} if token else None)
|
headerOptions={'X-Plex-Token': token} if token else None)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -266,8 +266,6 @@ class Service(object):
|
||||||
# Save changes to to file
|
# Save changes to to file
|
||||||
self.setup.save_pms_settings(server['baseURL'], server['token'])
|
self.setup.save_pms_settings(server['baseURL'], server['token'])
|
||||||
self.setup.write_pms_to_settings(server)
|
self.setup.write_pms_to_settings(server)
|
||||||
if not v.KODIVERSION >= 18:
|
|
||||||
utils.settings('sslverify', value='false')
|
|
||||||
# Wipe Kodi and Plex database as well as playlists and video nodes
|
# Wipe Kodi and Plex database as well as playlists and video nodes
|
||||||
utils.wipe_database()
|
utils.wipe_database()
|
||||||
app.CONN.load()
|
app.CONN.load()
|
||||||
|
|
|
@ -165,8 +165,6 @@ class PMS_Websocket(WebSocket):
|
||||||
if app.ACCOUNT.pms_token:
|
if app.ACCOUNT.pms_token:
|
||||||
uri += '?X-Plex-Token=%s' % app.ACCOUNT.pms_token
|
uri += '?X-Plex-Token=%s' % app.ACCOUNT.pms_token
|
||||||
sslopt = {}
|
sslopt = {}
|
||||||
if v.KODIVERSION == 17 and utils.settings('sslverify') == "false":
|
|
||||||
sslopt["cert_reqs"] = CERT_NONE
|
|
||||||
LOG.debug("%s: Uri: %s, sslopt: %s",
|
LOG.debug("%s: Uri: %s, sslopt: %s",
|
||||||
self.__class__.__name__, uri, sslopt)
|
self.__class__.__name__, uri, sslopt)
|
||||||
return uri, sslopt
|
return uri, sslopt
|
||||||
|
|
Loading…
Reference in a new issue