User:Guillom/KIPI

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

This page is a place to discuss the implementation of a KIPI plugin for Wikimedia Commons export. See this article for a bit of context.

MediaWiki classes[edit]

see API, api.php

MediaWiki Site[edit]

MediaWiki User[edit]

  • properties :
    • username:
    • blockInfo: (bool) user is blocked
    • hasMsg: (bool) user has new messages
    • rights: what rights user has (we need at least upload, perhaps edit)
    • rateLimits: Rate limits applying to the current user
  • methods:
    • accessors

MediaWiki Image[edit]

  • properties :
    • fileName: ()
    • fileExtension: () // or MIME type?
  • methods:
    • accessors

MediaWiki Page[edit]

  • properties :
    • : ()
  • methods:
    • accessors

Data formats[edit]

The API can output as a variety of formats.

CommonsUploader classes[edit]

CommonsUploader site[edit]

  • inherits the MediaWiki Site class
  • properties :
    • uploadCriteria: // fields that are mandatory for upload
    • incompleteUploadCriteria: // fields that are not necessarily mandatory for uploads, but files will be held in incomplete uploads if they're not provided
  • methods:
    • accessors

CommonsUploader Image[edit]

  • inherits the MediaWiki Image class
  • properties :
    • thumb: ()
    • descriptions: () {lang+description} couples
    • author: ()
    • source: ()
    • categories: ()
    • geoData: ()
  • methods:
    • accessors
    • rotate

CommonsUploader Page[edit]

  • inherits the MediaWiki Page class
  • properties :
    • : ()
  • methods:
    • accessors
    • (private) methods to format and generate pageContent
      • e.g. formatting geodata according to the wiki policies
      • adding categories from tags starting with Category:

CommonsUploader Batch[edit]

  • properties :
    • images: () set of Image objects (max 100?)
  • methods:
    • accessors
    • loadToView
    • upload

Interface[edit]

View window[edit]

  • 1 model, 2 views: 1 view with thumbnails only (grid), 1 view with thumbnails and details (lines)
  • toggle between views: show details/ hide details
  • when empty: invitation to drag'n'drop & link to file dialog

Basic configuration[edit]

  • Login (username, password)
  • License selector → opens list of licenses to tick

Tab 2: Options[edit]

Module options
☐ Enable individual license selection (they will take precedence over the default license)
Upload options
☑ Use high throttle
☑ Add link to userpage to the author's name
☑ Silently rename the file if the chosen name can't be used (e.g. illegal characters, name too long)
☑ Rotate and reinitialise the EXIF rotation (until bug 6672 is fixed)
☑ Add the batch to User:X/gallery when the upload is complete
Restore defaults
Options to add later
☐ Always store uploads in Incomplete uploads
☑ Watch all uploaded images
☐ Remove geodata (bugzilla:20326)

Module execution[edit]

Init
  • Open the export module window
  • Load interface default values
  • Load custom options
  • Create an empty Batch object
File selection & preparation
  • If images were selected in the main app (e.g. digiKam), create an Image object for each, add them to the batch and display the batch in the view window
    Otherwise, keep the main view (with an invite to drag'n'drop and/or a link to add files using a file dialog)
  • Extract metadata
    • from the program database if there is one (e.g. digiKam) and if DB & files have been sync'd (assuming that reading metadata from the DB is faster than re-extracting them from the files)
    • directly from the files otherwise
    and write them into the appropriate properties of the Image objects. We want:
    • {description(s) + lang they're in}
    • author
    • categories (from tags)
    • geodata
    • other?
  • update the view window with this information (globe icon to indicate geodata?)
Upload
  • check read+write API is enabled
  • check file upload is enabled
  • get site info; add to Wiki properties
  • login
  • get user info; add to User properties
  • check user is not blocked & has upload right
  • check new messages (to do before, probably)
  • start to upload batch
    • upload files with relevant pageContent and according to criteria (for upload or upload to Incomplete uploads)
      → give real-time feedback and ETA; indicate success or failure for each file (e.g. in the view window, à la jUploader)
  • add a gallery to user:X/gallery, if option is enabled

To do later[edit]

Wikimedia Commons export w/ categories support[edit]

Other[edit]

  • I18n (translatewiki)
  • Custom templates
  • ETA
  • Export to any MediaWiki

Resources[edit]