From 9ad98b11c181fd1091eb7f24409780727b664b32 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sun, 31 Aug 2014 13:09:36 +0200 Subject: Fix #12: Add {{Location}} if GPS metadata is set --- mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua b/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua index 04e783a..f2745e4 100755 --- a/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua +++ b/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua @@ -81,6 +81,7 @@ MediaWikiExportServiceProvider.processRenderedPhotos = function(functionContext, end if MediaWikiUtils.isStringEmpty(description) then rendition:uploadFailed(LOC '$$$/LrMediaWiki/Export/NoDescription=No description given for this file!') + return end local source = exportSettings.info_source local timestampSeconds = photo:getRawMetadata('dateTimeOriginal') @@ -95,6 +96,12 @@ MediaWikiExportServiceProvider.processRenderedPhotos = function(functionContext, local categories = exportSettings.info_categories local additionalCategories = photo:getPropertyForPlugin(Info.LrToolkitIdentifier, 'categories') or '' + local gps = photo:getRawMetadata('gps') + if gps and gps.latitude and gps.longitude then + local location = '{{Location|' .. gps.latitude .. '|' .. gps.longitude .. '}}\n' + templates = location .. templates + end + local fileDescription = MediaWikiInterface.buildFileDescription(description, source, timestamp, author, license, templates, other, categories, additionalCategories) MediaWikiInterface.uploadFile(pathOrMessage, fileDescription) -- cgit v1.2.3