diff --git a/3.0/client/Python/pylibgal3/KNOWN_ISSUES b/3.0/client/Python/pylibgal3/KNOWN_ISSUES index 7cad5280..ebc02f79 100644 --- a/3.0/client/Python/pylibgal3/KNOWN_ISSUES +++ b/3.0/client/Python/pylibgal3/KNOWN_ISSUES @@ -2,7 +2,6 @@ pylibgal3 ========= * Need to implement member sorting -* Need to implement thumbnail access and manipulation * Need to implement image resizing * The getRandomImage() does not currently work diff --git a/3.0/client/Python/pylibgal3/libg3/G3Items.py b/3.0/client/Python/pylibgal3/libg3/G3Items.py index f6477bb8..0fdae593 100644 --- a/3.0/client/Python/pylibgal3/libg3/G3Items.py +++ b/3.0/client/Python/pylibgal3/libg3/G3Items.py @@ -36,6 +36,13 @@ class BaseRemote(object): self.fh = None self._postInit() + def __str__(self): + try: + return self.title + except: + pass + return self.name + def __getattr__(self , name): """ A bit of magic to make the retrieval of member objects lazy @@ -366,6 +373,32 @@ class RemoteImage(BaseRemote , Image): except: pass + def getResizeHandle(self): + """ + Returns a file-like object (specifically a urllib2.addinfourl) handle + to the "resize" version of the image + + returns(urllib2.addinfourl) : A file-like object handle for retrieving + the resized image + """ + if hasattr(self , 'resize_url'): + resp = self._gal.getRespFromUrl(self.resize_url) + return resp + return None + + def getThumbHandle(self): + """ + Returns a file-like object (specifically a urllib2.addinfourl) handle + to the "thumbnail" version of the image + + returns(urllib2.addinfourl) : A file-like object handle for retrieving + the thumbnail image + """ + if hasattr(self , 'thumb_url'): + resp = self._gal.getRespFromUrl(self.thumb_url) + return resp + return None + class LocalMovie(LocalImage): def __init__(self , path , replaceSpaces=True): LocalImage.__init__(self , path , replaceSpaces) diff --git a/3.0/client/Python/pylibgal3/libg3/Gallery3.py b/3.0/client/Python/pylibgal3/libg3/Gallery3.py index 924d7d86..6345c1a8 100644 --- a/3.0/client/Python/pylibgal3/libg3/Gallery3.py +++ b/3.0/client/Python/pylibgal3/libg3/Gallery3.py @@ -95,11 +95,20 @@ class Gallery3(object): returns(list[BaseRemote]) : Returns a list of the corresponding remote objects """ - data = { - 'urls': json.dumps(urls) , - } - resp = self.getRespFromUri('index.php/rest/items' , data) - return getItemsFromResp(resp , self , parent) + numUrls = len(urls) + start = 0 + increment = 25 + ret = [] + while start < numUrls: + data = { + 'urls': json.dumps(urls[start:start+increment]) , + 'num': str(increment) , + 'start': str(start) , + } + resp = self.getRespFromUri('index.php/rest/items' , data) + ret.extend(getItemsFromResp(resp , self , parent)) + start += increment + return ret def getRespFromUrl(self , url): """ @@ -120,6 +129,7 @@ class Gallery3(object): uri(str) : The uri string defining the resource on the defined host """ url = self._buildUrl(uri , kwargs) + print url return self.getRespFromUrl(url) def addAlbum(self , parent , albumName , title , description=''): diff --git a/3.0/client/Python/pylibgal3/libg3/__init__.py b/3.0/client/Python/pylibgal3/libg3/__init__.py index 745ba345..eec91668 100644 --- a/3.0/client/Python/pylibgal3/libg3/__init__.py +++ b/3.0/client/Python/pylibgal3/libg3/__init__.py @@ -21,4 +21,4 @@ from G3Items import * from Gallery3 import * -__version__ = '0.1.3' +__version__ = '0.1.4'