Commons:DtMediaWiki

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

dtMediaWiki is a Wikimedia Commons export plugin for darktable.

Dependencies[edit]

  • lua-sec
Lua bindings for OpenSSL library to provide TLS/SSL communication
  • lua-luajson
JSON parser/encoder for Lua
  • lua-multipart-post
HTTP Multipart Post helper

note that mediawiki.lua is independent of darktable.

Installation[edit]

ie https://github.com/trougnouf/dtMediaWiki/archive/master.zip
  • Create the darktable plugin directory if it doesn't exist
# mkdir /usr/share/darktable/lua/contrib
  • Copy (or link) the dtMediaWiki directory over there
# cp -r /path/to/dtMediaWiki /usr/share/darktable/lua/contrib
  • Activate the plugin in your darktable luarc config file by adding `require "contrib/dtMediaWiki/dtMediaWiki"`
$ echo 'require "contrib/dtMediaWiki/dtMediaWiki"' >> ~/.config/darktable/luarc

or, when using Arch Linux, install the AUR package darktable-plugin-dtmediawiki-git and activate the plugin.

Usage[edit]

Categorizing on dtMediaWiki
  • Login to Wikimedia Commons by setting your "Wikimedia username" and "Wikimedia password" in *darktable preferences > lua options* then restarting darktable.
This will add the "Wikimedia Commons" entry into target storage.
  • Ensure your image metadata contains the following:
  • a title and/or description.
The default output filename is "title (filename).ext"
  • rights
Use something compatible with the {{self}} template, some options are "cc-by-sa-4.0", "cc-by-4.0", "GFDL", "GFDL|cc-by-sa-4.0,3.0,2.5,2.0,1.0", ...
  • tags: Categories and templates
Any tag that matches "Category:something" will be added as [[Category:something]] (no need to include the brackets).
Likewise, any template matching "{{something}}" will be added as-is.
Descriptions can be added in different languages this way (eg: {{fr|Une description}}), and additional templates can be placed within the description (eg: additional languages, competitions, heritage ID, ...) through the darktable preferences > lua options.
Other versions can be automatically added using the "alt:<filename>" tag. The other image must be in the current collection to be found, its title must be filled out in order to generate the valid Wikimedia filename for it, and filename does not have to be complete (eg: "alt:5518" may be used in place of "alt:DSCF5518.RAF")

The image coordinates will be added if they exist, and by default the creator metadata will be added as [[User:username|creator]] if a creator has been set.

Some substitution is performed in the tags so that the keywords $CREATOR, $USERNAME, $FILE_NAME, and $DATETIME are replaced with their respective values.

Thanks[edit]

--Trougnouf (talk) 18:54, 2 September 2018 (UTC)[reply]
  • Iulia and Leslie for excellent coworking companionship and love
  • darktable developers for an excellent open-source imaging software with a well documented lua API
  • LrMediaWiki developers robinkrahl and Hasenlaeufer for what inspired this and some base code
  • mw:User:Platonides for helping me figure out the cookie issue
  • catwell: author of lua-multipart-post and a responsive fellow
  • de:User:Simon04: second user and first contributor