aboutsummaryrefslogtreecommitdiff
path: root/mediawiki.lrdevplugin
diff options
context:
space:
mode:
authorHasenlaeufer <eckhard.henkel@t-online.de>2016-02-21 00:41:32 +0100
committerRobin Krahl <me@robin-krahl.de>2016-02-21 00:41:32 +0100
commite6db8d7cb75b1a126acf050ab27d91ffe5e18ae5 (patch)
treecd4a0aebbb3fc2fcfb1ce6168a1f538d14852252 /mediawiki.lrdevplugin
parentfe78c8f2aa95c4838d75ec2faecd35ce1ac93eca (diff)
downloadLrMediaWiki-e6db8d7cb75b1a126acf050ab27d91ffe5e18ae5.tar.gz
LrMediaWiki-e6db8d7cb75b1a126acf050ab27d91ffe5e18ae5.tar.bz2
MediaWikiExportServiceProvider: remove warning if heading is not set
Remove the critical warning when the GPS heading used for the generation of the Location template is nil. This does not necessaricily indicate an invalid value, as previously assumed. Instead it is possible that this metadata field is just empty. Affected code: - MediaWikiExportServiceProvider: remove wrong warning, minor changes - TranslatedStrings_de: remove unnecessary message Follow-up to c722a7d91ac70325277998e2a07d4041705ffc6d, related to #35.
Diffstat (limited to 'mediawiki.lrdevplugin')
-rwxr-xr-xmediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua25
-rwxr-xr-xmediawiki.lrdevplugin/TranslatedStrings_de.txt1
2 files changed, 14 insertions, 12 deletions
diff --git a/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua b/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua
index 26050f0..672be3c 100755
--- a/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua
+++ b/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua
@@ -29,7 +29,7 @@ local MediaWikiUtils = require 'MediaWikiUtils'
local MediaWikiExportServiceProvider = {}
MediaWikiExportServiceProvider.processRenderedPhotos = function(functionContext, exportContext)
- -- configure progess display
+ -- configure progress display
local exportSession = exportContext.exportSession
local photoCount = exportSession:countRenditions()
exportContext:configureProgress{
@@ -110,10 +110,10 @@ MediaWikiExportServiceProvider.processRenderedPhotos = function(functionContext,
local subText = LOC('$$$/LrMediaWiki/Interface/MessageByMediaWiki=Message by MediaWiki for Lightroom')
if gps and gps.latitude and gps.longitude then
local location = '{{Location|' .. gps.latitude .. '|' .. gps.longitude
- -- If LR field "Direction" (German: "Richtung") is set, add "heading" parameter to Commons template "Location"
-
- -- The LR version is checked, because Adobe introduced the parameter "gpsImgDirection" to the
- -- call of photo:getRawMetadata with LR SDK 6.0.
+ -- In addition: If the LR field "Direction" (German: "Richtung") is set, add "heading" parameter to
+ -- Commons template "Location"
+ -- Primary, the LR version needs to be checked, because Adobe introduced the parameter "gpsImgDirection"
+ -- to the call of photo:getRawMetadata with LR SDK 6.0.
-- Without LR version check, the usage of this plug-in shows
-- a warning message at export, if using LR version < 6 (e.g. 5):
-- English: Warning – Unable to Export: An internal error has occurred: Unknown key: "gpsImgDirection"
@@ -134,6 +134,13 @@ MediaWikiExportServiceProvider.processRenderedPhotos = function(functionContext,
local heading = photo:getRawMetadata('gpsImgDirection')
-- The call of "getRawMetadata" with parameter "gpsImgDirection" is supported since LR 6.0
if heading then
+
+ -- Test cases:
+ -- (1) heading has a value, e.g. 359.9876 => {{Location|50.9|8.5|heading:359.9876}}
+ -- (2) direction field is empty, heading should be '' => {{Location|50.9|8.5}}
+ -- (3) gps and direction are empty => no Location template
+ -- (4) direction is '0' (== North) => {{Location|50.9|8.5|heading:0}}^M
+ -- All test cases should be done (a) one photo is marked, (b) multiple photos are marked
-- At users with a LR version >= 6:
-- LR can store a direction value with up to 4 digits beyond a decimal point,
-- but shows at user interface a rounded value without decimal places (by mouse over the direction field).
@@ -151,10 +158,6 @@ MediaWikiExportServiceProvider.processRenderedPhotos = function(functionContext,
local hintMessage = hintLine1 .. '\n' .. hintLine2 .. '\n' .. hintLine3 .. '\n' .. hintLine4
local messageTable = {message = hintMessage, info = subText, actionPrefKey = 'Show hint message of used LR version'}
LrDialogs.messageWithDoNotShow(messageTable)
- else
- -- This shouldn't happen, because LR has a good direction field check, accepting only valid values.
- -- It might be impossible, to test this case. However, shit happens.
- LrDialogs.message(LOC '$$$/LrMediaWiki/Interface/InvalidDirectionValue=“Direction” has an invalid value.', subText, 'critical')
end
else -- LrMajorVersion < 6
if LrMajorVersion == 5 then
@@ -168,8 +171,8 @@ MediaWikiExportServiceProvider.processRenderedPhotos = function(functionContext,
LrDialogs.messageWithDoNotShow(table)
end
end
- location = location .. '}}\n' -- close Location template
- templates = location .. templates
+ location = location .. '}}' -- close Location template
+ templates = location .. '\n' .. templates
end
local fileDescription = MediaWikiInterface.buildFileDescription(description, source, timestamp, author, license, templates, other, categories, additionalCategories, permission)
diff --git a/mediawiki.lrdevplugin/TranslatedStrings_de.txt b/mediawiki.lrdevplugin/TranslatedStrings_de.txt
index bd83674..7847c33 100755
--- a/mediawiki.lrdevplugin/TranslatedStrings_de.txt
+++ b/mediawiki.lrdevplugin/TranslatedStrings_de.txt
@@ -22,7 +22,6 @@
"$$$/LrMediaWiki/Interface/HintHeadingTrueL3=Dieses Feature erfordert eine Lightroom-Version 6/CC oder höher."
"$$$/LrMediaWiki/Interface/HintHeadingTrueL4=Diese Lightroom-Version ist ^1, daher funktioniert das Feature."
"$$$/LrMediaWiki/Interface/Internal/NotLoggedIn=Interner Fehler: vor dem Upload nicht angemeldet."
-"$$$/LrMediaWiki/Interface/InvalidDirectionValue=„Richtung“ hat einen ungültigen Wert."
"$$$/LrMediaWiki/Interface/InUse/Cancel=Abbrechen"
"$$$/LrMediaWiki/Interface/InUse/Details=Es gibt bereits eine Datei mit dem Namen ^1. Überschreiben? (Die Dateibeschreibung wird nicht verändert.)"
"$$$/LrMediaWiki/Interface/InUse/OK=Überschreiben"