Mercurial > libervia-backend
changeset 2932:472fadadefe6
jp (file/invite): added a --thumbnail argument
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 03 May 2019 13:05:47 +0200 |
parents | b256e90612d0 |
children | 47df940738a7 |
files | sat_frontends/jp/cmd_file.py |
diffstat | 1 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_file.py Fri May 03 13:05:01 2019 +0200 +++ b/sat_frontends/jp/cmd_file.py Fri May 03 13:05:47 2019 +0200 @@ -24,6 +24,7 @@ import os.path import tarfile from sat.core.i18n import _ +from sat.tools.common import data_format from sat_frontends.jp.constants import Const as C from sat_frontends.jp import common from sat_frontends.tools import jid @@ -737,6 +738,12 @@ help=_(u"type of the repository"), ) self.parser.add_argument( + "-T", + "--thumbnail", + type=base.unicode_decoder, + help=_(u"https URL of a image to use as thumbnail"), + ) + self.parser.add_argument( "service", type=base.unicode_decoder, help=_(u"jid of the file sharing service hosting the repository"), @@ -754,7 +761,13 @@ self.host.quit() def start(self): - self.path = os.path.abspath(self.args.path) if self.args.path else u"" + self.path = os.path.normpath(self.args.path) if self.args.path else u"" + extra = {} + if self.args.thumbnail is not None: + if not self.args.thumbnail.startswith(u'http'): + self.parser.error(_(u"only http(s) links are allowed with --thumbnail")) + else: + extra[u'thumb_url'] = self.args.thumbnail self.host.bridge.FISInvite( self.args.jid, self.args.service, @@ -762,6 +775,7 @@ self.args.namespace, self.path, self.args.name, + data_format.serialise(extra), self.profile, callback=self._FISInviteCb, errback=partial(