Changeset 650


Ignore:
Timestamp:
11/11/12 17:08:25 (11 years ago)
Author:
Nicholas Riley
Message:

StreamVision.py: Don't fail on socket errors when retrieving album art.

This requires updating to latest Mercurial version of httplib2; the
older version I was using did not deal with timeouts and socket errors
very well.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/StreamVision/StreamVision.py

    r649 r650  
    190190            kw = {}
    191191            if url != k.missing_value and url.endswith('.jpg'):
    192                 response, content = self.http.request(url)
    193                 if response['content-type'].startswith('image/'):
    194                     file(self.imagePath, 'w').write(content)
    195                     kw['image_from_location'] = self.imagePath
     192                try:
     193                    response, content = self.http.request(url)
     194                except Exception, e:
     195                    import sys
     196                    print >> sys.stderr, 'Request for album art failed:', e
     197                else:
     198                    if response['content-type'].startswith('image/'):
     199                        file(self.imagePath, 'w').write(content)
     200                        kw['image_from_location'] = self.imagePath
    196201            growlNotify(cleanStreamTitle(iTunes.current_stream_title()),
    197202                        cleanStreamTrackName(trackName), **kw)
Note: See TracChangeset for help on using the changeset viewer.