Remove some obsolete code for Kodi Krypton

This commit is contained in:
croneter 2020-12-27 16:24:40 +01:00
parent b4a7a9ec41
commit 6fa19e3495
6 changed files with 32 additions and 66 deletions

View file

@ -67,8 +67,7 @@ class Connection(object):
# Shall we verify SSL certificates? "None" will leave SSL enabled
# Ignore this setting for Kodi >= 18 as Kodi 18 is much stricter
# with checking SSL certs
self.verify_ssl_cert = None if v.KODIVERSION >= 18 or utils.settings('sslverify') == 'true' \
else False
self.verify_ssl_cert = None
# Do we have an ssl certificate for PKC we need to use?
self.ssl_cert_path = utils.settings('sslcert') \
if utils.settings('sslcert') != 'None' else None
@ -89,8 +88,7 @@ class Connection(object):
self.server_name, self.machine_identifier, self.server)
def load_entrypoint(self):
self.verify_ssl_cert = None if v.KODIVERSION >= 18 or utils.settings('sslverify') == 'true' \
else False
self.verify_ssl_cert = None
self.ssl_cert_path = utils.settings('sslcert') \
if utils.settings('sslcert') != 'None' else None
self.https = utils.settings('https') == 'true'

View file

@ -211,8 +211,7 @@ class InitialSetup(object):
not set before
"""
answer = True
chk = PF.check_connection(app.CONN.server,
verifySSL=True if v.KODIVERSION >= 18 else False)
chk = PF.check_connection(app.CONN.server, verifySSL=True)
if chk is False:
LOG.warn('Could not reach PMS %s', app.CONN.server)
answer = False
@ -240,18 +239,13 @@ class InitialSetup(object):
"""
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']:
# Plex GDM: we only get the token from plex.tv after
# Sign-in to plex.tv
server['token'] = utils.settings('plexToken') or None
return PF.check_connection(server['baseURL'],
token=server['token'],
verifySSL=verifySSL)
verifySSL=True)
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
# breaking playback reporting for PKC
warn = False
settings = js.settings_getsettingvalue('videoplayer.autoplaynextitem')
if v.KODIVERSION >= 18:
# Answer for videoplayer.autoplaynextitem:
# [{u'label': u'Music videos', u'value': 0},
# {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'Uncategorized', u'value': 4}]
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',
settings)
if utils.settings('warned_setting_videoplayer.autoplaynextitem') == 'false':
@ -575,7 +561,6 @@ class InitialSetup(object):
# Warning: Kodi setting "Play next video automatically" is
# enabled. This could break PKC. Deactivate?
if utils.yesno_dialog(utils.lang(29999), utils.lang(30003)):
if v.KODIVERSION >= 18:
for i in (1, 2, 3):
try:
settings.remove(i)
@ -583,9 +568,6 @@ class InitialSetup(object):
pass
js.settings_setsettingvalue('videoplayer.autoplaynextitem',
settings)
else:
js.settings_setsettingvalue('videoplayer.autoplaynextitem',
False)
# Set any video library updates to happen in the background in order to
# hide "Compressing database"
js.settings_setsettingvalue('videolibrary.backgroundupdate', True)

View file

@ -48,7 +48,6 @@ class KodiMusicDB(common.KodiDBBase):
strRole)
VALUES (?, ?)
''', (1, 'Artist'))
if v.KODIVERSION >= 18:
self.cursor.execute('DELETE FROM versiontagscan')
self.cursor.execute('''
INSERT INTO versiontagscan(
@ -487,9 +486,6 @@ class KodiMusicDB(common.KodiDBBase):
@db.catch_operationalerrors
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 = ?',
(kodi_id, ))
self.cursor.execute('DELETE FROM album WHERE idAlbum = ?', (kodi_id, ))

View file

@ -127,12 +127,6 @@ def check_connection(url, token=None, verifySSL=None):
header_options = None
if token is not None:
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:
url = 'https://plex.tv/api/home/users'
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,
authenticate=False,
headerOptions={'X-Plex-Token': pms['token']},
verifySSL=True if v.KODIVERSION >= 18 else False,
verifySSL=True,
timeout=(3.0, 5.0))
try:
xml.attrib['machineIdentifier']
@ -888,7 +882,7 @@ def GetMachineIdentifier(url):
"""
xml = DU().downloadUrl('%s/identity' % url,
authenticate=False,
verifySSL=True if v.KODIVERSION >= 18 else False,
verifySSL=True,
timeout=10,
reraise=True)
try:
@ -1000,7 +994,7 @@ def pms_root(url, token):
return DU().downloadUrl(
url,
authenticate=False,
verifySSL=True if v.KODIVERSION >= 18 else False,
verifySSL=True,
headerOptions={'X-Plex-Token': token} if token else None)
@ -1013,7 +1007,7 @@ def get_PMS_settings(url, token):
return DU().downloadUrl(
'%s/:/prefs' % url,
authenticate=False,
verifySSL=True if v.KODIVERSION >= 18 else False,
verifySSL=True,
headerOptions={'X-Plex-Token': token} if token else None)

View file

@ -266,8 +266,6 @@ class Service(object):
# Save changes to to file
self.setup.save_pms_settings(server['baseURL'], server['token'])
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
utils.wipe_database()
app.CONN.load()

View file

@ -165,8 +165,6 @@ class PMS_Websocket(WebSocket):
if app.ACCOUNT.pms_token:
uri += '?X-Plex-Token=%s' % app.ACCOUNT.pms_token
sslopt = {}
if v.KODIVERSION == 17 and utils.settings('sslverify') == "false":
sslopt["cert_reqs"] = CERT_NONE
LOG.debug("%s: Uri: %s, sslopt: %s",
self.__class__.__name__, uri, sslopt)
return uri, sslopt