Backing up (my) Commons files

I’m experimenting with an idea of treating the Commons copies of my photos as the ‘master’ copy, and not keeping them online anywhere else (e.g. Flickr). This involves uploading to Commons and then keeping a local copy in sync — because I don’t want to lose any photos if they get deleted from Commons.

I’m using Digikam locally, and have two collections configured: one scratch-pad one, for sorting out photos that are just off the camera; and one backup one, which lets me browse photos I’ve got on Commons.

I download from Commons with the following backup.sh script, which goes through all of my contributions and exports XML for every page I’ve worked on, and every file for which I’m the first author (i.e. I uploaded it).

#!/bin/bash
BACKUP_DIR=$(cd "$(dirname $0)"; pwd -P)
mwcli export:contribs \
	--config="$BACKUP_DIR/config.yml" \
	--wiki=commons \
	--user=samwilson \
	--dest="$BACKUP_DIR" \
	--only-author

The mwcli script is at github.com/samwilson/mwcli

The reason I want the Commons copy to be canonical is that it makes for centralised metadata, a single place to edit and add links to related material. It’s annoying to have to keep metadata in sync between Commons, Flickr, and possibly a local copy of things too.

Putting photos in folders

I’m printing index sheets for the FSPS photos, so that each streets’ group of photos (e.g. Ainslie Road) in the archive folders is divided by a set of A4 colour-printed pages with thumbnails of the photos. These don’t actually have each photo’s URLs or filenames, which I’ve been a bit disappointed about, but it does have the URL of the street’s page. That is enough to get pretty close to an individual photo, and I think it’s good enough. If I were starting this project again I might do things a bit differently, but I’m far enough in now to want to maintain consistency.

I do want to sort out a better URL rewrite for page IDs. At the moment I am including page ID URLs such as https://archives.org.au/Special:Redirect/page/1100 but this would be neater as https://archives.org.au/P1100 (which would prohibit having wiki pages at that URL, but I think that’s okay).

Fremantle Bowling Club


Fatal error: Uncaught Exception: Unable to retrieve URL: https://tools.wmflabs.org/magnus-toolserver/commonsapi.php?image=File:Fremantle_Substation_06.jpg&thumbwidth=660 in /var/www/samwilson.id.au/wp-content/plugins/embed-wikimedia/embed-wikimedia.php:115 Stack trace: #0 /var/www/samwilson.id.au/wp-content/plugins/embed-wikimedia/embed-wikimedia.php(77): embed_wikimedia_get_data('https://tools.w...', 'xml') #1 /var/www/samwilson.id.au/wp-includes/class-wp-embed.php(173): embed_wikimedia_commons(Array, Array, 'https://commons...', Array) #2 /var/www/samwilson.id.au/wp-includes/class-wp-embed.php(427): WP_Embed->shortcode(Array, 'https://commons...') #3 [internal function]: WP_Embed->autoembed_callback(Array) #4 /var/www/samwilson.id.au/wp-includes/class-wp-embed.php(409): preg_replace_callback('|^(\\s*)(https?:...', Array, 'I tried to writ...') #5 /var/www/samwilson.id.au/wp-includes/class-wp-hook.php(286): WP_Embed->autoembed('I tried to writ...') #6 /var/www/samwilson.id.au/wp-includes/plugin.php(208): WP_Hook->apply_fi in /var/www/samwilson.id.au/wp-content/plugins/embed-wikimedia/embed-wikimedia.php on line 115