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

17
main.py
View File

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