Extensão:CommonsMetadata
Estado da versão: estável |
|
|---|---|
| Implementação | API |
| Descrição | Procura extrair metadados de páginas do Commons |
| Autor(es) | Brian Wolff (bawolffdiscussão) |
| Política de compatibilidade |
Lançamentos de snapshot junto com o MediaWiki. A master não é retrocompatível. |
| MediaWiki | 1.25+ |
| PHP | 5.4+ |
| Modifica o banco de dados |
Não |
| Licença | GNU GPL (Licença Pública Geral) 2.0 ou superior |
| Download | |
|
|
| Para traduzir a extensão CommonsMetadata, verifique sua disponibilidade no translatewiki.net | |
| Problemas | Tarefas em aberto · Relatar um bug |
A extensão CommonsMetadata procura extrair metadados de páginas do Wikimedia Commons e de todos os outros projetos da Wikimedia. Ela adiciona informações extras à API imageinfo com base em predefinições e categorias inseridas na descrição da imagem. A extensão é usada por várias outras extensões e ferramentas (como o Extensão:MultimediaViewer, o Extension:VisualEditor, o Extension:MobileFrontend e o serviço de conteúdo móvel — MCS) para fornecer caixas de diálogo ou seleções de imagens aprimoradas.
No momento, a extensão destina-se a ser uma solução temporária que eventualmente será substituída pelo Wikidata no Commons.
Instalação
- Baixe e mova a pasta extraída
CommonsMetadataao seu diretórioextensions/.
Desenvolvedores e colaboradores de código, por outro lado, deverão instalar a extensão a partir do Git, usando:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CommonsMetadata
- Adicione o seguinte código ao final do seu arquivo LocalSettings.php:
wfLoadExtension( 'CommonsMetadata' );
Concluído – Navegue à página Special:Version em sua wiki para verificar se a instalação da extensão foi bem sucedida.
Motivação e escolhas de design
Os pressupostos dessa extensão são os seguintes:
- Em algum ponto no futuro, o Wikidata assumirá o manuseio de metadados no Commons. Para evitar mudanças conflituosas, que em breve haveriam se der mudadas mais uma vez, a extensão deve trabalhar com metadados do Commons da forma que está sendo feita hoje (de forma a não introduzir novas funções ao analisador sintático). Portanto, é utilizado o método screen scraping.
- O conteúdo de diversos campos em uma página de descrição do Commons inclui formatação (particularmente: ligações, itálicos, negrito e, em alguns casos, itens mais complexos, como imagens incorporadas)
- As a result, the extension outputs parsed html (wikitext sucks, plain text doesn't capture the data).
- Furthermore, the data tends to be formatted for human display rather than (for example) machine-formatted dates. When the date field says something like "circa 1600s", it's hard to convert that to a precise date (many examples can be).
- To carry that forward, also apply formatting to EXIF metadata, which is controlled on the wiki (For example, Commons links the camera name to a Wikipedia article).
- Se não for possível extrair as informações da página de descrição e o arquivo estiver marcado com metadados EXIF/XMP/iptc, esses serão utilizados como fallback.
- Ideally, such a system would be as Commons-specific as possible, with the Commons and non-Commons parts separated.
- As páginas de descrição do Commons possuem descrições em vários idiomas. Entretanto, acreditamos que a maioria dos usuários prefere vê-las em somente um deles.
- This implementation applies per language conventions to dates and things. Additionally, for explicitly multi-lingual fields (description), there is an option to return all or just a single language. Even in single language mode, some things are still language-specific (like the thousands separator on numbers).
Configuration
| parameter | default | description |
|---|---|---|
$wgCommonsMetadataSetTrackingCategories
|
false
|
Add the following tracking categories to file pages when the corresponding information is not provided either via templates on the file page of (for some of these) EXIF metadata:
|
$wgCommonsMetadataPublicDomainPageUrl
|
https://commons.wikimedia.org/wiki/Help:Public_domain
|
Link used for 'license' attribute in schema.org markup for files in the public domain. |
$wgCommonsMetadataForceRecalculate
|
false
|
Force calculation of metadata even when the image is from a foreign repository that would provide it. This is meant for local development. |
Testando
Ao testar com imagens remotas (como as do Commons caso o $wgUseInstantCommons esteja ativado), é possível definir $wgCommonsMetadataForceRecalculate = true; para forçar o CommonsMetadata a analisar a página de descrição da imagem e extrair os metadados (se o repositório remoto também possuir o CommonsMetadata instalado, ele próprio retornará um output pela API).
Uso
Use a API imageinfo e inclua extmetadata como uma propriedade de informação de imagem especificada via iiprop.
Exemplo
Veja esse exemplo em ação na caixa de areia da API:
Dados retornados
No momento, essa extensão fornece os seguintes itens no campo extmetadata da resposta (os nomes dos campos foram escolhidos à medida do possível para estarem de acordo com o formato IPTC-IIM, utilizado nos cabeçalhos EXIF):
Data based on machine-readable data in the Information template:
- ImageDescription - image description
- Artist - author name (might contain complex HTML, multiple authors, etc)
- Credit - source
- DateTimeOriginal - time of creation (space-separated ISO 8601 timestamp whenever possible, but can be any other textual description of a date, possibly with HTML mixed in)
- ObjectName - title (for a book/painting; otherwise just the file name)
- Permission - contents of the Permission field of the template. It can be a lot of things (license template, OTRS ID, details on how to attribute...)
- AuthorCount - the number of templates with authors (e.g., Book, Photograph...). The number of actual authors might be higher if a template describes multiple authors in a single string.
Data based on machine-readable data in the Location template:
- GPSLatitude - latitude
- GPSLongitude - longitude
- GPSMapDatum - coordinate type (only
WGS-84supported for now)
Data based on machine-readable data in the license template:
- LicenseShortName - short human-readable license name
- LicenseUrl
- UsageTerms
- Copyrighted -
TrueorFalse(for public domain images)
For multi-licensed images, these values are currently unreliable.
- Attribution - custom attribution that should replace Artist + Credit (can also originate from the Information template)
- AttributionRequired - booleanish (phab:T86726), tells whether there is a legal requirement to attribute
- NonFree - booleanish, true means the image is not under a free license. (Used for non-Commons images only.)
Other data:
- CommonsMedadataExtension - contains the metadata parser version number; mostly for internal use
- License - a best guess at the license of the image (mostly for internal use by MediaViewer, might change; LicenseShortName is probably more reliable)
- Categories - a
|-separated list of the categories of the image.
Based on parsing category names, probably won't work for images not hosted on Commons.
- Restrictions - reuse restrictions such as trademarks or personality rights; an array of keywords (the class names from this table, without the
restriction-prefix). See also the restrict-* icons in MediaViewer. - DeletionReason - if set, the template is being considered for deletion.
(Based on the nuke template, probably not reliable outside Commons.) It contains a deletion reason, but it is phrased to be applicable for a log entry, so it might be misleading (e.g. past tense when actually it is not yet decided whether the image will be deleted).
See also
- Manual:File metadata handling
- Extensão:MultimediaViewer - currently the main user of the information provided by CommonsMetadata.
- Request for comment on handling image information
- Template detection on local wikis with locally uploaded files – Describes how to prepare the templates for fetching metadata and thus displaying them when using the MultimediaViewer extension.
| Esta extensão está sendo usada(o) por um ou mais projetos da Wikimedia. Isto significa que, provavelmente, a extensão é estável e funciona bem o suficiente para ser utilizada(o) em sites da web de alto tráfego. Procure pelo nome dessa extensão nos arquivos de configuração CommonSettings.php e InitialiseSettings.php da Wikimedia para verificar onde ela foi instalada. Uma lista completa das extensões instaladas numa wiki em particular podem ser visualizadas na página Special:Version da wiki. |
| Esta extensão está incluída nas seguintes fazendas/hospedagens (farms/hosts) e/ou pacotes wiki: Esta não é uma lista autoritativa (oficial). Algumas fazendas/hospedagens (farms/hosts) e/ou pacotes wiki podem conter esta extensão mesmo que não estejam listados aqui. Sempre verifique com suas fazendas/hospedagens (farms/hosts) ou pacotes wiki para confirmar. |
- Stable extensions/pt-br
- API extensions/pt-br
- GPL licensed extensions/pt-br
- Extensions in Wikimedia version control/pt-br
- ContentAlterParserOutput extensions/pt-br
- GetExtendedMetadata extensions/pt-br
- SkinAfterBottomScripts extensions/pt-br
- ValidateExtendedMetadataCache extensions/pt-br
- All extensions/pt-br
- Extensions used on Wikimedia/pt-br
- Extensions included in Canasta/pt-br
- Extensions included in Miraheze/pt-br
- Extensions included in WikiForge/pt-br
- Metadata/pt-br
- Data extraction extensions/pt-br
