diff --git a/vimiv/plugins/__init__.py b/vimiv/plugins/__init__.py index f462038e6..b932ccf9c 100644 --- a/vimiv/plugins/__init__.py +++ b/vimiv/plugins/__init__.py @@ -98,6 +98,10 @@ def load() -> None: user_plugins = _get_plugins(_user_plugin_directory) _logger.debug("Available user plugins: %s", quotedjoin(user_plugins)) for plugin, info in _plugins.items(): + if plugin == "metadata": + # Skip metadata plugin and load it manually after all other plugins. This way the plugin can check whether another metadata plugin has been loaded + _logger.debug("Deffer loading of metadata plugin") + continue if plugin in app_plugins: _load_plugin(plugin, info, _app_plugin_directory) elif plugin in user_plugins: @@ -113,6 +117,7 @@ def load() -> None: quotedjoin(user_plugins), _user_plugin_directory, ) + _load_plugin("metadata", _plugins["metadata"], _app_plugin_directory) _logger.debug("Plugin loading completed") api.signals.plugins_loaded.emit() diff --git a/vimiv/plugins/metadata.py b/vimiv/plugins/metadata.py index d7149904b..039ea80de 100644 --- a/vimiv/plugins/metadata.py +++ b/vimiv/plugins/metadata.py @@ -10,12 +10,20 @@ from vimiv.plugins import metadata_piexif, metadata_pyexiv2 from vimiv.utils import log +from vimiv.imutils import metadata _logger = log.module_logger(__name__) def init(*_args: Any, **_kwargs: Any) -> None: - """Initialize metadata plugin depending on available backend.""" + """Initialize metadata plugin depending on available backend. + + If any other backend has already been registered, do not register any new one. + """ + if metadata.has_metadata_support(): + _logger.info("Not loading a default metadata backend, as one has been loaded manually") + return + if metadata_pyexiv2.pyexiv2 is not None: metadata_pyexiv2.init() elif metadata_piexif.piexif is not None: