Uploadmultiple.py
From Meta, a Wikimedia project coordination wiki
Script to upload multiple images to a Mediawiki wiki.
This script is not included in the framework yet and it needs work. Get the script here: Uploadmultiple.py
Use at your own risk.
Contents |
[edit] Usage
python [Global-arguments] [-debug] [-file:xxx] [-nodesc] [-rename]
Global arguments available for all bots
| arg | Description | Default |
|---|---|---|
| -family:xyz | Set the family of the wiki you want to work on, e.g. wikipedia, wiktionary, commons, wikitravel, …. This will override the configuration in user-config.py settings. | [[../user-config.py/]] parameter: family |
| -lang:xx | Set the language of the wiki you want to work on, overriding the configuration in user-config.py where xx should be the language code[1]. | [[../user-config.py/]] parameter: mylang |
| -log | Enable the logfile. Logs will be stored in the logs subdirectory. | [[../user-config.py/]] parameter: log ? |
| -log:xyz | Enable the logfile, using xyz as the filename. | |
| -nolog | Disable the logfile (if it's enabled by default). | |
| -putthrottle:nn -pt:nn |
Set the minimum time (in seconds) the bot will wait between saving pages. | [[../user-config.py/]] parameter: putthrottle ? |
| -verbose -v |
Make the program output more detailed messages than usual to the standard output about its current work, or progress, while it is proceeding. This may be helpful when debugging or dealing with unusual situations. | not selected |
[edit] Arguments
| -debug | Switch to debug mode. Files are not actually uploaded. |
| -file:xxx | Specify the file which contains the list of filenames to be uploaded. |
| -nodesc | Do not ask for a description for each file. |
| -rename | Prompt for a new filename for each file in the filelist. |
[edit] Description
This bot uploads multiple files as specified in a list of files in a separate text document ("uploadlist.txt" by default). Each file name should be in quotation marks and comma separated with no line breaks. For example:
"file1.jpg","file2.jpg","c:\docs\wiki\something.jpg"
It is recommended that you rename your files to the desired destination names BEFORE running this script, for two reasons. First, this script won't ask you for the new filename unless you specify the -rename argument, and second, since you can't see the image you're about to upload, it makes it tough to know which file is which if they're all called IMG_0023, etc.
Once you have all your files renamed, you can export a list of the files in a directory using the DOS "dir" command, like this:
dir /w > uploadlist.txt
This will drop all of the filenames into a text file named uploadlist.txt. Then, open that file with a text editor and do some quick find-and-replaces to trim it down to just a list of filenames, each in quotation marks and comma separated, as shown above. If there are extra files in the directory which you don't want uploaded then be sure to edit them out of the file at this time.
Then execute the script. Good luck.