From 5e63040f35c971a515c2c29e5ef117cff488f5fb Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Tue, 24 Sep 2024 08:48:46 +0200 Subject: [PATCH] PICARD-1861: Adapt plugins to extension point API changes --- picard/plugin3/api.py | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/picard/plugin3/api.py b/picard/plugin3/api.py index e94f63818e..d13342110c 100644 --- a/picard/plugin3/api.py +++ b/picard/plugin3/api.py @@ -27,7 +27,6 @@ Type, ) -from picard.album import register_album_post_removal_processor from picard.config import ( Config, ConfigSection, @@ -37,6 +36,13 @@ from picard.extension_points.cover_art_providers import ( register_cover_art_provider, ) +from picard.extension_points.event_hooks import ( + register_album_post_removal_processor, + register_file_post_addition_to_track_processor, + register_file_post_load_processor, + register_file_post_removal_from_track_processor, + register_file_post_save_processor, +) from picard.extension_points.formats import register_format from picard.extension_points.item_actions import ( BaseAction, @@ -46,21 +52,14 @@ register_file_action, register_track_action, ) -from picard.extension_points.options_pages import register_options_page -from picard.extension_points.script_functions import register_script_function -from picard.file import ( - File, - register_file_post_addition_to_track_processor, - register_file_post_load_processor, - register_file_post_removal_from_track_processor, - register_file_post_save_processor, -) -from picard.metadata import ( +from picard.extension_points.metadata import ( register_album_metadata_processor, register_track_metadata_processor, ) +from picard.extension_points.options_pages import register_options_page +from picard.extension_points.script_functions import register_script_function +from picard.file import File from picard.plugin3.manifest import PluginManifest -from picard.plugin import PluginPriority from picard.webservice import WebService from picard.webservice.api_helpers import MBAPIHelper @@ -98,26 +97,26 @@ def plugin_config(self) -> ConfigSection: return self._api_config # Metadata processors - def register_album_metadata_processor(function: Callable, priority: PluginPriority = PluginPriority.NORMAL) -> None: + def register_album_metadata_processor(function: Callable, priority: int = 0) -> None: return register_album_metadata_processor(function, priority) - def register_track_metadata_processor(function: Callable, priority: PluginPriority = PluginPriority.NORMAL) -> None: + def register_track_metadata_processor(function: Callable, priority: int = 0) -> None: return register_track_metadata_processor(function, priority) # Event hooks - def register_album_post_removal_processor(function: Callable, priority: PluginPriority = PluginPriority.NORMAL) -> None: + def register_album_post_removal_processor(function: Callable, priority: int = 0) -> None: return register_album_post_removal_processor(function, priority) - def register_file_post_load_processor(function: Callable, priority: PluginPriority = PluginPriority.NORMAL) -> None: + def register_file_post_load_processor(function: Callable, priority: int = 0) -> None: return register_file_post_load_processor(function, priority) - def register_file_post_addition_to_track_processor(function: Callable, priority: PluginPriority = PluginPriority.NORMAL) -> None: + def register_file_post_addition_to_track_processor(function: Callable, priority: int = 0) -> None: return register_file_post_addition_to_track_processor(function, priority) - def register_file_post_removal_from_track_processor(function: Callable, priority: PluginPriority = PluginPriority.NORMAL) -> None: + def register_file_post_removal_from_track_processor(function: Callable, priority: int = 0) -> None: return register_file_post_removal_from_track_processor(function, priority) - def register_file_post_save_processor(function: Callable, priority: PluginPriority = PluginPriority.NORMAL) -> None: + def register_file_post_save_processor(function: Callable, priority: int = 0) -> None: return register_file_post_save_processor(function, priority) # Cover art