-
Notifications
You must be signed in to change notification settings - Fork 15
Move Metadata Support to Pluginspace #467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
d66107d
NEW: move metadata support to plugin space
jcjgraf 9de230d
Add convenience functions to determine metadata support
jcjgraf 6f3d885
Fix missing renames from ExifHandler to MetadataHandler
jcjgraf 9fb1155
Remove get_raw_md, cleanup and docstrings
jcjgraf 26cf2b6
Improve metadata handler by operations.
jcjgraf 50cb581
Rename `imutils.exif` to `imutils.metadata`
jcjgraf f0740e5
Refactor registry to make client subclass MetadataPlugin
jcjgraf 824fe8e
Fix various mypy and linter issues
jcjgraf f2af1de
Fix pyexiv2 plugin to conform to refactoring
jcjgraf 23c8fd1
Refactor MetadataPlugin to be an abstract class
jcjgraf 2bd2ded
Improve: lazy import backend packages
jcjgraf e2e9c4a
Add display of metadata plugin status to version
jcjgraf 446f4bd
Fix conftest for metadata redesign and test version
jcjgraf b610237
Make piexif / pyexiv2 lazy imports optional
karlch 2d98a51
Temporarily shorten metadata (integration) test
karlch fd6f951
Remove metadata-related version unit tests
karlch 6bc1742
Fix end2end test markers: exif -> metadata
karlch 65fcb20
Add plugins_loaded signal to api.signals
karlch 56c88df
Remove metadata information from --version
karlch 8a93af6
Tests: rewrite metadata markers
karlch 53e12e7
Update metadatawidget end2end test
karlch 99d29ad
Fix bug in piexif's copy_metadata implementation
karlch 01fa41d
Add metadata wrapper plugin
karlch 1555d20
Extend metadata integration test and markers
karlch a0fcb6b
Fix lint / mypy
karlch 4448981
Fix typo: iff -> if
karlch 0aa4f8b
Change name/version property of MetadataPlugin to static method
jcjgraf b3206b8
Cleanup of supression of exception which is never raised
jcjgraf 03fc90f
Import full `abc` for consistency reason
jcjgraf 5507de9
Cleanup overcomplicated expression
jcjgraf 1132667
Make all MetadataHandle methods raise exceptions
jcjgraf 409c804
Change metadat_pyexiv to require full keys
jcjgraf 89dd893
Assert earlier if piexif is available
jcjgraf aa6a80a
Make widget displaying images in the requested order
jcjgraf 37d9809
Update docs to reflect metadata to plugin space transition
jcjgraf 7b3e2ee
Fix piexif data not displayed in widget
jcjgraf 1820813
Cleaup obsolete comments
jcjgraf a22982f
Remove broken link
jcjgraf fb66610
Ensure backward compatibility but allow overwriting
jcjgraf 9266928
Tests: Auto-register metadata backend markers
karlch db95c4b
Fix typos
karlch 1cbba4a
Refactor (metadata) plugin loading
karlch c3c1654
Improve subsection titles
jcjgraf 2040326
Add note about default loading behaviour
jcjgraf b9fb5dd
Fix wrong url pointing to invalid exif page
jcjgraf 1062817
Add url to metadata docs for missing metadata deps warning
jcjgraf 2d16f89
Add link to gexiv2 user metadata plugin
jcjgraf ebfd9d6
Add note about enabling of multiple plugins
jcjgraf 816dc32
Update changelog to reflect this PR
jcjgraf bff129b
Docs: minor wording changes
karlch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
Metadata | ||
======== | ||
|
||
Vimiv provides optional metadata support. If enabled, then: | ||
|
||
#. The ``:metadata`` command and the corresponding ``i``-keybinding is available. It | ||
displays the metadata of the current image. | ||
#. The ``{exif-date-time}`` statusbar module is available. It displays the Exif | ||
creation time of the current image. | ||
#. Metadata is automatically copied from source to destination when writing images to | ||
disk. | ||
|
||
Vimiv provides full flexibility to users in terms of what metadata backend to use. | ||
Each backend comes with their advantages and disadvantages, and each user has different | ||
requirements, as well as different package support. Therefore, vimiv provides metadata | ||
backends as independent plugins, that can be loaded as one desires. In addition, users | ||
have the ability to extend vimiv's metadata capabilities using | ||
:ref:`custom plugins<Plugins>`, as described in | ||
:ref:`a later section<create_own_plugins>`. | ||
|
||
Vimiv comes with two default plugins: | ||
|
||
* ``metadata_piexif`` is based on `piexif`_ | ||
* ``metadata_pyexiv2`` is based on `pyexiv2`_ | ||
|
||
In addition, there are the following user metadata plugins available: | ||
|
||
.. _user_metadata_plugins: | ||
|
||
.. table:: Overview of user plugins | ||
:widths: 20 80 | ||
|
||
===================================================================== =========== | ||
Name Description | ||
===================================================================== =========== | ||
`metadata_gexiv2 <https://github.com/jcjgraf/vimiv_metadata-gexiv2>`_ Based on `gexiv2 <https://gitlab.gnome.org/GNOME/gexiv2>`_ | ||
===================================================================== =========== | ||
|
||
|
||
Enable Support | ||
-------------- | ||
|
||
Metadata plugins are loaded as any other vimiv plugin. To enable one of the default | ||
plugins, simply list its name in the ``PLUGINS`` section of the configuration file. In | ||
addition, you need to ensure that the required backend is installed on your system. | ||
|
||
To enable a user metadata plugin, first you need to download it, and put it into the | ||
plugin folder. Afterwards loading is equivalent to the default plugins. | ||
|
||
For more information on how to load plugins, please refer to the | ||
:ref:`plugin section<Plugins>`. | ||
|
||
If no metadata plugin is specified, vimiv will load one of the two default plugins, if | ||
the respective backend is installed. To disable this default behaviour, specify | ||
``metadata = none`` in the ``PLUGINS`` section. | ||
|
||
.. warning:: | ||
|
||
Default loading may be dropped in a future version. If you rely on metadata support, | ||
we recommend to explicitly specify what backend you want. | ||
|
||
.. note:: | ||
Multiple metadata plugins can be registered at the same time. If they use distinct | ||
keys, the value of both is combined in the output of ``:metadata``. | ||
|
||
|
||
Comparison of Different Plugins | ||
------------------------------- | ||
|
||
In short, ``metadata_pyexiv2`` is much more powerful than ``metadata_piexif``, though | ||
the dependencies are also more involved to install. | ||
|
||
.. table:: Comparison of the two libraries | ||
:widths: 20 15 20 45 | ||
|
||
======================= =================== ==================== ===================================================================== | ||
PROPERTY ``metadata_piexif`` ``metadata_pyexiv2`` Note | ||
======================= =================== ==================== ===================================================================== | ||
Backend `piexif`_ `pyexiv2`_ | ||
Exif Support True True pyexiv2 can potentially extract more data for the same image | ||
ICMP Support False True | ||
XMP Suppport False True | ||
Output Formatting False True e.g. ``FNumber: 63/10`` vs ``FNumber: F6.3`` | ||
Supported File Types JPEG, TIFF Many common types | ||
Ease of installation Simple More complicated pyexiv2 requires some dependencies including the C++ library `exiv2`_ | ||
======================= =================== ==================== ===================================================================== | ||
|
||
We recommend to use ``metadata_pyexiv2`` if the installation of `pyexiv2`_ is not too | ||
involved on your system and ``metadata_piexif`` as a fallback solution or in case you | ||
don't need the full power of `pyexiv2`_ and prefer something more lightweight. | ||
Also consider the list of available | ||
:ref:`user metadata plugins<user_metadata_plugins>`. | ||
|
||
|
||
Customize Keysets | ||
----------------- | ||
|
||
You can configure the information displayed by the ``:metadata`` command by adding your | ||
own key sets to the ``METADATA`` section in your configfile like this:: | ||
|
||
keys2 = someKey,anotherOne,lastOne | ||
keys4 = newKey,oneMore | ||
|
||
where the values must be a comma-separated list of valid metadata keys. | ||
|
||
In case you are using `pyexiv2`_, you can find a complete overview of valid keys on the | ||
`exiv2 webpage <https://www.exiv2.org/metadata.html>`_. You can choose any of the Exif, | ||
IPTC, or XMP keys. | ||
|
||
`Piexif`_ uses a simplified form of the key. It does not use the ``Group.Subgroup`` | ||
prefix, which is present in each of `pyexiv2`_'s keys. However, ``metadata_piexif`` | ||
automatically does this truncation, if the provided keys are in the long form. | ||
|
||
The ``:metadata-list-keys`` command provides a list of all valid metadata keys, that | ||
the currently loaded metadata plugins can read. This serves as an easy way to see what | ||
keys are available in the image. | ||
|
||
|
||
.. _create_own_plugins: | ||
|
||
Create Own Plugins | ||
------------------ | ||
|
||
One can extend vimiv's metadata capabilities by creating own metadata plugins. This is | ||
useful if you want to use a different metadata backend. | ||
|
||
The rough steps are the following: | ||
|
||
#. Create a plugin, that implements the abstract class | ||
``vimiv.imutils.metadata.MetadataPlugin`` | ||
|
||
#. Implement all required methods | ||
|
||
#. Optionally, also implement the non-required methods | ||
|
||
#. In the plugin's init function, register the plugin using | ||
``vimiv.imutils.metadata.register`` | ||
|
||
Please see the default metadata plugins for an example implementation. | ||
|
||
|
||
.. _exiv2: https://www.exiv2.org/index.html | ||
.. _pyexiv2: https://python3-exiv2.readthedocs.io | ||
.. _piexif: https://pypi.org/project/piexif/ |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@exif | ||
@metadata | ||
Feature: Metadata widget displaying image exif information | ||
|
||
Scenario: Show metadata widget | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.