User:Nichalp/Upload script: Difference between revisions
Content deleted Content added
m →Executing the script 25px: Excel, obviously - not Word |
|||
(16 intermediate revisions by 13 users not shown) | |||
Line 1:
{{outdated|not working? fails to log-in}}
{{User:Nichalp/Upload script/infobox}}
<div style="text-align:center; font-size:1.8em">'''Nichalp's Upload Script'''</div>
Line 7 ⟶ 9:
The script can be used on Microsoft Windows and GNU/Linux. It has not been tested on Mac. If you have a fast internet connection, or plan to upload smaller files, consider getting a bot account to prevent the script from flooding the recent changes list.
==Features [[Image:Crystal package.png|25px]]==
* Rename the images on-the-fly.
* Rotate images on-the-fly.
* Autoformat wiki-syntax, so you do not have to worry about template parameters.
* Embeds your name, caption, and GPS data in the [[w:Exif|Exif]] information.
* Add descriptions in several languages.
* Adds the {{tl|Location}} template if GPS coordinates are supplied.
* (Optional) Adds the {{tl|Photo Information}} template
* (Optional) Adds the {{tl|flickr-self}} template, if you have upload the same image to Flickr.
* Creates a ''gallery.txt'' file with the list of image in wiki-syntax. This allows you to copy-paste the text into an image gallery.
* Rigorous checking to make sure that you have added a category, description, and licence to each image, and if parameters are in range.
==How it works [[Image:Cog-scripted-svg-blue.svg|25px]]==
There are two scripts that need to be used.
# The first script is used to scan all JPEG images in the directory, and store the information such as date, camera information and so on into a CSV (comma separated value) file. The image names and column headings are automatically added.
# Using any Spreadsheet software, fill up the various fields such as description, new name, category and so on.
# Run the second script to read the CSV file data, and upload the corresponding file to commons.
==Disclaimers [[Image:Nuvola apps important.svg|25px]]==
* This script is largely untested for all possible permutations and combinations. Use at '''your own risk'''. See also [[#Bugs]].
* Back up all images before uploading.
* The script will '''automatically upload over''' existing images. Make sure you check if the file name you supplied does not exist in commons.
* The script does not check if you have renamed the file correctly. Beware of introducing duplicate file names when renaming.
* By default, your commons password is visible on the monitor when asked to enter it. To hide it use: '''<code>perl upload.pl - secure</code>'''
* This script is currently limited to uploading only self-created photographs in JPG/JPEG format. Support for [[User_talk:Nichalp/Upload_script#About_non-JPEG's|other formats]] coming soon.
==Essentials [[image:Start hand.svg|25px]]==
You must have the following installed to run the scripts:
# [[w:Perl|Perl]]
# ExifTool library
# Text:CSV parser library
# libjpeg.
Read the [[/installation|installation guide]] to install the above for Microsoft Windows or Linux.
==Executing the script [[Image:Gnome-devel.svg|25px]]==
<div style="background-color:#e8ece3">
[[Image:Nichalp-script.png|thumb|Script execution in progress.]]
# Create a new folder.
# Copy the images you want to upload into the above folder.
#*[[Image:Nuvola apps kate.png|25px]] '''Note:'''- Images must contain the only following file extensions (.JPG, .jpg, .jpeg, .JPEG) to be picked up by the script. (PNG and other filetype support to come later)
#*[[Image:Nuvola apps important yellow.svg|25px]]'''Caution''':- Make sure you have backups of all images to be uploaded
# Copy the perl scripts: ''[[/csv_creator.pl|csv_creator.pl]]'' and ''[[/upload.pl|upload.pl]]'' into the folder.
# In the command line (Terminal in Linux/DOS in Windows), navigate to the above folder.
# Run ''csv_creator.pl'' from the command line by typing: '''<code>perl csv_creator.pl</code>'''
#:A CSV (comma separated value) file, ''upload.csv'' is created in the folder. The CSV file includes the header line, the list of image file names in the folder, and the corresponding image Exif information.
# Add the necessary information you want to the CSV file. To know how to format data in the CSV file, please read [[User:Nichalp/Upload script/csv fields|CSV fields explained]]. You can edit the data in your favourite spreadsheet software such as LibreOffice Calc or Microsoft Office Excel.
# Save the CSV file.
# Run ''upload.pl'' from the command line by typing: '''<code>perl upload.pl</code>'''
#* To specify your CSV file location, use '''<code>perl upload.pl file.csv</code>'''
#* To hide your password while typing it, use '''<code>perl upload.pl - secure</code>'''
#* To tell Perl to not load huge images/files into memory, but read them directly from disk while uploading, use '''<code>perl upload.pl - - disk</code>'''
#* If your CSV file does contain any UTF-8 (non-ASCII) characters, use '''<code>perl upload.pl - - - utf8</code>'''
# You are then asked to enter your username and password.
# The script then uploads the image along with the associated metadata. Errors if any, are logged in ''debug.txt''.
# A ''gallery.txt'' file is created in the same folder. This file contains the list of images marked up with the gallery wiki syntax. If you need, you can use the text to create image galleries.
</div>
==Bugs [[image:Nuvola apps bug2.svg|25px]]==
# The last version will give a strange declaration error concerning $csv. See [[User talk:Nichalp/Upload script]] for a fix.
# Enabling it for different file types like .png is possible. See [[User talk:Nichalp/Upload script]].
# Using permission "1" or "7" will result in unwanted outcomes. See [[User talk:Nichalp/Upload script]] for a fix.
# May hang if the computer is unattended for a long time. Solution: Check the last file uploaded. Quit the program, open the CSV file, delete all entries up to the last uploaded file. And restart the process.
# HTML formatting may appear in the command prompt. Reason unclear. Possible solution: Avoid editing in commons when uploading.
==Credits [[Image:Wiki-thanks.png|25px]]==
* [[User:Eloquence]] (Erik Möller) for [[Commons:File upload service/Script]], which I used to hack and cannibalise.
* Phil Harvey, author of ExifTool for his wonderful script and help provided.
==See Also==
* [[Commons:Commonist]]
[[Category:Nichalp's upload script| ]]
[[Category:Commons upload]]
|