Clean up deprecation warnings and add some logging to resolve http client timeout

This commit is contained in:
Warwick Harris 2021-09-02 12:56:34 +10:00
parent e640d0f81d
commit a551df5c8c
2 changed files with 14 additions and 11 deletions

View File

@ -895,9 +895,9 @@ class Connection(object):
req = self._getRequest(viewName, q)
xbmc.log("Requesting %s"%str(req.full_url),xbmc.LOGDEBUG)
res = self._doBinReq(req)
if isinstance(res, dict):
self._checkStatus(res)
#res = self._doBinReq(req)
#if isinstance(res, dict):
# self._checkStatus(res)
return req.full_url
@ -942,6 +942,7 @@ class Connection(object):
q = self._getQueryDict({'id': aid, 'size': size})
req = self._getRequest(viewName, q)
xbmc.log("Requesting %s"%str(req.full_url),xbmc.LOGDEBUG)
#res = self._doBinReq(req)
#if isinstance(res, dict):
# self._checkStatus(res)
@ -1992,6 +1993,7 @@ class Connection(object):
q['musicFolderId'] = musicFolderId
req = self._getRequest(viewName, q)
xbmc.log("Requesting %s"%str(req.full_url),xbmc.LOGDEBUG)
res = self._doInfoReq(req)
self._checkStatus(res)
return res

17
main.py
View File

@ -16,7 +16,8 @@ import shutil
import time
import dateutil.parser
from datetime import datetime
from collections import MutableMapping, namedtuple
from collections.abc import MutableMapping
from collections import namedtuple
# Add the /lib folder to sys
sys.path.append(xbmcvfs.translatePath(os.path.join(xbmcaddon.Addon("plugin.audio.subsonic").getAddonInfo("path"), "lib")))
@ -52,7 +53,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),
@ -64,8 +65,8 @@ def get_connection():
useGET=Addon().get_setting('useget'),
)
connected = connection.ping()
#except:
# pass
except:
pass
if connected==False:
popup('Connection error')
@ -822,10 +823,10 @@ def get_entry_artist(item,params):
'info': {
'music': { ##http://romanvm.github.io/Kodistubs/_autosummary/xbmcgui.html#xbmcgui.ListItem.setInfo
'count': item.get('albumCount'),
'artist': item.get('name'),
'title': "testtitle",
'album': "testalbum",
'comment': "testcomment"
'artist': item.get('name')#,
#'title': "testtitle",
#'album': "testalbum",
#'comment': "testcomment"
# 'title': artist_info.get('biography')
}
}