8 Commits

Author SHA1 Message Date
clemens 9191f0e16b line break for errors and not "," 2026-08-02 00:05:38 +09:00
clemens 8e2414f2fd Update README with install and run information update
tool is installed with uv tool and update run name
2026-02-28 23:56:44 +09:00
clemens ffedc9d9cf Add pypi test and live indexes 2026-02-23 22:50:48 +09:00
clemens 2e2e58a0df Add publish url and publish flow 2026-02-19 21:39:52 +09:00
clemens 34f5ce14bc hot fixes for moving package into main() 2026-02-08 12:47:26 +09:00
clemens d771da77e1 gitignore update 2026-02-08 12:31:33 +09:00
clemens d8cceac003 Remove cache files and uv.lock and add them all to ignore 2026-02-08 12:30:55 +09:00
clemens feda1cf85d Move to uv style project layout
run now with `uv run reverse-geolocate`
2026-02-08 12:29:03 +09:00
6 changed files with 1486 additions and 1396 deletions
+22 -1
View File
@@ -1 +1,22 @@
.venv/
# Python-generated files
__pycache__/
*.py[oc]
build/
dist/
wheels/
*.egg-info
# Virtual environments
.venv
# Pytest coverate
.coverage
# all .env files
.env
# uv lock files
uv.lock
# composer lock file
composer.lock
vendor/
+19 -21
View File
@@ -4,16 +4,12 @@ Reverse GeoLocate from XMP sidecar files with optional LightRoom DB read
This script will update any of the Country Code, Country, State, City and Location data that is missing in sidecard files. If a Lightroom DB is set, it will read any data from the database and fill in the fields before it tries to get the location name from google with the Latitude and Longitude found in either the XMP sidecar file or the LR database.
#### Installing and setting up
## Installing and setting up
The script uses the following external non defauly python libraries
* xmp toolkit
* requests
Everything is setup with uv, to install the tool itself
install both with the pip3 command
```
pip3 install requests
pip3 install python-xmp-toolkit
```sh
uv tool install reverse-geolocate
```
XMP Toolkit also needs the [Exempi Library](http://libopenraw.freedesktop.org/wiki/Exempi). This one can be install via brew or macports directly.
@@ -21,7 +17,8 @@ See more information for [Python XMP Tool kit](http://python-xmp-toolkit.readthe
## Command line arguments
reverse_geolocate.py [-h] -i
```sh
reverse-geolocate [-h] -i
[XMP SOURCE FOLDER [XMP SOURCE FOLDER ...]]
[-x [EXCLUDE XMP SOURCE FOLDER [EXCLUDE XMP SOURCE FOLDER ...]]]
[-l LIGHTROOM FOLDER] [-s]
@@ -29,6 +26,7 @@ reverse_geolocate.py [-h] -i
[-d [FUZZY DISTANCE]] [-g GOOGLE API KEY] [-o]
[-e EMIL ADDRESS] [-w] [-r] [-u] [-a] [-c] [-n]
[-v] [--debug] [--test]
```
### Arguments
@@ -53,26 +51,26 @@ Argument | Argument Value | Description
--debug | | Full detailed debug output. Will print out alot of data
--test | | Does not write any changed back to the XMP sidecar file. For testing purposes
The script will created a backup of the current sidecar file named <original name>.BK.xmp in the same location as the original file.
The script will created a backup of the current sidecar file named `<original name>.BK.xmp` in the same location as the original file.
If the Lightroom lookup is used without the --strict argument and several files with the same name are found, they will be skipped for usage.
#### Example
```
reverse_geolocate.py -i Photos/2017/01 -i Photos/2017/02 -l LightRoom/MyCatalogue -f overwrite -g <API KEY>
```sh
reverse-geolocate -i Photos/2017/01 -i Photos/2017/02 -l LightRoom/MyCatalogue -f overwrite -g <API KEY>
```
Will find all XMP sidecar files in both folders *Photos/2017/01* and *Photos/2017/02* and all folder below it. Uses the Lightroom database at *LightRoom/MyCatalogue*. The script will overwrite all data, even if it is already set
```
reverse_geolocate.py -i Photos/2017/01 -i Photos/2017/02 -x Photos/2017/02/Folder\ A -x Photos/2017/01/Folder\ B/some_file.xmp -l LightRoom/MyCatalogue
```sh
reverse-geolocate -i Photos/2017/01 -i Photos/2017/02 -x Photos/2017/02/Folder\ A -x Photos/2017/01/Folder\ B/some_file.xmp -l LightRoom/MyCatalogue
```
Will exlucde "Photos/2017/02/Folder A" from processing. For -x also a file (including the .xmp extension) can be given.
```
reverse_geolocate.py -i Photos/2017/01/Event-01/some_photo.xmp -f location
```sh
reverse-geolocate -i Photos/2017/01/Event-01/some_photo.xmp -f location
```
Only works on *some_photo.xmp* file and will only set the *location* field if it is not yet set.
@@ -81,7 +79,7 @@ Only works on *some_photo.xmp* file and will only set the *location* field if it
The Google Maps API key and the OpenStreetMap Email address can be written to a config file with the -w argument. The config file is located in $HOME/.config/reverseGeolocate/reverse_geolocate.cfg in the following format
```
```ini
[API]
googleapikey = <google api key>
openstreetmapemail = <email>
@@ -89,7 +87,7 @@ openstreetmapemail = <email>
if no -g or -e flag is given the keys are read from the config file. If the -g or -e parameter is given it will override the one found in the config file. A new parameter can be written to this config file with -w parameter.
### Cache lookups ###
### Cache lookups
If the same GPS coordinate is detected no other API maps call is done. With the fuzzy-distance argument this can be further extended to certain distances for each GPS coordinate from each other. The default value is 10m and can be overriden with an value to the argument.
@@ -130,7 +128,7 @@ order | type | target set
After the script is done the following overview will be printed
```
```txt
========================================
XMP Files found : 57
Updated : 3
@@ -146,7 +144,7 @@ More than one found in LR : 0
If there are problems with getting data from the Google Maps API the complete errior sting will be printed
```
```txt
...
---> Photos/2017/02/some_file.xmp: Error in request: OVER_QUERY_LIMIT You have exceeded your daily request quota for this API. We recommend registering for a key at the Google Developers Console: https://console.developers.google.com/apis/credentials?project=_
(!) Could not geo loaction data [FAILED]
@@ -155,7 +153,7 @@ If there are problems with getting data from the Google Maps API the complete er
Also the files that could not be updated will be printed at the end of the run under the stats list
```
```txt
...
----------------------------------------
Files that failed to update:
File diff suppressed because it is too large Load Diff
+34
View File
@@ -0,0 +1,34 @@
[project]
name = "reverse-geolocate"
version = "1.1.2.2"
description = "Reverse Geolocate from Lat/Long information and write location information into sidecard files"
readme = "README.md"
requires-python = ">=3.14"
dependencies = [
"python-xmp-toolkit>=2.1.0",
"requests>=2.32.0",
]
[project.scripts]
reverse-geolocate = "reverse_geolocate.reverse_geolocate:main"
# MARK: build system
[build-system]
requires = ["uv_build>=0.12.0,<0.13.0"]
build-backend = "uv_build"
# MARK: build target
[[tool.uv.index]]
name = "private-pypi"
url = "https://git.gullevek.org/api/packages/PyPI/pypi/simple/"
publish-url = "https://git.gullevek.org/api/packages/PyPI/pypi/"
[[tool.uv.index]]
name = "test-pypi"
url = "https://test.pypi.org/simple/"
publish-url = "https://test.pypi.org/legacy/"
[[tool.uv.index]]
name = "pypi"
url = "https://pypi.org/simple/"
publish-url = "https://pypi.org/legacy/"
# __END__
View File
File diff suppressed because it is too large Load Diff