python docker/termux script for upload to wikimedia commons photos of places, buildings and vehicles
Automation script for upload my photo collection to Wikimedia Commons. Commons categories, generate image descriptions based on Wikidata and EXIF. Limited to process images of buildings and vehicles.
python3 upload.py --location "United States" "Q868616" i/imgfolder
# Uploads files from i/imgfolder to Wikimedia Commons. Generate page name and description use Wikidata object for "Hollywood Boulevard", use Commons Category for this object. Append template {{Taken on|yyyy-mm-dd|location=United States}}
python3 upload.py Q382500 --location Russia --later i/imgfolder
# add to queue.sh command for Uploads files from i/imgfolder to Wikimedia Commons. Use Wikidata object Q382500, use Commons Category for this object. Append template {{Taken on|yyyy-mm-dd|location=Russia}}
python3 upload.py FROMFILENAME --location Russia i/imgfolder/Q123456_101_20230203_001_Q666_Q777.jpg
# Upload file/folder to commons category of wikidata object Q123456. If this is a some geographic region, like city district, will search for needed categories for Q666 and Q777 entities.
python3 upload.py railway.gpkg --location Russia i/imgfolder
# Upload file/folder, make spatial intersect of photo EXIF coordinates to vector polygons in file railway.gpkg, use it 'wikidata' field to determine object
-
Install Docker
-
Build image
git clone https://github.com/trolleway/placejpg.git
cd placejpg
docker build --tag placejpg:2023.11 .
docker run --rm -v "${PWD}:/opt/commons-uploader" -it placejpg:2023.11
# Create placejpg config, set author names
cp placejpgconfig.example.py placejpgconfig.py
nano placejpgconfig.py
# Create pywikibot config, set username
cp user-config.example.py user-config.py
chmod 600 user-config.py
nano user-config.py
docker run --rm -v "${PWD}:/opt/commons-uploader" -it placejpg:2023.11
Script use cache for state of wikidata entities.
rm temp_wikidata_cache.dat
- GPS coordinates
- DateTime
- GPS Dest coordinates optional
- Make optional
- Model optional
- Lens model optional
- F number optional
- focal length in 35mm format optional
Create building and upload files from directory i/21
./add-building.py --street "Волжский бульвар" --housenumber "21" --coords "55.70592 37.74983" -cs osm --levels 5 --levels_url https://www.reformagkh.ru/myhouse/profile/view/8113254 --year 1962 --year_url https://www.reformagkh.ru/myhouse/profile/view/8113254 --photos i/21 #г. Москва, б-р. Волжский, д. 21
- Download Overpasss data
- Use expression for generate command
'./add-building.py --street "'|| "addr:street" || '" --housenumber "'|| "addr:housenumber" || '" --coords "' ||round(y(point_on_surface( @geometry)),4) || ' ' || round(x(point_on_surface( @geometry)),4) ||'" -cs osm --levels '||"building:levels" || ' --photos "i/'|| replace("addr:housenumber",'/','_')||'"'