diff --git a/picard/extension_points/cover_art_providers.py b/picard/extension_points/cover_art_providers.py new file mode 100644 index 000000000..5ea0e611e --- /dev/null +++ b/picard/extension_points/cover_art_providers.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +# +# Picard, the next-generation MusicBrainz tagger +# +# Copyright (C) 2014-2015, 2018-2021, 2023-2024 Laurent Monin +# Copyright (C) 2015 Rahul Raturi +# Copyright (C) 2016 Ville Skyttä +# Copyright (C) 2016 Wieland Hoffmann +# Copyright (C) 2017 Sambhav Kothari +# Copyright (C) 2019-2021 Philipp Wolfer +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +from picard.extension_points.options_pages import register_options_page +from picard.plugin import ExtensionPoint + + +ext_point_cover_art_providers = ExtensionPoint(label='cover_art_providers') + + +def register_cover_art_provider(provider): + ext_point_cover_art_providers.register(provider.__module__, provider) + if hasattr(provider, 'OPTIONS') and provider.OPTIONS: + if not hasattr(provider.OPTIONS, 'NAME'): + provider.OPTIONS.NAME = provider.name.lower().replace(' ', '_') + if not hasattr(provider.OPTIONS, 'TITLE'): + provider.OPTIONS.TITLE = provider.title + register_options_page(provider.OPTIONS) diff --git a/picard/extension_points/formats.py b/picard/extension_points/formats.py new file mode 100644 index 000000000..97e8aa6fc --- /dev/null +++ b/picard/extension_points/formats.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +# +# Picard, the next-generation MusicBrainz tagger +# +# Copyright (C) 2006-2008, 2012 Lukáš Lalinský +# Copyright (C) 2008 Will +# Copyright (C) 2010, 2014, 2018-2020, 2023 Philipp Wolfer +# Copyright (C) 2013 Michael Wiencek +# Copyright (C) 2013, 2017-2024 Laurent Monin +# Copyright (C) 2016-2018 Sambhav Kothari +# Copyright (C) 2017 Sophist-UK +# Copyright (C) 2017 Ville Skyttä +# Copyright (C) 2020 Gabriel Ferreira +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +from picard.plugin import ExtensionPoint + + +ext_point_formats = ExtensionPoint(label='formats') +formats_extensions = {} + + +def register_format(file_format): + ext_point_formats.register(file_format.__module__, file_format) + for ext in file_format.EXTENSIONS: + formats_extensions[ext[1:]] = file_format diff --git a/picard/extension_points/item_actions.py b/picard/extension_points/item_actions.py new file mode 100644 index 000000000..977d8e71a --- /dev/null +++ b/picard/extension_points/item_actions.py @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- +# +# Picard, the next-generation MusicBrainz tagger +# +# Copyright (C) 2006-2008, 2011-2012 Lukáš Lalinský +# Copyright (C) 2007 Robert Kaye +# Copyright (C) 2008 Gary van der Merwe +# Copyright (C) 2008 Hendrik van Antwerpen +# Copyright (C) 2008-2011, 2014-2015, 2018-2024 Philipp Wolfer +# Copyright (C) 2009 Carlin Mangar +# Copyright (C) 2009 Nikolai Prokoschenko +# Copyright (C) 2011 Tim Blechmann +# Copyright (C) 2011-2012 Chad Wilson +# Copyright (C) 2011-2013 Michael Wiencek +# Copyright (C) 2012 Your Name +# Copyright (C) 2012-2013 Wieland Hoffmann +# Copyright (C) 2013-2014, 2016, 2018-2024 Laurent Monin +# Copyright (C) 2013-2014, 2017, 2020 Sophist-UK +# Copyright (C) 2016 Rahul Raturi +# Copyright (C) 2016 Simon Legner +# Copyright (C) 2016 Suhas +# Copyright (C) 2016-2017 Sambhav Kothari +# Copyright (C) 2018 Vishal Choudhary +# Copyright (C) 2020-2021 Gabriel Ferreira +# Copyright (C) 2021 Bob Swift +# Copyright (C) 2021 Louis Sautier +# Copyright (C) 2021 Petit Minion +# Copyright (C) 2023 certuna +# Copyright (C) 2024 Suryansh Shakya +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +from PyQt6 import ( + QtCore, + QtGui, +) + +from picard.plugin import ExtensionPoint + + +class BaseAction(QtGui.QAction): + NAME = "Unknown" + MENU = [] + + def __init__(self): + super().__init__(self.NAME, None) + self.tagger = QtCore.QCoreApplication.instance() + self.triggered.connect(self.__callback) + + def __callback(self): + objs = self.tagger.window.selected_objects + self.callback(objs) + + def callback(self, objs): + raise NotImplementedError + + +ext_point_album_actions = ExtensionPoint(label='album_actions') +ext_point_cluster_actions = ExtensionPoint(label='cluster_actions') +ext_point_clusterlist_actions = ExtensionPoint(label='clusterlist_actions') +ext_point_file_actions = ExtensionPoint(label='file_actions') +ext_point_track_actions = ExtensionPoint(label='track_actions') + + +def register_album_action(action): + ext_point_album_actions.register(action.__module__, action) + + +def register_cluster_action(action): + ext_point_cluster_actions.register(action.__module__, action) + + +def register_clusterlist_action(action): + ext_point_clusterlist_actions.register(action.__module__, action) + + +def register_file_action(action): + ext_point_file_actions.register(action.__module__, action) + + +def register_track_action(action): + ext_point_track_actions.register(action.__module__, action) diff --git a/picard/extension_points/options_pages.py b/picard/extension_points/options_pages.py new file mode 100644 index 000000000..f1231c0a2 --- /dev/null +++ b/picard/extension_points/options_pages.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# +# Picard, the next-generation MusicBrainz tagger +# +# Copyright (C) 2006-2007 Lukáš Lalinský +# Copyright (C) 2009 Nikolai Prokoschenko +# Copyright (C) 2009, 2019-2022 Philipp Wolfer +# Copyright (C) 2013, 2015, 2018-2024 Laurent Monin +# Copyright (C) 2016-2017 Sambhav Kothari +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +from picard.plugin import ExtensionPoint + + +ext_point_options_pages = ExtensionPoint(label='options_pages') + + +def register_options_page(page_class): + ext_point_options_pages.register(page_class.__module__, page_class) diff --git a/picard/extension_points/ui_init.py b/picard/extension_points/ui_init.py new file mode 100644 index 000000000..ae0d89ce2 --- /dev/null +++ b/picard/extension_points/ui_init.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# +# Picard, the next-generation MusicBrainz tagger +# +# Copyright (C) 2006-2008, 2011-2012, 2014 Lukáš Lalinský +# Copyright (C) 2007 Nikolai Prokoschenko +# Copyright (C) 2008 Gary van der Merwe +# Copyright (C) 2008 Robert Kaye +# Copyright (C) 2008 Will +# Copyright (C) 2008-2010, 2015, 2018-2023 Philipp Wolfer +# Copyright (C) 2009 Carlin Mangar +# Copyright (C) 2009 David Hilton +# Copyright (C) 2011-2012 Chad Wilson +# Copyright (C) 2011-2013, 2015-2017 Wieland Hoffmann +# Copyright (C) 2011-2014 Michael Wiencek +# Copyright (C) 2013-2014, 2017 Sophist-UK +# Copyright (C) 2013-2024 Laurent Monin +# Copyright (C) 2015 Ohm Patel +# Copyright (C) 2015 samithaj +# Copyright (C) 2016 Rahul Raturi +# Copyright (C) 2016 Simon Legner +# Copyright (C) 2016-2017 Sambhav Kothari +# Copyright (C) 2017 Antonio Larrosa +# Copyright (C) 2017 Frederik “Freso” S. Olesen +# Copyright (C) 2018 Kartik Ohri +# Copyright (C) 2018 Vishal Choudhary +# Copyright (C) 2018 virusMac +# Copyright (C) 2018, 2021-2023 Bob Swift +# Copyright (C) 2019 Timur Enikeev +# Copyright (C) 2020-2021 Gabriel Ferreira +# Copyright (C) 2021 Petit Minion +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +from picard.plugin import ExtensionPoint + + +ext_point_ui_init = ExtensionPoint(label='ui_init') + + +def register_ui_init(function): + ext_point_ui_init.register(function.__module__, function) +