Manual:Pywikibot/flickrripper.py/zh

flickrripper is a script for easy upload of large numbers of images from Flickr to Wikimedia Commons.

它目前处于pre-alpha状态.

Commons:Batch uploading/Flickr images by user上的一些人要求使用此工具.

安装
Flickrripper是Pywikibot的一部分. 您首先需要安装pywikibot. 您可以在使用python pywikibot找到有关如何安装pywikibot的手册

建议使用GIT或夜间安装.

安装pywikibot后，可能需要安装另外三个Python软件包.

简单安装
要使用“Easy install”安装额外的软件包，请安装最新版本的setuptools，可以从http://pypi.python.org/pypi/setuptools下载.

Python Image Library (PIL) is used to show the image.
 * Python Image Library

You can install it by running the command at a command prompt:

或

The Python Flickrapi kit is used to communicate with the Flickr api.
 * Flickrapi kit

您可以通过在命令提示符下运行命令来安装它：


 * TkInter
 * 您可以使用常用的包管理器安装[ 此库]；不要忘记 包.

pip
All of the extra packages may be installed at once using, using whatever permissions you have, with:

Python 3
Python 3 is not supported by.

Flickr身份验证
您需要有效的Flickr API密钥才能运行此程序. 你可以在这里申请一把非商业API密钥.
 * Flickr API密钥

Edit user-config.py with your favorite text editor, and add the following in it.
 * Configuration


 * api_key : Provide your Flickr API key.
 * review : If you want to mark all images as review automatically. Use "True" only if you have a reviewer or sysop flag on Commons!
 * reviewer : Add your username here if you want to mark images as reviewed by you.

Now you'll be requested to login on your first run of the script, to confirm the application.

The text login doesn't work (needs JavaScript), preventing logging in using a terminal (such as Tool Labs).

It is better to run  on your home computer so that the confirmation form is opened in your standard browser.

用法
To run Flickrripper you have to browse to the Pywikibot folder. Then type the following:

with some of the various following options; the necessary ones are bolded.

Notes:
 * the script never uploads duplicate files (identified with their hash);
 * unless the files you're uploading all have title, description etc., edit the script to add a "prefix" to the filenames: look for the   line, replace "Flickr" with your filename prefix in  (can be e.g. the name of the category you're using).

Options to tell what images to work on: Options to tell how to work on each image:
 * One of the following:
 * -group_id - The id of the Flickr group to work on. Works on all images in a group.
 * -photoset_id - The id of the Flickr set to work on. Works on all images in a set.
 * -user_id - The id of the user to work. Works on all images uploaded by a user. Username is not an id! For example, id for user The Library of Congress is 8623220@N02 (you can find it here).
 * One or both of:
 * -start_id - Start at the photo with this id (useful for resuming uploads). Use this in combination with -group_id/-photoset_id/-user_id.
 * -end_id - Stop at the photo with this id (useful if you just want to do a part of the upload and later resume with -start_id).
 * 1) -tags - Filter out a certain tag (only one at the moment, will be changed to support multiple tags).
 * 2) -flickrreview - Mark as flickrreviewed, this overrides the settings in your user-config.py.
 * 3) -reviewer - Set the reviewer for flickrreview, this overrides the settings in your user-config.py.
 * 4) -override - Remove the licensing part and replace it with something custom. Can be used for transferring copyrighted photo's for which you have OTRS permission. Use with care!
 * 5) -removecategories - Don't add categories from automatic suggestions.
 * 6) -addcategory - Manually add a category, which you will be asked for after launching and will not be shown in the description in the confirmation dialog. Does not yet support multiple categories, but you can pass multiple as if they were one only, like this:.
 * 7) -autonomous - For autonomous uploading without showing of each image. Use with care!

Syntax:

故障排除
 Traceback (most recent call last): File "flickrripper.py", line 41, in    from PIL import Image, ImageTk    # see: http://www.pythonware.com/products/pil/ ImportError: No module named PIL You can fix this by manual PIL installation (not by easy_install): «[http://effbot.org/imagingbook/imagetk.htm If you’re using a prebuilt version of PIL, you might need to install additional packages to be able to use the ImageTk module. For example, on Ubuntu, you need both python-imaging and python-imaging-tk]».