]> git.draconx.ca Git - picard-plugins.git/blob - no-remote-plugins.py
tweak-filename-filter: Update for picard 2.3.1
[picard-plugins.git] / no-remote-plugins.py
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright © 2018-2020 Nick Bowler
4 #
5 # License GPLv3+: GNU General Public License version 3 or any later version.
6 # This is free software: you are free to change and redistribute it.
7 # There is NO WARRANTY, to the extent permitted by law.
8
9 PLUGIN_NAME = u"No remote plugins"
10 PLUGIN_AUTHOR = u"Nick Bowler"
11 PLUGIN_DESCRIPTION = u'''<p>This plugin disables querying the MusicBrainz
12 server for plugins.  This avoids network activity at startup and prevents
13 the options dialog from suggesting non-free plugins for installation.</p>
14 '''
15 PLUGIN_VERSION = "2"
16 PLUGIN_API_VERSIONS = ["1.0", "2.0"]
17 PLUGIN_LICENSE = "GPL-3.0-or-later"
18
19 from picard import (config, log, plugin)
20
21 try:
22     from picard.pluginmanager import PluginManager
23 except ImportError:
24     PluginManager = plugin.PluginManager
25
26 try:
27     from PyQt5 import QtCore
28 except (RuntimeError, ImportError):
29     from PyQt4 import QtCore
30
31 import types
32
33 def modulename():
34     return modulename.__module__[len("picard.plugins."):]
35
36 def repl_query(self, callback=None):
37     pass
38
39 tagger = QtCore.QObject.tagger
40 def install_hooks():
41     tagger.pluginmanager.query_available_plugins = \
42         types.MethodType(repl_query, PluginManager)
43     log.info("%s activated" % (modulename()))
44
45 if modulename() in config.setting["enabled_plugins"]:
46     install_hooks()
47 else:
48     log.debug("%s disabled in configuration" % (modulename()))