Move to uv project type
This commit is contained in:
@@ -16,7 +16,7 @@ See more information for [Python XMP Tool kit](http://python-xmp-toolkit.readthe
|
|||||||
## Command line arguments
|
## Command line arguments
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
uv run bin/reverse_geolocate.py [-h] -i
|
uv run reverse-geolocate [-h] -i
|
||||||
[XMP SOURCE FOLDER [XMP SOURCE FOLDER ...]]
|
[XMP SOURCE FOLDER [XMP SOURCE FOLDER ...]]
|
||||||
[-x [EXCLUDE XMP SOURCE FOLDER [EXCLUDE XMP SOURCE FOLDER ...]]]
|
[-x [EXCLUDE XMP SOURCE FOLDER [EXCLUDE XMP SOURCE FOLDER ...]]]
|
||||||
[-l LIGHTROOM FOLDER] [-s]
|
[-l LIGHTROOM FOLDER] [-s]
|
||||||
@@ -29,7 +29,7 @@ uv run bin/reverse_geolocate.py [-h] -i
|
|||||||
to run it from a differnt path
|
to run it from a differnt path
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
uv run --project <path to project> run <path to project>/reverse-geolocate.py <arguments ...>
|
uv run --project <path to project> reverse-geolocate <arguments ...>
|
||||||
```
|
```
|
||||||
|
|
||||||
### Arguments
|
### Arguments
|
||||||
@@ -62,19 +62,19 @@ If the Lightroom lookup is used without the --strict argument and several files
|
|||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
reverse_geolocate.py -i Photos/2017/01 -i Photos/2017/02 -l LightRoom/MyCatalogue -f overwrite -g <API KEY>
|
uv run 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
|
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
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
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
|
uv run 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.
|
Will exlucde "Photos/2017/02/Folder A" from processing. For -x also a file (including the .xmp extension) can be given.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
reverse_geolocate.py -i Photos/2017/01/Event-01/some_photo.xmp -f location
|
uv run 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.
|
Only works on *some_photo.xmp* file and will only set the *location* field if it is not yet set.
|
||||||
|
|||||||
@@ -9,6 +9,14 @@ dependencies = [
|
|||||||
"requests>=2.32.5",
|
"requests>=2.32.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
reverse-geolocate = "reverse_geolocate.reverse_geolocate:main"
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["uv_build>=0.9.7,<0.10.0"]
|
||||||
|
build-backend = "uv_build"
|
||||||
|
|
||||||
|
|
||||||
# MARK: Python linting
|
# MARK: Python linting
|
||||||
[tool.pyright]
|
[tool.pyright]
|
||||||
typeCheckingMode = "strict"
|
typeCheckingMode = "strict"
|
||||||
|
|||||||
@@ -29,15 +29,15 @@ from math import ceil
|
|||||||
from libxmp import XMPMeta, consts
|
from libxmp import XMPMeta, consts
|
||||||
|
|
||||||
# user modules below
|
# user modules below
|
||||||
from utils.long_lat import (
|
from reverse_geolocate.utils.long_lat import (
|
||||||
convert_dms_to_lat,
|
convert_dms_to_lat,
|
||||||
convert_dms_to_long,
|
convert_dms_to_long,
|
||||||
convert_lat_to_dms,
|
convert_lat_to_dms,
|
||||||
convert_long_to_dms,
|
convert_long_to_dms,
|
||||||
get_distance,
|
get_distance,
|
||||||
)
|
)
|
||||||
from utils.reverse_geolocate import reverse_geolocate
|
from reverse_geolocate.utils.reverse_geolocate import reverse_geolocate
|
||||||
from utils.string_helpers import string_len_cjk, shorten_string, format_len
|
from reverse_geolocate.utils.string_helpers import string_len_cjk, shorten_string, format_len
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# FUNCTIONS
|
# FUNCTIONS
|
||||||
@@ -1357,6 +1357,7 @@ def main():
|
|||||||
# MAIN RUN
|
# MAIN RUN
|
||||||
##############################################################
|
##############################################################
|
||||||
|
|
||||||
main()
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|
||||||
# __END__
|
# __END__
|
||||||
@@ -61,7 +61,7 @@ def convert_long_to_dms(lat_long: float) -> str:
|
|||||||
return convert_lat_long_to_dms(lat_long, is_longitude=True)
|
return convert_lat_long_to_dms(lat_long, is_longitude=True)
|
||||||
|
|
||||||
|
|
||||||
def long_lat_reg(longitude: str, latitude: str) -> dict[str, float] :
|
def long_lat_reg(longitude: str, latitude: str) -> dict[str, float]:
|
||||||
"""
|
"""
|
||||||
converts the XMP/EXIF formatted GPS Long/Lat coordinates
|
converts the XMP/EXIF formatted GPS Long/Lat coordinates
|
||||||
from the <Degree>,<Minute.Second><NSEW> to the normal float
|
from the <Degree>,<Minute.Second><NSEW> to the normal float
|
||||||
@@ -77,7 +77,7 @@ def long_lat_reg(longitude: str, latitude: str) -> dict[str, float] :
|
|||||||
# regex
|
# regex
|
||||||
latlong_re = re.compile(r"^(\d+),(\d+\.\d+)([NESW]{1})$")
|
latlong_re = re.compile(r"^(\d+),(\d+\.\d+)([NESW]{1})$")
|
||||||
# dict for loop
|
# dict for loop
|
||||||
lat_long = {"longitude": longitude, "latitude": latitude}
|
lat_long: dict[str, str | float] = {"longitude": longitude, "latitude": latitude}
|
||||||
# for element in lat_long:
|
# for element in lat_long:
|
||||||
for index, element in lat_long.items():
|
for index, element in lat_long.items():
|
||||||
# match if it is exif GPS format
|
# match if it is exif GPS format
|
||||||
@@ -4,8 +4,8 @@ reverse geolacte functions
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
import requests
|
import requests
|
||||||
from utils.long_lat import long_lat_reg
|
from reverse_geolocate.utils.long_lat import long_lat_reg
|
||||||
from utils.string_helpers import only_latin_chars
|
from reverse_geolocate.utils.string_helpers import only_latin_chars
|
||||||
|
|
||||||
|
|
||||||
def reverse_geolocate(longitude, latitude, map_type, args):
|
def reverse_geolocate(longitude, latitude, map_type, args):
|
||||||
@@ -84,7 +84,7 @@ wheels = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "reverse-geolocate"
|
name = "reverse-geolocate"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = { virtual = "." }
|
source = { editable = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "python-xmp-toolkit" },
|
{ name = "python-xmp-toolkit" },
|
||||||
{ name = "requests" },
|
{ name = "requests" },
|
||||||
|
|||||||
Reference in New Issue
Block a user