You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

User:4nn1l2/batch-upload

From Wikitech-static
Jump to navigation Jump to search

c:Category:1902 Encyclopædia Britannica maps

qpdf 1902_Encyclopædia_Britannica_-_Volume_34_-_Maps.pdf 1902_Encyclopædia_Britannica_-_Volume_34_-_Page.pdf --pages . 1-508 -- --split-pages
  • PDF to JP2
 for i in {001..508}; do pdfimages -jp2 1902_Encyclopædia_Britannica_-_Volume_34_-_Page-$i.pdf 1902_Encyclopædia_Britannica_-_Volume_34_-_Page_$i; done

This is a combination of a for loop in bash and pdfimages command line.

  • Remove the crap
rm *.pdf
rm *.ppm
rm *.pbm
  • Jp2 to JPEG [MediaWiki limitation]
 for i in {001..508}; do mogrify -format jpg 1902_Encyclopædia_Britannica_-_Volume_34_-_Page_$i.jp2; done

Again a combination of for loop in bash and mogrify (ImageMagick) command line.

  • Rename files en mass [if needed]
 for i in {001..508}; do mv 1902_Encyclopædia_Britannica_-_Volume_34_-_Page_$i.jpg 1902_Encyclopædia_Britannica_-_Volume_34_-_Page_$i_ -_Foo.jpg; done
  • Upload by pywikibot

Go to the upper directory of the pywikibot directory

python pwb.py login
python pwb.py upload -keep -noverify -summary:upload_britanica directory_in_which_files_are_saved "description text"