jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/762107 )
Change subject: pywikibot: Add support for chunked uploading in imagetransfer.py
......................................................................
pywikibot: Add support for chunked uploading in imagetransfer.py
Support for -asynchronous and -chunk_size flags were added to upload.py
in e68f619. This patch adds the same options to imagetransfer.py and just
maps them to the corresponding UploadBot parameters.
Bug: T300531
Change-Id: I46c1a2484475075921888d4782ec25715fa5271c
---
M scripts/imagetransfer.py
1 file changed, 16 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/imagetransfer.py b/scripts/imagetransfer.py
index 98743a2..c25e8bc 100755
--- a/scripts/imagetransfer.py
+++ b/scripts/imagetransfer.py
@@ -22,6 +22,10 @@
-force_if_shared Upload the file to the target, even if it exists on that
wiki's shared repo
+ -asynchronous Upload to stash.
+
+ -chunk_size:n Upload in chunks of n bytes.
+
-file:z Upload many files from textfile: [[Image:x]]
[[Image:y]]
@@ -144,6 +148,8 @@
'keepname': False,
'target': None,
'force_if_shared': False,
+ 'asynchronous': False,
+ 'chunk_size': 0,
}
def __init__(self, **kwargs):
@@ -162,6 +168,10 @@
shared to the target site (e.g. when moving from Commons to another
wiki)
:type force_if_shared: boolean
+ :keyword asynchronous: Upload to stash.
+ :type asynchronous: boolean
+ :keyword chunk_size: Upload in chunks of this size bytes.
+ :type chunk_size: integer
"""
super().__init__(**kwargs)
if self.opt.target is None:
@@ -217,7 +227,9 @@
keep_filename=self.opt.keepname,
verify_description=not self.opt.keepname,
ignore_warning=self.opt.ignore_warning,
- force_if_shared=self.opt.force_if_shared)
+ force_if_shared=self.opt.force_if_shared,
+ asynchronous=self.opt.asynchronous,
+ chunk_size=self.opt.chunk_size)
# try to upload
if bot.skip_run():
@@ -347,7 +359,7 @@
for arg in local_args:
opt, _, value = arg.partition(':')
if opt in ('-ignore_warning', '-interwiki', '-keepname',
- '-force_if_shared'):
+ '-force_if_shared', '-asynchronous'):
options[opt[1:]] = True
elif opt == '-tolang':
target_code = value
@@ -355,6 +367,8 @@
target_family = value
elif opt == '-tosite':
options['target'] = value
+ elif opt == '-chunk_size':
+ options['chunk_size'] = value
else:
generator_factory.handle_arg(arg)
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/762107
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I46c1a2484475075921888d4782ec25715fa5271c
Gerrit-Change-Number: 762107
Gerrit-PatchSet: 1
Gerrit-Owner: Xover <xover(a)pobox.com>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged