start - Frankanator8/openmusic GitHub Wiki
Getting Started with Plugins
Thanks for wanting to create a plugin for OpenMusic. Here, you'll see all you need to get started!
1. Create a folder and put two files in it - "declarations.txt" and "client.py"
openmusic_api
2. Install pip install openmusic_api
This will grant you access to OpenMusicClient
3. Write declarations.txt
declarations.txt has a set format. Make sure to follow this(it follows the current version of the API, 0.1). Do not include anything in [comment brackets], and replace anything in (parentheses) with your own project stuff.
0.1 [API version number]
(plugin name)
(plugin author)
(plugin's own version NOT api version)
(plugin image url, must be relative)
(y/n) [does the plugin modify OpenMusic's behavior?]
(y/n) [does the plugin modify OpenMusic's look/is there a .qss file?]
(dependencies) [python package dependencies, separated by spaces]
** 4. Implement OpenMusicClient
In client.py
, write the following:
from openmusic_api.opapi import OpenMusicClient
class MyClient(OpenMusicClient):
def __init__(self, **kwargs):
super().__init__(**kwargs)
With this, you have a functional plugin. However, read on to see how to make it somewhat functional!
** 5. Implement timer_update
and on_launch
on_launch
is called after everything has been loaded. You should use this to modify GUI elements.
timer_update
is called every 50ms. If your plugin needs to be constantly updated, use this function.
** 6. Understard **kwargs
in __init__
**kwargs is a dictionary containing everything in OpenMusic. Here is the result it will give you:
{
"app": app,
"os_player": osPlayer,
"main_gui": mainGui,
"classes": {
"Playlist": Playlist,
"OSPlayer": OSPlayer,
"MainGui": MainGui,
"GlobalUpdater": GlobalUpdater,
"RightMenu": RightMenu,
"LeftMenu": LeftMenu,
"PlaylistMenu": PlaylistMenu,
"SongMenu": SongMenu,
"PlaylistEditor": PlaylistEditor,
"SongEditor": SongEditor,
"CenterScrollArea": CenterScrollArea,
"FullPlaylistDisplay": FullPlaylistDisplay,
"PlaylistBlock": PlaylistBlock,
"SongBlock": SongBlock
},
"statics": {
"FileHandler": FileHandler,
"Songs": Songs
}
}
To understand this more, use the wiki