# HG changeset patch # User Goffi # Date 1556881547 -7200 # Node ID 472fadadefe61302320b2f141cacde40cab1ed19 # Parent b256e90612d0b303501f0864d4453c66af0505da jp (file/invite): added a --thumbnail argument diff -r b256e90612d0 -r 472fadadefe6 sat_frontends/jp/cmd_file.py --- 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(