Skip to content

Commit

Permalink
remove annoying and wrong connection messages
Browse files Browse the repository at this point in the history
  • Loading branch information
lusum committed Feb 9, 2021
1 parent 3e051c0 commit 4eb5e29
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions resources/lib/ampache_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,19 @@ def getCodeMessError(self,tree):
#ampache api 4 and below
try:
errormess = tree.findtext('error')
code = errornode.attrib["code"]
xbmc.log("AmpachePlugin::getCodeMessError: Client error code " + \
str(code) + " message " + str(errormess) , xbmc.LOGDEBUG)
return code, errormess
return errormess
except:
#do nothing
pass
#ampache api 5 and above
try:
errormess = errornode.findtext("errorMessage")
code = errornode.attrib["errorCode"]
xbmc.log("AmpachePlugin::getCodeMessError: Client error code " + \
str(code) + " message " + str(errormess) , xbmc.LOGDEBUG)
return code, errormess
return errormess
except:
#do nothing
pass

return code, errormess
return errormess

def getHashedPassword(self,timeStamp):
enablePass = self._connectionData["enable_password"]
Expand Down Expand Up @@ -173,14 +167,10 @@ def AMPACHECONNECT(self,showok=False):
xbmc.log("AmpachePlugin::AMPACHECONNECT: unable to print contents " + \
repr(e) , xbmc.LOGDEBUG)
tree=ET.XML(contents)
code, errormess = self.getCodeMessError(tree)
errormess = self.getCodeMessError(tree)
if errormess:
if "time" in errormess and code == "401":
#permission error, check password or api_key
xbmcgui.Dialog().notification(ut.tString(30198),ut.tString(30204))
else:
#connection error
xbmcgui.Dialog().notification(ut.tString(30198),ut.tString(30202))
#connection error
xbmcgui.Dialog().notification(ut.tString(30198),ut.tString(30202))
raise self.ConnectionError
xbmc.log("AmpachePlugin::AMPACHECONNECT ConnectionOk",xbmc.LOGDEBUG)
if showok:
Expand Down Expand Up @@ -219,9 +209,8 @@ def ampache_http_request(self,action):
xbmc.log("AmpachePlugin::ampache_http_request: unable print contents " + \
repr(e) , xbmc.LOGDEBUG)
tree=ET.XML(contents)
code, errormess = self.getCodeMessError(tree)
errormess = self.getCodeMessError(tree)
if errormess:
xbmcgui.Dialog().notification(ut.tString(30198),ut.tString(30202))
raise self.ConnectionError
return tree

Expand Down

0 comments on commit 4eb5e29

Please sign in to comment.