Commons:Eroplueden iwwer d'Kommando-Zeil

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
This page is a translated version of a page Commons:Command-line upload and the translation is 17% complete. Changes to the translation template, respectively the source language can be submitted through Commons:Command-line upload and have to be approved by a translation administrator.

It is possible to upload to Wikimedia Commons using command-line tools.

Script Dependencies Batch upload {{Information}} support
Nichalp's Upload Script Perl Yes 7 licenses
Anuta Perl, Python and csv_creator.pl Yes 7 licenses
Simple Commons Uploader Python Yes only Cc-by-sa-2.0
upload.py from Pywikibot Python No none

Nichalp's upload script

A Perl script that creates a CSV file with the list of photographs in a folder. Enter all information, such as description, licence, category, latitude, longitude and so on. Also embeds certain Exif data to the photograph such as GPS data, name, licence etc. In addition, you can also rotate and rename it on-the-fly.

Wmigda's upload script

A Python version of Nichalp's upload script but that is dependent on the upload.csv-file that one of Nichalp's two Perl script generates.

Requirement: At least Perl and Python and one of Nichalp's two scripts, see documentation for further details

Fastily's upload script

A Python program which can upload whole folders on your computer with basic information and a category (determined by the name of the enclosing folder).

Tools to upload files from other websites

Flickrripper is a free Python program for easy upload of large numbers of images from Flickr to Wikimedia Commons. The program is documented in mw:Manual:Pywikibot/flickrripper.py.

Python Wikipedia Bot

The python framework includes various file upload tools. These tools require installing Python and the pywikibot framework. If each upload is checked prior to upload (see verifyDescription option below), it isn't considered a bot.

For detailed information on its usage:

Fir Iech mat dësem Tool anzeloggen brauch de Fichier mat Ären Astellungen dës Astellungen:

family = 'commons'
mylang = 'commons'
usernames['commons']['commons'] = 'nick'

Gebrauch:

Sample using pywikibot's UploadRobot in your own script

# -*- coding: utf-8  -*-

import sys

import pywikibot
from pywikibot.specialbots import UploadRobot

def complete_desc_and_upload(filename, pagetitle, desc, date, categories):
    #complete this once if applies to all files

    description = u"""{{Information
|Description    = {{en|1=""" + desc + """}}
|Source         = <!-- if applicable: {{own}} --->
|Author         = <!-- your name:  --->
|Date           = """ + date + """
|Permission     = 
|other_versions = 
}}
=={{int:license-header}}==
<!-- your license --->

""" + categories + """
[[Category:Taken with camera 123]]
"""
    url = [ filename ]
    keepFilename = False        #set to True to skip double-checking/editing destination filename
    verifyDescription = True    #set to False to skip double-checking/editing description => change to bot-mode
    targetSite = pywikibot.getSite('commons', 'commons')
    
    bot = UploadRobot(url, description=description, useFilename=pagetitle, keepFilename=keepFilename, verifyDescription=verifyDescription, targetSite=targetSite)
    bot.run()

def main(args):
    #list each file here
    
    filename    = """testimage-1.jpg"""
    pagetitle   = """testimage-1-from asdfasdfa.jpg"""
    desc        = """Mount St Helens viewed from ... in the rain"""
    date        = "2010-04-07"
    categories  = """[[Category:Locality]]
[[Category:Theme]]
[[Category:View type]]
[[Category:Feature1]]
[[Category:Feature2]]"""
    complete_desc_and_upload(filename, pagetitle, desc, date, categories)


    #sample with:  - local file name identical to file name at Commons
    #              - date as previous file
    #              - less quotes (no CR or " in fields)
    filename   = "testimage-2.jpg"
    pagetitle  = filename
    desc       = "Mount St Helens as seen from ... at sunset"
    categories = "[[Category:Locality]] [[Category:Theme]] [[Category:View type]] [[Category:Feature1]] [[Category:Feature2]]"
    complete_desc_and_upload(filename, pagetitle, desc, date, categories)
   

if __name__ == "__main__":
    try:
        main(sys.argv[1:])
    finally:
        pywikibot.stopme()

For other tools based on pywikipediabot, see multichill/bot and erfgoedbot.

BotClasses.php

Some bots, like User:BrooklynMuseumBot, were written in PHP based on BotClasses.php