Package elisa :: Package core :: Module thumbnailer :: Class Thumbnailer
[hide private]
[frames] | no frames]

Class Thumbnailer

source code


Instance Methods [hide private]
 
__init__(self, thumbnail_dir='frontend') source code
 
stop(self) source code
 
_save_thumbnail_as(self, file_uri, thumbnail, thumbnail_filename)
Save a thumbnail of an URI at a given location.
source code
tuple (path to thumbnail, maximum thumbnail size)
_get_thumbnail_location(self, file_uri, size)
Return the thumbnail's location of a file for a particular size.
source code
PIL.Image or None
_get_thumbnail_from(self, file_uri, size)
Retrieve a thumbnail from a given URI.
source code
 
_retrieve_thumbnail(self, uri, size, media_type) source code
 
_process_next(self) source code
twisted.internet.defer.Deferred
get_thumbnail(self, uri, size, media_type)
Creates a thumbnail of uri on a local location.
source code
 
add_thumbnail(self, uri, size, thumbnail)
Adds to the thumbnail cache a thumbnail created by a 3rd party component (like a View)
source code

Inherited from extern.log.log.Loggable: debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure

Class Variables [hide private]
  logCategory = 'thumbnailer'
Implementors can provide a category to log their messages under.
Method Details [hide private]

__init__(self, thumbnail_dir='frontend')
(Constructor)

source code 
Parameters:
  • thumbnail_dir (string) - abolute path to a directory where to store thumbnails

_save_thumbnail_as(self, file_uri, thumbnail, thumbnail_filename)

source code 
Save a thumbnail of an URI at a given location.
Parameters:
  • file_uri (elisa.core.media_uri.MediaUri) - URI the thumbnail was generated from
  • thumbnail (PIL.Image) - Thumbnail instance
  • thumbnail_filename (string) - filename to save to
Raises:

_get_thumbnail_location(self, file_uri, size)

source code 
Return the thumbnail's location of a file for a particular size.
Parameters:
Returns: tuple (path to thumbnail, maximum thumbnail size)
Raises:
  • Exception - Raise an exception if size is superior to 512

_get_thumbnail_from(self, file_uri, size)

source code 
Retrieve a thumbnail from a given URI.
Parameters:
Returns: PIL.Image or None

_retrieve_thumbnail(self, uri, size, media_type)

source code 
Raises:

get_thumbnail(self, uri, size, media_type)

source code 
Creates a thumbnail of uri on a local location. Returns a deferred, it's callback is called with a tuple containing the local filename of the thumbnail and its size as an int. Calls the deferred error callback if an error occured.
Parameters:
Returns: twisted.internet.defer.Deferred

add_thumbnail(self, uri, size, thumbnail)

source code 
Adds to the thumbnail cache a thumbnail created by a 3rd party component (like a View)
Parameters:
  • uri (elisa.core.media_uri.MediaUri) - URI the thumbnail has been generated from
  • size (int) - size of the thumbnail
  • thumbnail (PIL.Image) - the Image