Commons:Batch uploading/U.S. Army Map Service

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

U.S. Army Map Service[edit]

About 250 maps of India and Pakistan from the U.S. Army Map Service

About 250 maps of India and Pakistan from the U.S. Army Map Service. And many more of other countries.

Source: https://www.lib.utexas.edu/maps/ams/india/
Category: Category:India maps by U.S. Army Map Service
License: {{PD-USGov}} / {{PD-USGov-Military-Army}}
Thanks, Yann (talk) 07:49, 10 September 2012 (UTC)[reply]

 Support Nice page and the request is formed well. I put it to my queue. (only the India and Pakistan maps as requested). --Slick (talk) 20:30, 10 September 2012 (UTC)[reply]

Thanks a lot! Yann (talk) 06:16, 12 September 2012 (UTC)[reply]

Opinions[edit]

Assigned to Progress Bot name Category
Slick done Slick-o-bot Category:India maps by U.S. Army Map Service

Scripts[edit]

I used the following scripts for this job.

#!/bin/bash
# download.sh
lynx --source https://www.lib.utexas.edu/maps/ams/india/ |grep "^<dt><a href"|grep "/maps/ams/india/"|while read line ; do

	link="`echo \"$line\"|cut -d '"' -f 2`"
	name="`echo \"$line\"|cut -d '>' -f 3|cut -d '<' -f 1`"
	file="`echo \"$link\"|rev|cut -d '/' -f 1|rev`"	
	
	wget "$link" -O "files/$file"

	echo "$link" > "files/$file.link"
	echo "$name" > "files/$file.name"

done

After downloading, I do some sed magic to cleanup and format the filenames (in *.name). Than I upload with this script:

#!/bin/bash
# upload.sh
ls -1 files/*.jpg | while read file ; do
	if ! cat upload.log | grep "^${file}$" &> /dev/null ; then
	
python pywikipedia/upload.py -keep -filename:`echo "Map India and Pakistan 1:250,000 Tile \`cat ${file}.name\`.jpg" | sed 's/ /_/g'` -noverify "${file}" "{{Information
|Description={{en|1=`cat ${file}.name`. Tile of the Map India and Pakistan 1:250,000. Series U502, U.S. Army Map Service, 1955}}
|Source=https://www.lib.utexas.edu/maps/ams/india/ [`cat ${file}.link`]
|Date=1955
|Author={{en|1=U.S. Army Map Service}}
|Permission={{PD-USGov}}
|other_versions=<gallery>File:India and Pakistan AMS index.jpg|Index Map</gallery>
}}

[[Category:Old maps of India]]
[[Category:India maps by U.S. Army Map Service‎]]
[[Category:Maps by the United States Army Map Service]]
[[Category:Pakistan maps by U.S. Army Map Service]]" && echo "$file" >> upload.log

				echo "Sleeping 10s ..."
				sleep 10
	fi
done