Incorrect parsing method fixed

This commit is contained in:
Warwick Harris 2022-09-17 18:28:31 +10:00
parent ae69548107
commit f0388d17f1
3 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,8 @@
# Changelog
## v2.1.0
Backport v3.0.2 to Kodi Leia for testing
## v3.0.2
Released 29th September 2021 (by warwickh)
* Removed dependency on future and dateutil

View File

@ -164,7 +164,7 @@ class Connection(object):
if len(self._hostname.split('/'))>1:
print(len(self._hostname.split('/')))
xbmc.log("Got a folder %s"%(self._hostname.split('/')[1]),xbmc.LOGDEBUG)
parts = urllib.parse.urlparse(self._baseUrl)
parts = urlparse.urlparse(self._baseUrl)
self._baseUrl = "%s://%s" % (parts.scheme, parts.hostname)
self._hostname = parts.hostname
self._serverPath = parts.path.strip('/') + '/rest'
@ -2932,7 +2932,7 @@ class Connection(object):
"""
separate REST portion of URL from base server path.
"""
return urllib.parse.splithost(self._serverPath)[1].split('/')[0]
return urlparse.splithost(self._serverPath)[1].split('/')[0]
def _fixLastModified(self, data):
"""

View File

@ -44,7 +44,7 @@ def get_connection():
if connection==None:
connected = False
# Create connection
if 1:#try:
try:
connection = libsonic.Connection(
baseUrl=Addon().get_setting('subsonic_url'),
username=Addon().get_setting('username', convert=False),
@ -56,11 +56,12 @@ def get_connection():
useGET=Addon().get_setting('useget'),
)
connected = connection.ping()
#except:
# pass
except:
pass
if connected==False:
popup('Connection error')
plugin.log('Connection error')
return False
return connection