diff --git a/contextmenu.py b/contextmenu.py index 33250c24..19afd13c 100644 --- a/contextmenu.py +++ b/contextmenu.py @@ -10,7 +10,7 @@ from xbmcgui import Window def _get_kodi_type(): - kodi_type = listitem.getVideoInfoTag().getMediaType().decode('utf-8') + kodi_type = listitem.getVideoInfoTag().getMediaType() if not kodi_type: if getCondVisibility('Container.Content(albums)'): kodi_type = "album" diff --git a/resources/lib/plex_api/artwork.py b/resources/lib/plex_api/artwork.py index 4d27c07a..8e354084 100644 --- a/resources/lib/plex_api/artwork.py +++ b/resources/lib/plex_api/artwork.py @@ -47,10 +47,9 @@ class Artwork(object): except ValueError: # e.g. playlists pass - artwork = '%s?width=%s&height=%s' % (artwork, width, height) - artwork = ('%s/photo/:/transcode?width=1920&height=1920&' - 'minSize=1&upscale=0&url=%s' - % (app.CONN.server, utils.quote(artwork))) + artwork = f'{artwork}?width={width}&height={height}' + artwork = (f'{app.CONN.server}/photo/:/transcode?width=1920&height=1920&' + f'minSize=1&upscale=0&url={utils.quote(artwork)}') artwork = self.attach_plex_token_to_url(artwork) return artwork diff --git a/resources/lib/websocket.py b/resources/lib/websocket.py index 951f6573..f1df3c6a 100644 --- a/resources/lib/websocket.py +++ b/resources/lib/websocket.py @@ -731,7 +731,7 @@ class WebSocket(object): def _send(self, data): try: - return self.sock.send(data) + return self.sock.send(data.encode('utf-8')) except socket.timeout as e: raise WebSocketTimeoutException(e.args[0]) except Exception as e: diff --git a/resources/lib/widgets.py b/resources/lib/widgets.py index dd5acfd3..fb50ef23 100644 --- a/resources/lib/widgets.py +++ b/resources/lib/widgets.py @@ -32,25 +32,23 @@ def get_clean_image(image): Pass in either unicode or str; returns unicode ''' if not image: - return "" - if not isinstance(image, str): - image = image.encode('utf-8') - if b"music@" in image: + return '' + if 'music@' in image: # fix for embedded images thumbcache = xbmc.getCacheThumbName(image) - thumbcache = thumbcache.replace(b".tbn", b".jpg") - thumbcache = b"special://thumbnails/%s/%s" % (thumbcache[0], thumbcache) + thumbcache = thumbcache.replace('.tbn', '.jpg') + thumbcache = 'special://thumbnails/%s/%s' % (thumbcache[0], thumbcache) if not xbmcvfs.exists(thumbcache): xbmcvfs.copy(image, thumbcache) image = thumbcache - if image and b"image://" in image: - image = image.replace(b"image://", b"") + if image and 'image://' in image: + image = image.replace('image://', '') image = utils.unquote(image) - if image.endswith("/"): + if image.endswith('/'): image = image[:-1] return image else: - return image.decode('utf-8') + return image def generate_item(api):