User:4nn1l2/batch-upload
Appearance
c:Category:1902 Encyclopædia Britannica maps
- Split pages[1]
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"