Utilities

Utility functions for Nicotine+ plugins

This module contains utility functions that can be used by Nicotine+ plugins. These functions are not specific to any plugin and can be used by any plugin.

Example

from npc.utils import startfile, reload_plugin

# Open a file
startfile("path/to/music.mp3")

# Reload a Plugin
reload_plugin("MyPlugin", "AnotherPlugin", handler)
npc.startfile(file)

Open a file with the platform’s default application

Parameters:

file (str) – Path to the file to be opened

npc.reload_plugin(name, plugin_id, handler)

Reload a plugin

Changed in version 0.4.1: Changed plugin_name to plugin_id as it is more accurate

Parameters:
Returns:

Whether the plugin was successfully reloaded

Return type:

bool