174 lines
5.8 KiB
Plaintext
174 lines
5.8 KiB
Plaintext
# SOME DESCRIPTIVE TITLE.
|
|
# Copyright (C) 2022, The Funkwhale Collective
|
|
# This file is distributed under the same license as the funkwhale package.
|
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
#
|
|
#, fuzzy
|
|
msgid ""
|
|
msgstr ""
|
|
"Project-Id-Version: funkwhale 1.2.7\n"
|
|
"Report-Msgid-Bugs-To: \n"
|
|
"POT-Creation-Date: 2022-07-23 12:18+0200\n"
|
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
"MIME-Version: 1.0\n"
|
|
"Content-Type: text/plain; charset=UTF-8\n"
|
|
"Content-Transfer-Encoding: 8bit\n"
|
|
|
|
#: ../../developers/plugins.rst:2
|
|
msgid "Funkwhale plugins"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:4
|
|
msgid "Starting with Funkwhale 1.0, it is now possible to implement new features via plugins."
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:7
|
|
msgid "Some plugins are maintained by the Funkwhale team (e.g. this is the case of the ``scrobbler`` plugin), or by third-parties."
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:11
|
|
msgid "Installing a plugin"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:13
|
|
msgid "To install a plugin, ensure its directory is present in the ``FUNKWHALE_PLUGINS_PATH`` directory."
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:15
|
|
msgid "Then, add its name to the ``FUNKWHALE_PLUGINS`` environment variable, like this::"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:19
|
|
msgid "We provide a command to make it easy to install third-party plugins::"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:25
|
|
msgid "If you use the command, you will still need to append the plugin name to ``FUNKWHALE_PLUGINS``"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:29
|
|
msgid "Types of plugins"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:31
|
|
msgid "There are two types of plugins:"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:33
|
|
msgid "Plugins that are accessible to end-users, a.k.a. user-level plugins. This is the case of our Scrobbler plugin"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:34
|
|
msgid "Pod-level plugins that are configured by pod admins and are not tied to a particular user"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:36
|
|
msgid "Additionally, user-level plugins can be regular plugins or source plugins. A source plugin provides a way to import files from a third-party service, e.g via webdav, FTP or something similar."
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:40
|
|
msgid "Hooks and filters"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:42
|
|
msgid "Funkwhale includes two kind of entrypoints for plugins to use: hooks and filters. B"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:44
|
|
msgid "Hooks should be used when you want to react to some change. For instance, the ``LISTENING_CREATED`` hook notify each registered callback that a listening was created. Our ``scrobbler`` plugin has a callback registered to this hook, so that it can notify Last.fm properly:"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:57
|
|
msgid "Filters work slightly differently, and expect callbacks to return a value that will be used by Funkwhale."
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:59
|
|
msgid "For instance, the ``PLUGINS_DEPENDENCIES`` filter can be used as a way to install additional dependencies needed by your plugin:"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:72
|
|
msgid "To sum it up, hooks are used when you need to react to something, and filters when you need to alter something."
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:75
|
|
msgid "Writing a plugin"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:77
|
|
msgid "Regardless of the type of plugin you want to write, lots of concepts are similar."
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:79
|
|
msgid "First, a plugin need three files:"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:81
|
|
msgid "a ``__init__.py`` file, since it's a Python package"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:82
|
|
msgid "a ``funkwhale_startup.py`` file, that is loaded during Funkwhale initialization"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:83
|
|
msgid "a ``funkwhale_ready.py`` file, that is loaded when Funkwhale is configured and ready"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:85
|
|
msgid "So your plugin directory should look like this::"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:92
|
|
msgid "Now, let's write our plugin!"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:94
|
|
msgid "``funkwhale_startup.py`` is where you declare your plugin and it's configuration options:"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:114
|
|
msgid "Now that our plugin is declared and configured, let's implement actual functionality in ``funkwhale_ready.py``:"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:149
|
|
msgid "And that's pretty much it. Now, login, visit https://yourpod.domain/settings/plugins, set a value in the ``greeting`` field and enable the plugin."
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:151
|
|
msgid "After that, you should be greeted properly if you go to https://yourpod.domain/greeting."
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:154
|
|
msgid "Hooks reference"
|
|
msgstr ""
|
|
|
|
#: ../../docstring of config.plugins.LISTENING_CREATED:1
|
|
msgid "Called when a track is being listened"
|
|
msgstr ""
|
|
|
|
#: ../../developers/plugins.rst:159
|
|
msgid "Filters reference"
|
|
msgstr ""
|
|
|
|
#: ../../docstring of config.plugins.PLUGINS_DEPENDENCIES:1
|
|
msgid "Called with an empty list, use this filter to append pip dependencies to the list for installation."
|
|
msgstr ""
|
|
|
|
#: ../../docstring of config.plugins.PLUGINS_APPS:1
|
|
msgid "Called with an empty list, use this filter to append apps to INSTALLED_APPS"
|
|
msgstr ""
|
|
|
|
#: ../../docstring of config.plugins.MIDDLEWARES_BEFORE:1
|
|
msgid "Called with an empty list, use this filter to prepend middlewares to MIDDLEWARE"
|
|
msgstr ""
|
|
|
|
#: ../../docstring of config.plugins.MIDDLEWARES_AFTER:1
|
|
msgid "Called with an empty list, use this filter to append middlewares to MIDDLEWARE"
|
|
msgstr ""
|
|
|
|
#: ../../docstring of config.plugins.URLS:1
|
|
msgid "Called with an empty list, use this filter to register new urls and views"
|
|
msgstr ""
|