New option to only list unset data
With the -u flag only XMP data that has unset or missing data will be listed
This commit is contained in:
@@ -27,7 +27,7 @@ reverse_geolocate.py [-h] -i
|
||||
[-l LIGHTROOM FOLDER] [-s]
|
||||
[-f <overwrite, location, city, state, country, countrycode>]
|
||||
[-g GOOGLE API KEY] [-o] [-e EMIL ADDRESS] [-w]
|
||||
[-r] [-a] [-c] [-n] [-v] [--debug] [--test]
|
||||
[-r] [-u] [-a] [-c] [-n] [-v] [--debug] [--test]
|
||||
|
||||
### Arguments
|
||||
|
||||
@@ -43,6 +43,7 @@ Argument | Argument Value | Description
|
||||
-e, --email | email address | For OpenStreetMap with a large number of access
|
||||
-g, --google | Google Maps API Key | If available, to avoid the access limitations to the reverse location lookup
|
||||
-r, --read-only | | Read only data from the XMP files and print them out. No LR DB connection is done or any map lookups
|
||||
-u, --unset-only | | Only list XMP files with missing data
|
||||
-a, --no-autoadjust | | Do not try to auto adjust column width to terminal column width
|
||||
-c, --compact | | Do extra compact view
|
||||
-w, --write-settings | | Write the Google API key or the OpenStreetMap email into the settings file
|
||||
|
||||
@@ -474,6 +474,13 @@ parser.add_argument('-r', '--read-only',
|
||||
help = 'Read current values from the XMP file only, do not read from LR or lookup any data and write back'
|
||||
)
|
||||
|
||||
# only list unset ones
|
||||
parser.add_argument('-u', '--unset-only',
|
||||
dest = 'unset_only',
|
||||
action = 'store_true',
|
||||
help = 'Only list unset XMP files'
|
||||
)
|
||||
|
||||
# don't try to do auto adjust in list view
|
||||
parser.add_argument('-a', '--no-autoadjust',
|
||||
dest = 'no_autoadjust',
|
||||
@@ -520,9 +527,12 @@ if not args.verbose:
|
||||
# init exclude source to list if not set
|
||||
if not args.exclude_sources:
|
||||
args.exclude_sources = []
|
||||
# init args unset (for list view) with 0 if unset
|
||||
# if not args.unset_only:
|
||||
# args.unset = 0
|
||||
|
||||
if args.debug:
|
||||
print("### ARGUMENT VARS: I: {incl}, X: {excl}, L: {lr}, F: {fc}, M: {osm}, G: {gp}, E: {em}, R: {read}, A: {adj}, C: {cmp}, N: {nbk}, W: {wrc}, V: {v}, D: {d}, T: {t}".format(
|
||||
print("### ARGUMENT VARS: I: {incl}, X: {excl}, L: {lr}, F: {fc}, M: {osm}, G: {gp}, E: {em}, R: {read}, U: {us}, A: {adj}, C: {cmp}, N: {nbk}, W: {wrc}, V: {v}, D: {d}, T: {t}".format(
|
||||
incl = args.xmp_sources,
|
||||
excl = args.exclude_sources,
|
||||
lr = args.lightroom_folder,
|
||||
@@ -531,6 +541,7 @@ if args.debug:
|
||||
gp = args.google_api_key,
|
||||
em = args.email,
|
||||
read = args.read_only,
|
||||
us = args.unset,
|
||||
adj = args.no_autoadjust,
|
||||
cmp = args.compact_view,
|
||||
nbk = args.no_xmp_backup,
|
||||
@@ -651,6 +662,7 @@ cur = ''
|
||||
# count variables
|
||||
count = {
|
||||
'all': 0,
|
||||
'listed': 0,
|
||||
'read': 0,
|
||||
'map': 0,
|
||||
'cache': 0,
|
||||
@@ -904,6 +916,8 @@ for xmp_file in work_files:
|
||||
if args.debug:
|
||||
print("### => XMP: {}:{} => {}".format(xmp_fields[xmp_field], xmp_field, data_set[xmp_field]))
|
||||
if args.read_only:
|
||||
# view only if list all or if data is unset
|
||||
if not args.unset_only or (args.unset_only and '' in data_set.values()):
|
||||
# for read only we print out the data formatted
|
||||
# headline check, do we need to print that
|
||||
count['read'] = printHeader(header_line.format(page_no = page_no, page_all = page_all), count['read'], header_repeat)
|
||||
@@ -919,6 +933,7 @@ for xmp_file in work_files:
|
||||
location = shortenString(data_set['Location'], width = format_length['location']),
|
||||
path = shortenPath(xmp_file, format_length['path'], path_only = True)
|
||||
))
|
||||
count['listed'] += 1
|
||||
else:
|
||||
# create a duplicate copy for later checking if something changed
|
||||
data_set_original = data_set.copy()
|
||||
@@ -1043,6 +1058,8 @@ if use_lightroom:
|
||||
# end stats only if we write
|
||||
print("{}".format('=' * 39))
|
||||
print("XMP Files found : {:9,}".format(count['all']))
|
||||
if args.read_only:
|
||||
print("XMP Files listed : {:9,}".format(count['listed']))
|
||||
if not args.read_only:
|
||||
print("Updated : {:9,}".format(count['changed']))
|
||||
print("Skipped : {:9,}".format(count['skipped']))
|
||||
|
||||
Reference in New Issue
Block a user