Page MenuHomePhabricator

Camera categories: parse category and switch in mediawiki namespace
Open, LowPublicFeature

Description

Author: test5555

Description:
Allow categorization based on "model" value in exif data in the following ways:

(1) Using "[[Category:Exif model: $1]]" as value for "MediaWiki:Exif-model-value"

This currently adds the category to the file description page, but the file doesn't get categorized in the category. If the file description page already contains an identical category, the category is displayed twice.

(2) Using the following value for "MediaWiki:Exif-model-value":

{{#switch:$1
|NIKON D200=[[Category:Taken with Nikon D200 (exif)]]
|[[Category:Taken with $1 (exif)]]
}}

Currently the switch function doesn't seem to work. Based on:

(used from http://commons.wikimedia.org/wiki/MediaWiki:Exif-make-value ),
it appears that this used to work.

(3) Possibly allow a combination of "exif-make-value" and "exif-model-value" to select the category.

Fixing at least (1) of the above would allow to generate categories for cameras automatically, see:
http://commons.wikimedia.org/wiki/Category:Photographs_by_camera
for manually made ones.


Version: 1.16.x
Severity: enhancement
URL: http://commons.wikimedia.org/wiki/MediaWiki:Exif-model-value

Details

Reference
bz21795

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:49 PM
bzimport set Reference to bz21795.
bzimport added a subscriber: Unknown Object (MLST).

There're two problems:

  • first one (easily fixable): parameters are replaced after parsing magic words, this means the switch will always evaluate to the default case
  • second one (hard to fix, if this would ever been fixed one day): recording category membership and other links is done just after saving the new edit (in the same request) and not when rendering the page. Furthermore, this is only done for the content of the article (i.e. what you have in the text box) and not for system messages used arround it. If exif data where added to the wikitext before parsing the page, this mean we would need either to record all used exif messages as templates so that the links are updated each of these message changes (and I don't see a clean way to do it) or to invalidate all images pages each time a exif message changes (which would be very expensive).

test5555 wrote:

I mentioned your comment at Commons:Village pump ([[Commons:Commons:Village_pump#How is camera type categorization done?]])

*for the first problem: yes, {{#switch:$1|$1=Result 1|asdf=Result 2|Result 3}} currently gives Result 1 for $1="asdf". One could restore the previous
behavior (Oct 2007) to provide pretty links to Wikipedia, but I don't think this is a priority.

test5555 wrote:

*for the second problem:

The general idea is to evaluate exif data and create categories based on that.

It seems that this would need a step where exif data is evaluated when a file is uploaded/re-uploaded or an exif mediawiki namespace message is changed. This wouldn't necessarily be more expensive than any change to http://commons.wikimedia.org/wiki/Template:Information. It is likely that people would edit it each time a new camera type is discovered (or a camera manufacturer changes its camera string).

a. One way to solve this could be to create a separate table with the exif data and make this searchable. Given the structure of exif data, this isn't necessarily that useful. An intermediate solution could be to parse some fields only into a table. A separate table wouldn't necessarily helpful unless we build an interface around it. Currently we can't make much use of MIME types (e.g. to identify SVG).

b. Another way could be based on the MediaWiki messages mentioned above.

c. A third way could be to create a special message in MediaWiki namespace (e.g. [[MediaWiki:Exif categories]]) that would be parsed on file upload/re-upload. It could contain variables for exif fields and switch functions to generate categories.

Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:01 AM

Maybe there should be a cirrus search task to expose this data as a search operator (?)