Author: dmeyer
Date: Wed Feb 22 09:36:29 2006
New Revision: 1212

Modified:
   trunk/WIP/thumb2/src/server.py
   trunk/WIP/thumb2/src/thumbnail.py

Log:
remove update parameter and add image property

Modified: trunk/WIP/thumb2/src/server.py
==============================================================================
--- trunk/WIP/thumb2/src/server.py      (original)
+++ trunk/WIP/thumb2/src/server.py      Wed Feb 22 09:36:29 2006
@@ -55,12 +55,11 @@
     """
     A job with thumbnail information.
     """
-    def __init__(self, id, filename, imagefile, size, update):
+    def __init__(self, id, filename, imagefile, size):
         self.client, self.id = id
         self.filename = filename
         self.imagefile = imagefile
         self.size = size
-        self.update = update
 
 
 class Thumbnailer(object):
@@ -110,7 +109,7 @@
 
         job = self._jobs.pop(0)
 
-        # FIXME: check if there is already a file and update is False
+        # FIXME: check if there is already a file and it is up to date
 
         if job.filename.lower().endswith('jpg'):
             try:
@@ -162,9 +161,9 @@
         return self.next_client_id
 
 
-    def schedule(self, id, filename, imagefile, size, update=True):
+    def schedule(self, id, filename, imagefile, size):
 
-        self._jobs.append(Job(id, filename, imagefile, size, update))
+        self._jobs.append(Job(id, filename, imagefile, size))
         if not self._timer.active():
             self._timer.start(0.001)
 

Modified: trunk/WIP/thumb2/src/thumbnail.py
==============================================================================
--- trunk/WIP/thumb2/src/thumbnail.py   (original)
+++ trunk/WIP/thumb2/src/thumbnail.py   Wed Feb 22 09:36:29 2006
@@ -84,7 +84,12 @@
         self._thumbnail = destdir + '/%s/' + md5.md5(url).hexdigest()
         
 
-    def get(self, type=NORMAL):
+    def get(self, type='any'):
+        if type == 'any':
+            image = self.get(LARGE)
+            if image:
+                return image
+            type = NORMAL
         if os.path.isfile(self._thumbnail % type + '.png'):
             return self._thumbnail % type + '.png'
         if os.path.isfile(self._thumbnail % type + '.jpg'):
@@ -92,9 +97,12 @@
         return None
 
 
-    def set(self, image, type=NORMAL):
-        png(self.name, self._thumbnail % type + '.png', SIZE[type], 
image._image)
-
+    def set(self, image, type='both'):
+        if type in ('both', LARGE):
+            png(self.name, self._thumbnail % type + '.png', SIZE[LARGE], 
image._image)
+        if type in ('both', NORMAL):
+            png(self.name, self._thumbnail % type + '.png', SIZE[NORMAL], 
image._image)
+            
 
     def exists(self):
         return self.get(NORMAL) or self.get(LARGE) or self.get('fail/kaa')
@@ -104,7 +112,7 @@
         return self._get_thumbnail('fail/kaa')
 
 
-    def create(self, type=NORMAL, wait=False, force=True):
+    def create(self, type=NORMAL, wait=False):
         Thumbnail.next_id += 1
         
         dest = '%s/%s' % (self.destdir, type)
@@ -113,7 +121,7 @@
 
         # schedule thumbnail creation
         _schedule((_client_id, Thumbnail.next_id), self.name,
-                  self._thumbnail % type, SIZE[type], update=force,
+                  self._thumbnail % type, SIZE[type],
                   __ipc_oneway=True, __ipc_noproxy_args=True)
 
         job = Job(self, Thumbnail.next_id)
@@ -124,7 +132,10 @@
         while not job.finished:
             step()
 
+    image = property(get, set, None, "thumbnail image")
+    failed = property(is_failed, set, None, "return True if thumbnailing 
failed")
 
+    
 def _callback(id, *args):
     if not id:
         for i in args[0]:


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to