Skip to content

XBMC thumbnails fail to render #391

@wiggin15

Description

@wiggin15

In XBMC view, the thumbnails of movies and TV shows fail to render:

screen shot 2017-10-07 at 23 53 18

The URI for xbmc/GetThumb raises the following exception:

2017-10-07 23:40:57 :: cherrypy.error.140245003550160 :: ERROR :: [07/Oct/2017:23:40:57] HTTP Traceback (most recent call last):
  File "/opt/htpc-manager/libs/cherrypy/_cprequest.py", line 656, in respond
    response.body = self.handler()
  File "/opt/htpc-manager/libs/cherrypy/lib/encoding.py", line 188, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/opt/htpc-manager/libs/cherrypy/_cpdispatch.py", line 34, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/opt/htpc-manager/modules/xbmc.py", line 215, in GetThumb
    return get_image(url, h, w, o, self.auth())
  File "/opt/htpc-manager/htpc/proxy.py", line 51, in get_image
    resize_image(image, height, width, opacity, resized)
  File "/opt/htpc-manager/htpc/proxy.py", line 107, in resize_image
    im.save(dest, imagetype)
  File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1453, in save
    raise KeyError(ext) # unknown extension
KeyError: u'.0'

Using debug mode, I found that imagetype is None in proxy.py:resize_image, leaving PIL to try to determine the image file format from the filename, which ends with ".0" (the filename is created from the image properties. .0 is the opacity - so not helpful). There is an open Python issue about imghdr failing to detect the JPEG format: https://bugs.python.org/issue28591
We can use PIL itself to determine imagetype instead of using imghdr.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions