mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-12-14 19:13:17 +00:00
Removed unnecessary log messages and changed some to debug (#167)
This commit is contained in:
parent
896c2fe6ec
commit
42258c699a
9 changed files with 65 additions and 67 deletions
|
|
@ -51,16 +51,16 @@ class HTTP(object):
|
|||
def _replace_user_info(self, string):
|
||||
|
||||
if '{server}' in string:
|
||||
if self.config.data['auth.server']:
|
||||
if self.config.data.get('auth.server', None):
|
||||
string = string.replace("{server}", self.config.data['auth.server'])
|
||||
else:
|
||||
raise Exception("Server address not set.")
|
||||
LOG.debug("Server address not set")
|
||||
|
||||
if '{UserId}'in string:
|
||||
if self.config.data['auth.user_id']:
|
||||
if self.config.data.get('auth.user_id', None):
|
||||
string = string.replace("{UserId}", self.config.data['auth.user_id'])
|
||||
else:
|
||||
raise Exception("UserId is not set.")
|
||||
LOG.debug("UserId is not set.")
|
||||
|
||||
return string
|
||||
|
||||
|
|
@ -150,7 +150,8 @@ class HTTP(object):
|
|||
raise HTTPException(r.status_code, error)
|
||||
|
||||
except requests.exceptions.MissingSchema as error:
|
||||
raise HTTPException("MissingSchema", {'Id': self.config.data['auth.server']})
|
||||
LOG.error("Request missing Schema. " + str(error))
|
||||
raise HTTPException("MissingSchema", {'Id': self.config.data.get('auth.server', "None")})
|
||||
|
||||
except Exception as error:
|
||||
raise
|
||||
|
|
@ -170,11 +171,11 @@ class HTTP(object):
|
|||
def _request(self, data):
|
||||
|
||||
if 'url' not in data:
|
||||
data['url'] = "%s/%s" % (self.config.data['auth.server'], data.pop('handler', ""))
|
||||
data['url'] = "%s/%s" % (self.config.data.get("auth.server", ""), data.pop('handler', ""))
|
||||
|
||||
self._get_header(data)
|
||||
data['timeout'] = data.get('timeout') or self.config.data['http.timeout']
|
||||
data['verify'] = data.get('verify') or self.config.data['auth.ssl'] or False
|
||||
data['verify'] = data.get('verify') or self.config.data.get('auth.ssl', False)
|
||||
data['url'] = self._replace_user_info(data['url'])
|
||||
self._process_params(data.get('params') or {})
|
||||
self._process_params(data.get('json') or {})
|
||||
|
|
@ -201,7 +202,7 @@ class HTTP(object):
|
|||
'Content-type': "application/json",
|
||||
'Accept-Charset': "UTF-8,*",
|
||||
'Accept-encoding': "gzip",
|
||||
'User-Agent': self.config.data['http.user_agent'] or "%s/%s" % (self.config.data['app.name'], self.config.data['app.version'])
|
||||
'User-Agent': self.config.data['http.user_agent'] or "%s/%s" % (self.config.data.get('app.name', 'Jellyfin for Kodi'), self.config.data.get('app.version', "0.0.0"))
|
||||
})
|
||||
|
||||
if 'x-emby-authorization' not in data['headers']:
|
||||
|
|
@ -212,17 +213,17 @@ class HTTP(object):
|
|||
def _authorization(self, data):
|
||||
|
||||
auth = "MediaBrowser "
|
||||
auth += "Client=%s, " % self.config.data['app.name']
|
||||
auth += "Device=%s, " % self.config.data['app.device_name']
|
||||
auth += "DeviceId=%s, " % self.config.data['app.device_id']
|
||||
auth += "Version=%s" % self.config.data['app.version']
|
||||
auth += "Client=%s, " % self.config.data.get('app.name', "Jellyfin for Kodi")
|
||||
auth += "Device=%s, " % self.config.data.get('app.device_name', 'Unknown Device')
|
||||
auth += "DeviceId=%s, " % self.config.data.get('app.device_id', 'Unknown Device id')
|
||||
auth += "Version=%s" % self.config.data.get('app.version', '0.0.0')
|
||||
|
||||
data['headers'].update({'x-emby-authorization': auth})
|
||||
|
||||
if self.config.data.get('auth.token') and self.config.data.get('auth.user_id'):
|
||||
|
||||
auth += ', UserId=%s' % self.config.data['auth.user_id']
|
||||
data['headers'].update({'x-emby-authorization': auth, 'X-MediaBrowser-Token': self.config.data['auth.token']})
|
||||
|
||||
auth += ', UserId=%s' % self.config.data.get('auth.user_id')
|
||||
data['headers'].update({'x-emby-authorization': auth, 'X-MediaBrowser-Token': self.config.data.get('auth.token')})
|
||||
|
||||
return data
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue