Skip to content

Commit

Permalink
Merge remote-tracking branch 'musselwhizzle/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
rderimay authored and rderimay committed Jan 9, 2017
2 parents 08ceb3b + 3fd8f98 commit 50758d3
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
2 changes: 1 addition & 1 deletion focuspoints.lrdevplugin/ExifUtils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function ExifUtils.getExifCmd(targetPhoto)
local metaDataFile = LrPathUtils.removeExtension(path)
metaDataFile = metaDataFile .. "-metadata.txt"

local cmd = "'"..exiftool .. "' -a -u -g1 -sort '" .. path .. "' > '" .. metaDataFile .. "'";
local cmd = "'"..exiftool .. "' -a -u -sort '" .. path .. "' > '" .. metaDataFile .. "'";

return cmd, metaDataFile
end
Expand Down
2 changes: 1 addition & 1 deletion focuspoints.lrdevplugin/Info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ return {
LrSdkMinimumVersion = 5.0,

LrToolkitIdentifier = 'com.thewhizzbang.focuspoint',
LrPluginName = "Focus Point",
LrPluginName = "Focus Point Viewer",

LrLibraryMenuItems = {
{
Expand Down
23 changes: 9 additions & 14 deletions focuspoints.lrdevplugin/ShowMetadata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,35 +79,30 @@ function splitForColumns(metaData)
local values = ""
for k in pairs(parts) do
local l = parts[k].key

local v = parts[k].value
if (l == nill) then l = "" end
if (v == nill) then v = "" end
l = LrStringUtils.trimWhitespace(l)
v = LrStringUtils.trimWhitespace(v)

labels = labels .. l .. "\r"
values = values .. v .. "\r"
end
return labels, values

end

function createParts(metaData)
local parts = {}
local num = 0;
for i in string.gmatch(metaData, "[^\\\n]+") do
local num = 1;
for i in string.gmatch(metaData, "[^\\\n]+") do
log("i = " .. i)

p = splitToKeyValue(i, ":")
if p ~= nill then
p = stringToKeyValue(i, ":")
if (p ~= nill) then
parts[num] = p
num = num + 1
elseif string.sub(i, 1, 4) == "----" then -- We have a category, lets create the corresponding parts
parts[num] = { ["key"] = "", ["value"] = "" }
num = num + 1
parts[num] = { ["key"] = "----" .. string.upper(i) .. "----", ["value"] = "" }
num = num + 1
num = num+1
end
end
return parts
end
end
21 changes: 20 additions & 1 deletion focuspoints.lrdevplugin/Utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ local myLogger = LrLogger( 'libraryLogger' )
myLogger:enable( "logfile" )

isDebug = false
isLog = true
isLog = false

--[[
-- Breaks a string in 2 parts at the position of the delimiter and returns a key/value table
Expand Down Expand Up @@ -67,6 +67,25 @@ function split(str, delim)
return t
end

--[[
Splits a string into 2 parts: key and value.
@str the string to split
@delim the character used for splitting the string
--]]
function stringToKeyValue(str, delim)
if str == nill then return nill end
local index = string.find(str, delim)
if index == nill then
return nill
end
local r = {}
r.key = string.sub(str, 0, index-1)
r.value = string.sub(str, index+1, #str)
return r
end



--[[
-- Logging function. If the global variable isLog is false, does nothing
-- str - string to be sent to the logger
Expand Down

0 comments on commit 50758d3

Please sign in to comment.