Compare commits
9 Commits
0.3.1
...
628088918b
Author | SHA1 | Date | |
---|---|---|---|
628088918b | |||
e0e7dbd0e5 | |||
c9620394de | |||
67db75ece8 | |||
6cab491721 | |||
905ac497e1 | |||
07ca626ca8 | |||
2f94211507 | |||
0998371ad6 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@ testsource
|
||||
testdest
|
||||
__pycache__
|
||||
Pipfile.lock
|
||||
.vscode
|
||||
|
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.3.2] - 2020-04-11
|
||||
|
||||
### Added
|
||||
- Added additional Exif and ITPC data fields for radiation comment.
|
||||
|
||||
## [0.3.1] - 2020-04-03
|
||||
|
||||
### Added
|
||||
|
@@ -7,11 +7,11 @@ Here are some important resources:
|
||||
|
||||
* This [Blogpost](https://www.commander1024.de/wordpress/2020/03/fotos-mit-daten-zu-radioaktiver-strahlung-taggen) tells you about intention and scope for this tool (in German).
|
||||
* For questions and suggestions, you can [E-Mail](mailto:commander@commander1024.de) me directly.
|
||||
* Bugs? [Gitlab](https://gitlab.warpzone.ms/Commander1024/radiation-tagger/issues) is where to report them.
|
||||
* Bugs? [Gitlab](https://git.commander1024.de/Commander1024/radiation-tager/issues) is where to report them.
|
||||
|
||||
## Submitting changes
|
||||
|
||||
Please send a [GitLab Pull Request to radiation_tagger](https://gitlab.warpzone.ms/Commander1024/radiation-tagger/tree/develop) in the develop branch with a clear list of what you've done (read more about [pull requests](http://help.github.com/pull-requests/)). Please follow our coding conventions (below) and make sure all of your commits are atomic (one feature per commit).
|
||||
Please send a [Pull Request to radiation_tagger](https://git.commander1024.de/Commander1024/radiation-tager/pulls) in the develop branch with a clear list of what you've done (read more about [pull requests](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request)). Please follow our coding conventions (below) and make sure all of your commits are atomic (one feature per commit).
|
||||
Keep in mind that I am a bloody beginner and probably make more mistakes than you, so I am always open for improvements.
|
||||
|
||||
Always write a clear log message for your commits. One-line messages are fine for small changes, but bigger changes should look like this:
|
||||
|
5
Pipfile
5
Pipfile
@@ -4,11 +4,12 @@ url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
|
||||
[dev-packages]
|
||||
pylint = "*"
|
||||
|
||||
[packages]
|
||||
pytz = "*"
|
||||
gpxpy = "*"
|
||||
py3exiv2 = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "3.7"
|
||||
# [requires]
|
||||
# python_version = "3.8"
|
||||
|
@@ -8,7 +8,7 @@ It can parse a .his (CSV) file from a [GeigerLog](https://sourceforge.net/projec
|
||||
|
||||
It can optionally read a gpx-file, compare the timestamps to 'DateTimeOriginal' and determine closest-matching latitude / longitude / altitude. Timestamps in GPX files are ususally stored in UTC timezone, you can set --timezone to match the local timezone, your camera / geiger counter ran at.
|
||||
|
||||
It then creates a `UserComment` with the actual measured radiation at the time the photo has been taken and writes the geocoordinates into the appropiate Exif tags.
|
||||
It then creates some Exif/ITPC/XMP Comment/Description tags with the actual measured radiation at the time the photo has been taken and writes the geocoordinates into the appropiate Exif tags.
|
||||
|
||||
## Dependencies
|
||||
Right now it depends on the following non-core Python 3 libraries. These can be installed using the package manager of your distribution.
|
||||
@@ -56,7 +56,7 @@ usage: rad_tag.py [-h] [-si SIFACTOR] [-tz Timezone] [-d] [-g GPX] [-o OUTDIR]
|
||||
CSV Photo [Photo ...]
|
||||
|
||||
A unix-tyle tool that extracts GPS and/or radiation data from GPX/CSV files
|
||||
and writes them into the Exif tags of given photos.
|
||||
and writes them into the Exif/ITPC/XMP tags of given photos.
|
||||
|
||||
positional arguments:
|
||||
CSV Geiger counter history file in CSV format.
|
||||
|
17
functions.py
17
functions.py
@@ -11,12 +11,12 @@ import pyexiv2
|
||||
|
||||
class Radiation:
|
||||
'''
|
||||
Reiceives values vom CSV file and creates a list of the relevant data
|
||||
Receives values vom CSV file and creates a list of the relevant data
|
||||
|
||||
Arguments:
|
||||
timestamp: Date/time string from CSV as string
|
||||
radiation: Radiation from CSV in CP/M as float
|
||||
local_timezone: timezone for timezone-unware CSV / Photo, if GPX is timezone aware
|
||||
local_timezone: timezone for timezone-unaware CSV / Photo, if GPX is timezone aware
|
||||
si_factor: CP/M to (µS/h) conversion factor - specific to GMC-tube
|
||||
|
||||
Returns:
|
||||
@@ -48,9 +48,9 @@ class Photo:
|
||||
|
||||
Arguments:
|
||||
photo: source photo ()
|
||||
local_timezone: timezone for timezone-unware CSV / Photo, if GPX is timezone aware
|
||||
local_timezone: timezone for timezone-unaware CSV / Photo, if GPX is timezone aware
|
||||
dest_dir: destination directory where the photo is going to be copied to.
|
||||
dry_run: whether to acutally write (True / False)
|
||||
dry_run: whether to actually write (True / False)
|
||||
|
||||
Returns:
|
||||
get_date: timestamp of photo als datetime object
|
||||
@@ -171,7 +171,7 @@ class Match:
|
||||
|
||||
class Exif:
|
||||
'''
|
||||
Converts, compiles and writes Exif-Tags from given arguemnts.
|
||||
Converts, compiles and writes Exif/ITPC/XMP-Tags from given arguments.
|
||||
|
||||
Arguments:
|
||||
photo: file name of photo to modify
|
||||
@@ -179,7 +179,7 @@ class Exif:
|
||||
latitude: latitude as float
|
||||
longitude: longitude as float
|
||||
elevation: elevation as float
|
||||
dry_run: whether to acutally write (True / False)
|
||||
dry_run: whether to actually write (True / False)
|
||||
|
||||
Returns:
|
||||
Latitude / Longitude: in degrees
|
||||
@@ -243,7 +243,11 @@ class Exif:
|
||||
if radiation:
|
||||
# Set new UserComment
|
||||
new_comment = 'Radiation ☢ : %s µS/h' % str(round(radiation, 2))
|
||||
|
||||
metadata['Exif.Photo.UserComment'] = new_comment
|
||||
metadata['Exif.Image.ImageDescription'] = new_comment
|
||||
metadata['Iptc.Application2.Caption'] = [new_comment]
|
||||
metadata['Xmp.dc.description'] = new_comment
|
||||
else:
|
||||
new_comment = None
|
||||
|
||||
@@ -294,4 +298,3 @@ class Output:
|
||||
|
||||
# Return data string
|
||||
return data
|
||||
|
||||
|
@@ -2,9 +2,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
''' Iterates over a bunch of .jpg or .cr2 files and matches
|
||||
DateTimeOriginal from Exif tag to DateTime in a csv log
|
||||
of a GeigerMuellerCounter and writes its value to the UserComment
|
||||
Exif tag in µS/h '''
|
||||
DateTimeOriginal from Exif tags to DateTime in a csv log
|
||||
of a GeigerMuellerCounter and writes its value to Exif/ITPC/XMP tags in µS/h '''
|
||||
|
||||
import csv
|
||||
import argparse
|
||||
@@ -25,7 +24,7 @@ from functions import Radiation, Photo, Match, Exif, Output
|
||||
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
description='''A unix-tyle tool that
|
||||
extracts GPS and/or radiation data from GPX/CSV files and writes
|
||||
them into the Exif tags of given photos.''')
|
||||
them into the Exif/ITPC/XMP tags of given photos.''')
|
||||
parser.add_argument('-si', '--sifactor', type=float, default=0.0065,
|
||||
help='Factor to multiply recorded CPM with.')
|
||||
parser.add_argument('-tz', '--timezone', type=str, metavar='Timezone', default='utc',
|
||||
|
Reference in New Issue
Block a user