Skip to content
This repository has been archived by the owner on May 16, 2022. It is now read-only.

Commit

Permalink
Add Semi-automatic updates feature
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Shishkin <me@teran.ru>
  • Loading branch information
teran committed Oct 15, 2017
1 parent 0e5924e commit 92efd51
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ build:
$(LUAC) -s -o temp/deduplicator.lrplugin/Info.lua temp/deduplicator.lrplugin/Info.lua
$(LUAC) -s -o temp/deduplicator.lrplugin/FindDuplicates.lua temp/deduplicator.lrplugin/FindDuplicates.lua
$(LUAC) -s -o temp/deduplicator.lrplugin/JSON.lua temp/deduplicator.lrplugin/JSON.lua
$(LUAC) -s -o temp/deduplicator.lrplugin/GithubCheckUpdates.lua temp/deduplicator.lrplugin/GithubCheckUpdates.lua
cp -rv temp/deduplicator.lrplugin build/
cd build && zip -r deduplicator.lrplugin.zip deduplicator.lrplugin

Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Usually for plugins is used `~/Library/Application\ Support/Adobe/Lightroom/Plug

# Usage

### Checking for duplicates

> Library -> Plug-in Extras -> Find duplicates
The plugin will start to check all the *available* images in your catalog this could take a while.
Expand All @@ -22,6 +24,12 @@ After the process would be completed the Deduplicator will put all the supposed

*NOTE:* the plugin takes selection or all photos if <= 1 photo is selected.

### Semi-automatic updates

> Help -> Plug-in Extras -> Check for updates
This will check GitHub if there's a new release and suggest you to check it out.

# How it works inside

Deduplicator plug-in relies on [imgsum](https://github.com/teran/imgsum) to calculate
Expand Down
27 changes: 27 additions & 0 deletions deduplicator.lrdevplugin/GithubCheckUpdates.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
local LrHttp = import 'LrHttp'
local LrDialogs = import 'LrDialogs'
local LrTasks = import 'LrTasks'

local json = require 'JSON'
json.strictTypes = true

require 'Info'

function checkForUpdates()
local responseBody, headers = LrHttp.get(latestReleaseJsonUrl)
r = json:decode(responseBody)
if r['tag_name'] ~= plugin_version then
local referToNewRelease = LrDialogs.confirm(
'Update is available!',
'Release ' .. r['tag_name'] .. ' is present, wanna visit release page?',
'Yes, I want to download an update!',
'No, thanks.'
)

if referToNewRelease == 'ok' then
LrHttp.openUrlInBrowser(r['html_url'])
end
end
end

LrTasks.startAsyncTask(checkForUpdates)
5 changes: 5 additions & 0 deletions deduplicator.lrdevplugin/Info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugin_build = 100002
plugin_version = plugin_major .. '.' .. plugin_minor .. '.' .. plugin_revision .. '.' .. plugin_build
plugin_id = 'me.teran.lightroom.deduplicator'
plugin_home_url = "https://github.com/teran/deduplicator"
latestReleaseJsonUrl = 'https://api.github.com/repos/teran/deduplicator/releases/latest'

return {
LrSdkVersion = 6.0,
Expand All @@ -17,5 +18,9 @@ return {
file = 'FindDuplicates.lua',
enabledWhen = 'photosAvailable',
},
LrHelpMenuItems = {
title = 'Check for updates',
file = 'GithubCheckUpdates.lua',
},
VERSION = { major=plugin_major, minor=plugin_minor, revision=plugin_revision, build=plugin_build, },
}

0 comments on commit 92efd51

Please sign in to comment.