diff options
author | Robin Krahl <me@robin-krahl.de> | 2014-08-31 13:09:36 +0200 |
---|---|---|
committer | Robin Krahl <me@robin-krahl.de> | 2014-08-31 13:09:36 +0200 |
commit | 9ad98b11c181fd1091eb7f24409780727b664b32 (patch) | |
tree | 7fa25e5ada64a55504e35efd8e25278d564f9e91 | |
parent | bc05340c84213b2771c012ff42ed2ff5d00974af (diff) | |
download | LrMediaWiki-9ad98b11c181fd1091eb7f24409780727b664b32.tar.gz LrMediaWiki-9ad98b11c181fd1091eb7f24409780727b664b32.tar.bz2 |
Fix #12: Add {{Location}} if GPS metadata is set
-rwxr-xr-x | mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua | 7 |
1 files changed, 7 insertions, 0 deletions
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)
|