You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python version: 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0]
What you did?: Add Kodi blocks for Latest Movies/Latest Episodes/Latest Albums to Dashboard
What happened?: Thumbnails for relevant movies/episodes/albums did not load
What you expected?: Thumbnails should pull from designated Kodi instances
How can we reproduce your issue?: Add at least 1 Kodi server, then enable Latest Movies/Latest Episodes/Latest Albums to show on Dashboard. Confirm that thumbnails do not load successfully.
What are your (relevant) settings?: Kodi servers added and connection tested successfully from within HTPC-Manager
FULL log (not just a few lines!) that has the error.
Expand log
Aug 15 07:04:41 htpc python3[5554]: 2022-08-15 13:04:41 :: cherrypy.error.140297692887648 :: ERROR :: [15/Aug/2022:13:04:41] HTTP
Aug 15 07:04:41 htpc python3[5554]: Traceback (most recent call last):
Aug 15 07:04:41 htpc python3[5554]: File "/usr/lib/python3/dist-packages/cherrypy/_cprequest.py", line 638, in respond
Aug 15 07:04:41 htpc python3[5554]: self._do_respond(path_info)
Aug 15 07:04:41 htpc python3[5554]: File "/usr/lib/python3/dist-packages/cherrypy/_cprequest.py", line 697, in _do_respond
Aug 15 07:04:41 htpc python3[5554]: response.body = self.handler()
Aug 15 07:04:41 htpc python3[5554]: File "/usr/lib/python3/dist-packages/cherrypy/lib/encoding.py", line 223, in __call__
Aug 15 07:04:41 htpc python3[5554]: self.body = self.oldhandler(*args, **kwargs)
Aug 15 07:04:41 htpc python3[5554]: File "/usr/lib/python3/dist-packages/cherrypy/_cpdispatch.py", line 54, in __call__
Aug 15 07:04:41 htpc python3[5554]: return self.callable(*self.args, **self.kwargs)
Aug 15 07:04:41 htpc python3[5554]: File "/opt/htpc-manager/modules/kodi.py", line 326, in GetThumb
Aug 15 07:04:41 htpc python3[5554]: return get_image(url, h, w, o, mode, self.auth())
Aug 15 07:04:41 htpc python3[5554]: File "/opt/htpc-manager/modules/kodi.py", line 888, in auth
Aug 15 07:04:41 htpc python3[5554]: return base64.encodestring('%s:%s' % (self.current.username, self.current.password)).strip('\n')
Aug 15 07:04:41 htpc python3[5554]: AttributeError: module 'base64' has no attribute 'encodestring'
After looking into the issue, it seems that in python3 there is indeed no attribute of base64 called encodestring(), so the existing solution in kodi.py will need to be changed in order for this functionality to return:
def auth(self):
""" Generate a base64 HTTP auth string based on settings """
if self.current.username and self.current.password:
return base64.encodestring('%s:%s' % (self.current.username, self.current.password)).strip('\n')
I was able to correct the issue on my own by adding an import line and modifying the function in kodi.py:
from urllib.parse import urlencode
...
def auth(self):
""" Generate a base64 HTTP auth string based on settings """
if self.current.username and self.current.password:
dummy_param = 'bla'
key_url_encoded = urlencode({dummy_param: self.current.username})[len(dummy_param) + 1:]
secret_url_encoded = urlencode({dummy_param: self.current.password})[len(dummy_param) + 1:]
credentials = '{}:{}'.format(key_url_encoded, secret_url_encoded)
bytes_base64_encoded_credentials = base64.encodebytes(credentials.encode('utf-8'))
return bytes_base64_encoded_credentials.decode('utf-8').replace('\n', '')
I'm not too familiar with Python however and am not confident enough in the solution I ripped nearly directly from a StackOverflow answer that I feel comfortable creating a pull request for this change, as I am almost entirely certain this is not the best solution and/or could be done much more cleanly or simply by someone more capable. This does, however, produce the result I want which is that the thumbnails for movies/episodes/albums now show appropriately in the little widget on my Dashboard.
The text was updated successfully, but these errors were encountered:
Somewhat related: I also noticed that when opening a TV show in the Sonarr module, the banners were not loading. Upon investigation, I saw this error:
'dict' object has no attribute 'iteritems'
It turns out that as of python3 the iteritems() attribute has been replaced with items(). I made this small change in helpers.py and it resolved the banners not loading issue for me as well.
Many thanks for your report and solution. I remember facing this as well. Forgotten Python 2 > 3 migration steps, obviously. Would you mind to open a PR to fix those? I can do as well but it's nice to have the original author in the commit history 🙂.
Reporting Issues:
To ensure that a I has enough information to work with please include all of the following information.
Use proper markdown syntax to structure your post (i.e. code/log in code blocks).
Make sure you provide the following information below:
Version: current
Branch: master2
Commit hash: 15ec6d9
Operating system: Ubuntu 22.04.1
Python version: 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0]
What you did?: Add Kodi blocks for Latest Movies/Latest Episodes/Latest Albums to Dashboard
What happened?: Thumbnails for relevant movies/episodes/albums did not load
What you expected?: Thumbnails should pull from designated Kodi instances
How can we reproduce your issue?: Add at least 1 Kodi server, then enable Latest Movies/Latest Episodes/Latest Albums to show on Dashboard. Confirm that thumbnails do not load successfully.
What are your (relevant) settings?: Kodi servers added and connection tested successfully from within HTPC-Manager
FULL log (not just a few lines!) that has the error.
Expand log
After looking into the issue, it seems that in python3 there is indeed no attribute of
base64
calledencodestring()
, so the existing solution inkodi.py
will need to be changed in order for this functionality to return:I was able to correct the issue on my own by adding an
import
line and modifying the function inkodi.py
:...
I'm not too familiar with Python however and am not confident enough in the solution I ripped nearly directly from a StackOverflow answer that I feel comfortable creating a pull request for this change, as I am almost entirely certain this is not the best solution and/or could be done much more cleanly or simply by someone more capable. This does, however, produce the result I want which is that the thumbnails for movies/episodes/albums now show appropriately in the little widget on my Dashboard.
The text was updated successfully, but these errors were encountered: