Merge branch 'master' of git://github.com/gallery/gallery3-contrib
This commit is contained in:
commit
a427259fff
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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=''):
|
||||
|
@ -21,4 +21,4 @@
|
||||
from G3Items import *
|
||||
from Gallery3 import *
|
||||
|
||||
__version__ = '0.1.3'
|
||||
__version__ = '0.1.4'
|
||||
|
Reference in New Issue
Block a user