-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDialog.lua
More file actions
executable file
·524 lines (459 loc) · 16.1 KB
/
Dialog.lua
File metadata and controls
executable file
·524 lines (459 loc) · 16.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
-- Dialogs
---------------------------------------------------------------------------------------------------
require ("APIKit")
require ("DialogTools")
Dialog = {}
local LrBinding = import 'LrBinding'
local view = import "LrView"
local dialogs = import "LrDialogs"
local function_context = import 'LrFunctionContext'
local bind = view.bind
----------------------------------------------------------------------------------------------------
function Dialog.start_dialog(property_table)
property_table.LR_minimizeEmbeddedMetadata = false
property_table.LR_metadata_keywordOptions = "lightroomHierarchical"
-- reset some properties, which must be set per upload
property_table.upload_album = ""
property_table.upload_album_ids = {}
property_table.upload_album_info = LOC "$$$/Ipernity/Dialog/albums/no_album=no album selected"
property_table.upload_group_ids = {}
property_table.upload_group_info = LOC "$$$/Ipernity/Dialog/groups/no_group=no group selected"
------------------------------------
property_table:addObserver('token', update_ipernity_account)
property_table:addObserver('ipernity_id', update_ipernity_account)
property_table:addObserver('public', update_privacy)
property_table:addObserver('family', update_privacy)
property_table:addObserver('friends', update_privacy)
property_table:addObserver('license', update_privacy)
property_table:addObserver('lightroom_tags', function()
if property_table.lightroom_tags then property_table.lightroom_tags_filter = false end
end)
property_table:addObserver('lightroom_tags_filter', function()
if property_table.lightroom_tags_filter then property_table.lightroom_tags = false end
end)
update_ipernity_account(property_table)
update_privacy(property_table)
end
----------------------------------------------------------------------------------------------------
function Dialog.export_top_sections(f, property_table )
return {
{
title = LOC "$$$/Ipernity/Dialog/Account=Ipernity Account",
synopsis = bind 'privacy_synopsis',
f:row {
f:static_text {
title = bind 'ipernity_id',
alignment = 'left',
fill_horizontal = 1,
font = "<system/bold>",
},
f:push_button {
width = 160,
title = bind 'ButtonLabel',
action = function()
function_context.postAsyncTaskWithContext( 'Call Auth URL',
function( context )
if property_table.token == nil then
property_table.token = iperAPI_authurl ()
elseif property_table.ipernity_id == "n.n." then
property_table.token = iperAPI_getToken (property_table.token)
iperAPI_checkToken (property_table)
else
property_table.token = nil
property_table.ipernity_id = "n.n."
end
end )
end,
},
},
f:row {
f:static_text {
title = bind('quota_info'),
alignment = 'left',
fill_horizontal = 1,
size = 'mini',
},
},
f:row {
f:separator {
fill_horizontal = 1,
},
},
f:row {
spacing = f:control_spacing(),
f:static_text {
title = LOC "$$$/Ipernity/Dialog/Privacy/header=Uploaded photos will be visible for"
},
f:checkbox {
title = LOC "$$$/Ipernity/Dialog/Privacy/Public=all users",
value = bind 'public',
checked_value = 1, unchecked_value = 0,
},
f:checkbox {
title = LOC "$$$/Ipernity/Dialog/Privacy/Family=your Family",
value = bind 'family',
enabled = bind 'is_private',
checked_value = 1, unchecked_value = 0,
},
f:checkbox {
title = LOC "$$$/Ipernity/Dialog/Privacy/Friends=your Friends",
value = bind 'friends',
enabled = bind 'is_private',
checked_value = 1, unchecked_value = 0,
},
},
f:row {
spacing = f:control_spacing(),
f:static_text {
title = LOC "$$$/Ipernity/Dialog/License/header=License used for publishing: "
},
f:popup_menu {
title = LOC "$$$/Ipernity/Dialog/License/License=License",
value = bind 'license',
items = {
{ title = LOC "$$$/Ipernity/Dialog/License/0=Copyright", value = 0 },
{ title = LOC "$$$/Ipernity/Dialog/License/1=Attribution (CC by)", value = 1 },
{ title = LOC "$$$/Ipernity/Dialog/License/3=Attribution+Non Commercial (CC by-nc)", value = 3 },
{ title = LOC "$$$/Ipernity/Dialog/License/5=Attribution+Non Deriv (CC by-nd)", value = 5 },
{ title = LOC "$$$/Ipernity/Dialog/License/7=Attribution+Non Commercial+Non Deriv (CC by-nc-nd)", value = 7 },
{ title = LOC "$$$/Ipernity/Dialog/License/9=Attribution+Share Alike (CC by-sa)", value = 9 },
{ title = LOC "$$$/Ipernity/Dialog/License/11=Attribution+Non Commercial+Share Alike (CC by-nc-sa)", value = 11 },
{ title = LOC "$$$/Ipernity/Dialog/License/255=Copyleft", value = 255 },
},
},
},
f:row {
f:static_text {
title = LOC "$$$/Ipernity/Dialog/privacy_info=You can override these settings in the metadata for each picture before export.",
alignment = 'right',
fill_horizontal = 1,
size = 'mini',
},
},
},
{
title = LOC "$$$/Ipernity/Dialog/albums_groups_tags=Albums, Groups and Tags",
synopsis = bind "upload_album_synopsis",
f:row {
f:static_text {
title = LOC "$$$/Ipernity/Dialog/albums/selected_albums=create a new album for this upload:",
font = "<system/bold>",
},
},
f:row {
f:edit_field {
value = bind "upload_album",
fill_horizontal = 1,
},
},
f:row {
f:static_text {
title = LOC "$$$/Ipernity/Dialog/albums/existing_albums=add photos to these existing albums:",
font = "<system/bold>",
},
},
f:row {
f:edit_field {
value = bind "upload_album_info",
fill_horizontal = 1,
height_in_lines = 3,
enabled = false,
},
},
f:row {
f:popup_menu {
title = LOC "$$$/Ipernity/Dialog/albums/available_albums=available albums",
value = bind 'selected_album',
items = bind "album_list",
width = 300,
},
f:push_button {
title = "+",
action = function ()
add_album (property_table)
end,
},
f:push_button {
title = "-",
action = function ()
remove_album (property_table)
end,
},
f:push_button {
title = LOC "$$$/Ipernity/Dialog/albums/clear_list=clear list",
action = function ()
clear_album_list (property_table)
end,
},
},
f:row {
f:separator {
fill_horizontal = 1,
},
},
f:row {
f:static_text {
title = LOC "$$$/Ipernity/Dialog/groups/groups=add photos to this groups:",
font = "<system/bold>",
},
},
f:row {
f:edit_field {
value = bind "upload_group_info",
fill_horizontal = 1,
height_in_lines = 3,
enabled = false,
},
},
f:row {
f:popup_menu {
title = LOC "$$$/Ipernity/Dialog/groups/available_groups=available groups",
value = bind 'selected_group',
items = bind "group_list",
width = 300,
},
f:push_button {
title = "+",
action = function ()
add_group (property_table)
end,
},
f:push_button {
title = "-",
action = function ()
remove_group (property_table)
end,
},
f:push_button {
title = LOC "$$$/Ipernity/Dialog/groups/clear_list=clear list",
action = function ()
clear_group_list (property_table)
end,
},
},
f:row {
f:separator {
fill_horizontal = 1,
},
},
f:row {
f:static_text {
title = LOC "$$$/Ipernity/Dialog/upload_tag/add_tags=Add tags:",
font = "<system/bold>",
alignment = 'left',
},
f:static_text {
title = LOC "$$$/Ipernity/Dialog/upload/info=Separate by comma, Tags will be combined with the exported keywords",
alignment = 'right',
fill_horizontal = 1,
size = 'mini',
},
},
f:row {
f:edit_field{
value = bind 'tags',
fill_horizontal = 1,
},
},
},
-- .............................................................................................
{
title = LOC "$$$/Ipernity/Dialog/auto_metadata=Advanced Upload-Settings",
synopsis = bind "advanced_upload_synopsis",
f:row {
f:static_text {
title = LOC "$$$/Ipernity/Dialog/albums/hint=add photos to albums:",
font = "<system/bold>",
},
},
f:row {
f:static_text {
title = LOC "$$$/Ipernity/Dialog/albums/add_public_album=add photos marked \"public\" to this album:",
fill_horizontal = 1,
},
f:popup_menu {
title = LOC "$$$/Ipernity/Dialog/albums/public_album=public album",
value = bind 'public_album',
items = bind "album_list",
width = 300,
},
},
f:row {
f:static_text {
title = LOC "$$$/Ipernity/Dialog/albums/add_public_album=add photos marked \"friends\" to this album:",
fill_horizontal = 1,
},
f:popup_menu {
title = LOC "$$$/Ipernity/Dialog/albums/public_album=friends album",
value = bind 'friends_album',
items = bind "album_list",
width = 300,
},
},
f:row {
f:static_text {
title = LOC "$$$/Ipernity/Dialog/albums/add_public_album=add photos marked \"family\" to this album:",
fill_horizontal = 1,
},
f:popup_menu {
title = LOC "$$$/Ipernity/Dialog/albums/public_album=family album",
value = bind 'family_album',
items = bind "album_list",
width = 300,
},
},
f:row {
f:static_text {
title = LOC "$$$/Ipernity/Dialog/albums/add_public_album=add photos marked \"private\" to this album:",
fill_horizontal = 1,
},
f:popup_menu {
title = LOC "$$$/Ipernity/Dialog/albums/private_album=private album",
value = bind 'private_album',
items = bind "album_list",
width = 300,
},
},
f:row {
f:separator {
fill_horizontal = 1,
},
},
f:row {
f:static_text {
title = LOC "$$$/Ipernity/Dialog/filter/hint=add photos based on keywords to albums, groups and tags:",
font = "<system/bold>",
},
},
f:row {
f:checkbox {
title = LOC "$$$/Ipernity/Dialog/albums/lightroom_album_filter=keyword-prefix",
value = bind 'lightroom_album_filter',
checked_value = true, unchecked_value = false,
},
f:edit_field{
value = bind 'album_filter',
width = 30,
},
f:static_text {
title = LOC "$$$/Ipernity/Dialog/albums/info3=Use lightrooms keyword for adding photos to albums automatically",
alignment = 'right',
fill_horizontal = 1,
size = 'mini',
},
},
f:row {
f:checkbox {
title = LOC "$$$/Ipernity/Dialog/groups/lightroom_group_filter=keyword-prefix",
value = bind 'lightroom_group_filter',
checked_value = true, unchecked_value = false,
},
f:edit_field{
value = bind 'group_filter',
width = 30,
},
f:static_text {
title = LOC "$$$/Ipernity/Dialog/groups/info3=Use lightrooms keyword for adding photos to groups automatically",
alignment = 'right',
fill_horizontal = 1,
size = 'mini',
},
},
f:row {
f:checkbox {
title = LOC "$$$/Ipernity/Dialog/upload_tag/lightroom_tags_filter=use keywords with prefix",
value = bind 'lightroom_tags_filter',
checked_value = true, unchecked_value = false,
},
f:edit_field{
value = bind 'tags_filter',
width = 30,
},
f:static_text {
title = LOC "$$$/Ipernity/Dialog/upload/info3=Use only matching keyword for tagging. Prefix will be not be part of the tag",
alignment = 'right',
fill_horizontal = 1,
size = 'mini',
},
},
f:row {
f:static_text {
title = LOC "$$$/Ipernity/Dialog/groups/info4=List of possible keywords:",
},
f:push_button {
title = LOC "$$$/Ipernity/Dialog/show=show",
action = function()
function_context.postAsyncTaskWithContext( 'Call Info File',
function( context )
local info_file = build_keyword_list (property_table)
local info_url = url_encode(info_file)
info_url = string.gsub(info_url,'%%2F','/')
info_url = string.gsub(info_url,'%%5C','/')
info_url = string.gsub(info_url,'%%2E','.')
info_url = string.gsub(info_url,'+','%%20')
info_url = "file://" .. info_url
local LrHttp = import 'LrHttp'
LrHttp.openUrlInBrowser (info_url)
end)
end,
enabled = bind "LR_canExport"
},
f:static_text {
title = bind "list_progress"
}
},
f:row {
f:separator {
fill_horizontal = 1,
},
},
f:row {
f:static_text {
title = LOC "$$$/Ipernity/Dialog/tags/hint=handling of lightroom keywords:",
font = "<system/bold>",
},
},
f:row {
f:checkbox {
title = LOC "$$$/Ipernity/Dialog/upload_tag/lightroom_tags=all keywords from lightroom",
value = bind 'lightroom_tags',
checked_value = true, unchecked_value = false,
},
f:static_text {
title = LOC "$$$/Ipernity/Dialog/upload/info2=use all exported keywords for tagging",
alignment = 'right',
fill_horizontal = 1,
size = 'mini',
},
},
f:row {
spacing = f:control_spacing(),
f:checkbox {
title = LOC "$$$/Ipernity/Dialog/auto_tag_desc/equipment_tags=Add tags for lense and camera-body",
value = bind 'auto_tag_equipment',
checked_value = true, unchecked_value = false,
},
f:checkbox {
title = LOC "$$$/Ipernity/Dialog/auto_tag_desc/add_settings_desc=Add exposure, focal length and ISO to the photo description",
value = bind 'auto_desc_settings',
checked_value = true, unchecked_value = false,
},
},
f:row {
f:checkbox {
title = LOC "$$$/Ipernity/Dialog/auto_tag_desc/date=Add a tag for the year",
value = bind 'auto_tag_date',
checked_value = true, unchecked_value = false,
},
},
f:row {
f:static_text {
title = LOC "$$$/Ipernity/Dialog/auto_tag_desc/info=These options will be applied to the uploaded photo only. They will not change the metadata in lightroom.",
alignment = 'right',
fill_horizontal = 1,
size = 'mini',
},
},
},
}
end