Fix TypeError: encode() takes no keyword arguments
E.g. Android TV do not accept arguments for string.encode()
This commit is contained in:
parent
5e1355ca6d
commit
765fb2ddf2
1 changed files with 6 additions and 2 deletions
|
@ -1900,9 +1900,13 @@ class API():
|
||||||
url = 'http://api.themoviedb.org/3/search/%s' % media_type
|
url = 'http://api.themoviedb.org/3/search/%s' % media_type
|
||||||
parameters = {
|
parameters = {
|
||||||
'api_key': apiKey,
|
'api_key': apiKey,
|
||||||
'language': KODILANGUAGE,
|
'language': KODILANGUAGE
|
||||||
'query': title.encode('utf-8', errors='ignore')
|
|
||||||
}
|
}
|
||||||
|
try:
|
||||||
|
parameters['query'] = title.encode('utf-8', errors='ignore')
|
||||||
|
except TypeError:
|
||||||
|
# E.g. Android TV's python does NOT take arguments to encode
|
||||||
|
parameters['query'] = title.encode()
|
||||||
data = downloadutils.DownloadUtils().downloadUrl(
|
data = downloadutils.DownloadUtils().downloadUrl(
|
||||||
url,
|
url,
|
||||||
authenticate=False,
|
authenticate=False,
|
||||||
|
|
Loading…
Add table
Reference in a new issue