2014-03-02 22:01:07 +00:00
|
|
|
git-annex's [[metadata]] works best when files have a lot of useful
|
|
|
|
metadata attached to them.
|
|
|
|
|
|
|
|
To make git-annex automatically set the year and month when adding files,
|
2016-02-28 15:10:55 +00:00
|
|
|
run: `git config annex.genmetadata true`
|
|
|
|
|
|
|
|
## git commit hook
|
2014-03-02 22:01:07 +00:00
|
|
|
|
|
|
|
A git commit hook can be set up to extract lots of metadata from files
|
2016-02-28 15:10:55 +00:00
|
|
|
like photos, mp3s, etc. Whenever annexed files are committed, their
|
|
|
|
metadata will be extracted and stored.
|
|
|
|
|
|
|
|
Download [[pre-commit-annex]] and install it in your git-annex repository
|
|
|
|
as `.git/hooks/pre-commit-annex`
|
|
|
|
Remember to make the script executable! `chmod +x .git/hooks/pre-commit-annex`
|
|
|
|
|
|
|
|
### using extract
|
2014-03-02 22:01:07 +00:00
|
|
|
|
2016-02-28 15:10:55 +00:00
|
|
|
The git commit hook can use extract to get metadata.
|
2014-03-02 22:01:07 +00:00
|
|
|
|
2016-02-28 15:10:55 +00:00
|
|
|
Install it from <http://www.gnu.org/software/libextractor/>
|
|
|
|
`apt-get install extract`
|
|
|
|
|
|
|
|
Configure which metadata fields to ask extract for: `git config metadata.extract "artist album title camera_make video_dimensions"`
|
2014-03-02 22:01:07 +00:00
|
|
|
|
2014-04-01 04:21:58 +00:00
|
|
|
To get a list of all possible fields, run: `extract -L | sed 's/ /_/g'`
|
2014-03-02 22:01:07 +00:00
|
|
|
|
2016-02-28 15:10:55 +00:00
|
|
|
### using exiftool
|
|
|
|
|
|
|
|
The git commit hook can also use exiftool to get metadata.
|
|
|
|
|
|
|
|
Install it from <http://owl.phy.queensu.ca/~phil/exiftool/>
|
|
|
|
`apt-get install libimage-exiftool-perl`
|
|
|
|
|
|
|
|
Configure which metadata fields to ask exiftool for: `git config metadata.exiftool "Model ImageSize FocusRange GPSAltitude GPSCoordinates"`
|
|
|
|
|
|
|
|
To get a list of all possible fields, run: `exiftool -list`
|
|
|
|
|
|
|
|
### using both extract and exiftool
|
|
|
|
|
|
|
|
If you want some metadata that extract knows about, and other metadata
|
|
|
|
that exiftool knows about, just install them both, and set both
|
|
|
|
`metadata.extract` and `metadata.exiftool`.
|
|
|
|
|
|
|
|
### overwriting existing metadata
|
|
|
|
|
2014-03-02 22:01:07 +00:00
|
|
|
By default, if a git-annex already has a metadata field for a file,
|
|
|
|
its value will not be overwritten with metadata taken from files.
|
|
|
|
To allow overwriting, run: `git config metadata.overwrite true`
|