core: added imageCheck and imageResize methods:

imageCheck will give a report on image, notably it will tell if it's too big and needs to
be resized before a transfer.

imageResize will create a new image with the requested size and return a path to it.
This commit is contained in:
Goffi 2019-10-29 20:38:39 +01:00
commit 93a4e488ea
2 changed files with 197 additions and 0 deletions

View file

@ -909,3 +909,24 @@ sig_in=
sig_out=a{ss}
doc=Get a dict to short name => whole namespaces
doc_return=namespaces mapping
[imageCheck]
type=method
category=core
sig_in=s
sig_out=s
doc=Analyze an image a return a report
doc_return=serialized report
[imageResize]
async=
type=method
category=core
sig_in=sii
sig_out=s
doc=Create a new image with desired size
doc_param_0=image_path: path of the image to resize
doc_param_1=width: width of the new image
doc_param_2=height: height of the new image
doc_return=path of the new image with desired size
the image must be deleted once not needed anymore

View file

@ -384,6 +384,18 @@ class DbusObject(dbus.service.Object):
def historyGet(self, from_jid, to_jid, limit, between=True, filters='', profile="@NONE@", callback=None, errback=None):
return self._callback("historyGet", str(from_jid), str(to_jid), limit, between, filters, str(profile), callback=callback, errback=errback)
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='s', out_signature='s',
async_callbacks=None)
def imageCheck(self, arg_0):
return self._callback("imageCheck", str(arg_0))
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='sii', out_signature='s',
async_callbacks=('callback', 'errback'))
def imageResize(self, image_path, width, height, callback=None, errback=None):
return self._callback("imageResize", str(image_path), width, height, callback=callback, errback=errback)
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='s', out_signature='b',
async_callbacks=None)