mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
Catch and raise bad status 400
When the request is malformed. Added logging to hopefully get to the bottom of a bug pulling albums from server.
This commit is contained in:
parent
43277ac2d6
commit
e58d98bc10
2 changed files with 13 additions and 3 deletions
|
@ -248,6 +248,7 @@ class DownloadUtils(object):
|
||||||
##### THE RESPONSE #####
|
##### THE RESPONSE #####
|
||||||
log.debug(kwargs)
|
log.debug(kwargs)
|
||||||
response = self._requests(action_type, session, **kwargs)
|
response = self._requests(action_type, session, **kwargs)
|
||||||
|
#response = requests.get('http://httpbin.org/status/400')
|
||||||
|
|
||||||
if response.status_code == 204:
|
if response.status_code == 204:
|
||||||
# No body in the response
|
# No body in the response
|
||||||
|
@ -287,6 +288,10 @@ class DownloadUtils(object):
|
||||||
|
|
||||||
except requests.exceptions.HTTPError as error:
|
except requests.exceptions.HTTPError as error:
|
||||||
|
|
||||||
|
if response.status_code == 400:
|
||||||
|
log.error("Malformed request: %s", error)
|
||||||
|
raise Warning('400')
|
||||||
|
|
||||||
if response.status_code == 401:
|
if response.status_code == 401:
|
||||||
# Unauthorized
|
# Unauthorized
|
||||||
status = window('emby_serverStatus')
|
status = window('emby_serverStatus')
|
||||||
|
|
|
@ -186,7 +186,8 @@ class Read_EmbyServer():
|
||||||
url = "{server}/emby/LiveTv/Recordings/?userid={UserId}&format=json"
|
url = "{server}/emby/LiveTv/Recordings/?userid={UserId}&format=json"
|
||||||
return self.doUtils(url, parameters=params)
|
return self.doUtils(url, parameters=params)
|
||||||
|
|
||||||
def getSection(self, parentid, itemtype=None, sortby="SortName", basic=False, dialog=None):
|
def getSection(self, parentid, itemtype=None, sortby="SortName", basic=False, params=None,
|
||||||
|
dialog=None):
|
||||||
|
|
||||||
items = {
|
items = {
|
||||||
|
|
||||||
|
@ -238,7 +239,7 @@ class Read_EmbyServer():
|
||||||
if basic:
|
if basic:
|
||||||
params['Fields'] = "Etag"
|
params['Fields'] = "Etag"
|
||||||
else:
|
else:
|
||||||
params['Fields'] = (
|
params['Fields'] = params or (
|
||||||
|
|
||||||
"Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,"
|
"Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,"
|
||||||
"CommunityRating,OfficialRating,CumulativeRunTimeTicks,"
|
"CommunityRating,OfficialRating,CumulativeRunTimeTicks,"
|
||||||
|
@ -247,9 +248,13 @@ class Read_EmbyServer():
|
||||||
"Tags,ProviderIds,ParentId,RemoteTrailers,SpecialEpisodeNumbers,"
|
"Tags,ProviderIds,ParentId,RemoteTrailers,SpecialEpisodeNumbers,"
|
||||||
"MediaSources,VoteCount"
|
"MediaSources,VoteCount"
|
||||||
)
|
)
|
||||||
result = self.doUtils(url, parameters=params)
|
|
||||||
try:
|
try:
|
||||||
|
result = self.doUtils(url, parameters=params)
|
||||||
items['Items'].extend(result['Items'])
|
items['Items'].extend(result['Items'])
|
||||||
|
except Warning as error:
|
||||||
|
if error == "400":
|
||||||
|
log.info("Something went wrong, aborting request.")
|
||||||
|
break
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# Something happened to the connection
|
# Something happened to the connection
|
||||||
if not throttled:
|
if not throttled:
|
||||||
|
|
Loading…
Reference in a new issue