User:Nichalp/Upload script: Difference between revisions

Content deleted Content added
Nichalp (talk | contribs)
Bugs: no known bugs
Eugrus (talk | contribs)
m Executing the script 25px: Excel, obviously - not Word
 
(42 intermediate revisions by 22 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.5em8em">'''Nichalp's uploadUpload scriptScript'''</div>
 
 
'''Nichalp's Upload Script''' is a script written in [[w:Perl|Perl]] that helps you upload your photographs ''en masse'' to commons. Instead of manually adding a description, the date, categories, licence information, and geo-templates to each image, you can write it just once, and the script will format it as wiki-syntax for the entire series of images you want to upload. This is particularly useful if you have to fill in similar information for a series of images. But that's not all! You can do so '''much''' more.
 
*[[Image:NuvolaThe appsscript katecan be used on Microsoft Windows and GNU/Linux.png|25px]] '''Note''':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 decLocation}} infoboxtemplate if GPS valuescoordinates are mentionedsupplied.
* (Optional) Adds the {{tl|Photo Information}} template (Optional)
* (Optional) Adds the {{tl|flickr-self}} template, (Optional)if you have upload the same image to Flickr.
* Creates a ''gallery.txt'' file with imagesthe list of image in wikimarkupwiki-syntax. so thatThis allows you canto addcopy-paste thesethe imagestext into aan 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]]==
The Upload script is a powerful perl script that automates mass photograph uploads. In addition, it also does the following:
There are two scripts that need to be used.
* Adds all meta information in {{tl|information}}
# 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.
* Embeds Exif values including author name and GPS coordinates
# Using any Spreadsheet software, fill up the various fields such as description, new name, category and so on.
* Automatically rotates images to the correct orientation
# Run the second script to read the CSV file data, and upload the corresponding file to commons.
* Adds the {{tl|location dec}} infobox if GPS values are mentioned
* Adds the {{tl|Photo Information}} template (Optional)
* Adds the {{tl|flickr-self}} template (Optional)
* Creates a ''gallery.txt'' file with images in wikimarkup so that you can add these images into a gallery.
 
==Disclaimers [[Image:Nuvola apps important.svg|25px]]==
*[[Image:Nuvola apps important.svg|left|25px]] '''Warning''' The script will '''automatically upload over''' existing images. Make sure you check Commons if the file name you supplied already exists.
*[[Image:Nuvola apps important.svg|left|25px]] '''Warning''' This script is largely untested for all permutations and combinations. Use at '''your own risk'''. See [[#Bugs]].
 
*[[Image:Nuvola apps important.svg|left|25px]] '''Warning''' 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.
*[[Image:Nuvola apps important.svg|left|25px]] '''Warning''' The script will '''automatically upload over''' existing images. Make sure you check Commons if the file name you supplied alreadydoes not exist in existscommons.
* 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]]==
*[[Image:Nuvola apps kate.png|25px]] '''Note''': This script is for uploading your '''own''' images (JPG format).
You must have the following installed to run the scripts:
*[[Image:Nuvola apps kate.png|25px]] '''Note''': 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.
# [[w:Perl|Perl]]
# ExifTool library
# Text:CSV parser library
# libjpeg.
 
Read the [[/installation|installation guide]] to install the above for Microsoft Windows or Linux.
==Essentials==
You must have [[w:Perl|Perl]] installed along with these libraries: ExifTool, Text:CSV parser, and libjpeg. Read the [[/installation|installation guide]] to install.
 
==RunningExecuting the script [[Image:Gnome-devel.svg|25px]]==
<div style="background-color:#e8ece3">
[[Image:Nichalp-script.png|thumb|Script execution in progress.]]
 
Line 30 ⟶ 54:
#*[[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 OpenOffice.orgLibreOffice SpreadsheetCalc or Microsoft Office WordExcel.
# 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]]==
==Bugs==
# The last version will give a strange declaration error concerning $csv. See [[User talk:Nichalp/Upload script]] for a fix.
''not known''
# 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, whoauthor helpedof inExifTool thefor clarifyinghis ExifToolwonderful issues,script and for the use of hishelp libraryprovided.
==See Also==
* [[Commons:Commonist]]
 
 
[[Category:Nichalp's upload script| ]]
[[Category:Commons upload]]