Sixthhokage2 / remuco

Automatically exported from code.google.com/p/remuco
1 stars 1 forks source link

Image thumbnailing throws exception because of wrong parameters #70

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What is your environment?
* OS: Kubuntu 9.10
* Remuco version: Latest build as of Nov 27 2009
* Client device: Nokia 5800
* Player: Amarok

Issue:
After the client has successfully connected to the adapter, adaptop gives 
the following stacktrace when selecting certain songs

Traceback (most recent call last):                                              

  File "/usr/local/lib/python2.6/dist-packages/remuco/adapter.py", line 
1218, in __sync_item        
    msg = net.build_message(message.SYNC_ITEM, self.__item(c))                                      
  File "/usr/local/lib/python2.6/dist-packages/remuco/adapter.py", line 
1409, in __item             
    client.info.img_size, client.info.img_type)                                                     
  File "/usr/local/lib/python2.6/dist-packages/remuco/data.py", line 122, 
in __init__               
    self.__img = self.__thumbnail_img(img, img_size, img_type)                                      
  File "/usr/local/lib/python2.6/dist-packages/remuco/data.py", line 172, 
in __thumbnail_img        
    img.save(file_tmp, img_type)                                                                    
  File "/usr/lib/python2.6/dist-packages/PIL/Image.py", line 1396, in save                          
    save_handler = SAVE[string.upper(format)] # unknown format                                      
KeyError: '200'               

It seems to be failing while attempting to retrieve/send the thumbnail of 
the following track. When this happens, track info does not get send to the 
player. But adaptor still responds to commands(play/pause etc) from client 
and library is still browsable.

Workaround: Since it appears to be failing in Image.py I was able to 
workaround this by adding a catch block for the Exception base class in the 
file /base/module/remuco/data.py after line 179 inside the method  def 
__thumbnail_img(self, img, img_size, img_type)

Now my exception handling part in the above mentioned method looks like 
this:

 except IOError, e:
            log.warning("failed to thumbnail %s (%s)" % (img, e))
            return []
 except Exception, e:
        log.warning("Error occured within Image module..returning 
null")
        return []

Can someone else please confirm the bug or the workaround?

Original issue reported on code.google.com by rajivnai...@gmail.com on 27 Nov 2009 at 7:18

Attachments:

GoogleCodeExporter commented 9 years ago
Adding a catch-them-all catch block is a work around but I would like to find 
the
real problem. Does the exception gets thrown for every image? Which version of 
the
Python imageing library (PIL) is installed on your system?

Looking at "KeyError: '200'", a possible error reason might be, that the option
'img_type' in the player adapter configuration file accidentally has been set to
'200' (instead of "PNG" or "JPEG"). Is that the case? Then it is not a bug, but 
a
misconfiguration ;)

Original comment by obensonne@googlemail.com on 27 Nov 2009 at 8:27

GoogleCodeExporter commented 9 years ago
It doesnt get thrown for every track. Only a small subset of them, and i havent 
noticed anything common between those tracks, but I'll keep looking. I looked 
in the 
amarok adapter config file and couldn't find any option named img_type. Is 
there any 
other place that I should be looking at?

Original comment by rajivnai...@gmail.com on 28 Nov 2009 at 3:01

GoogleCodeExporter commented 9 years ago
Concerning the option, sorry, my mistake, this option is configured in the 
client
since 0.9.2.

To debut this issue you could add some log.debug(..) calls within the
__thumbnail_img() method to see for which images and parameters the exception 
occurs.
Interesting things to log are `img`, `img_type` and `img_size`.

Original comment by obensonne@googlemail.com on 28 Nov 2009 at 11:11

GoogleCodeExporter commented 9 years ago
Any progress here?

Original comment by obensonne@googlemail.com on 2 Dec 2009 at 8:07

GoogleCodeExporter commented 9 years ago
This issue was updated by revision 0b77bc9785.

Previous revision 8e8395201bd2 introduced this bug. On client size the
ClientInfo object has been initialized with the image size for the image
type value. This change fixes the wrong ClientInfo initialization.

Original comment by obensonne@googlemail.com on 6 Dec 2009 at 6:50

GoogleCodeExporter commented 9 years ago

Original comment by obensonne@googlemail.com on 8 Mar 2011 at 6:38