Plugin system and thanks #26
Replies: 3 comments
-
I have checked what is possible and many plugins can be created. You can edit the database with queries, modify files, and I've provided all the data I have. |
Beta Was this translation helpful? Give feedback.
-
I managed to create a custom scan function. |
Beta Was this translation helpful? Give feedback.
-
I updated the syntax of the plugins, now it's a real api based system. I made a simple plugin, that use the Fanart.tv cover for the movies, instead of the TMDB one's, so here's the plugin code: https://gist.github.com/Impre-visible/d4de6d666c8d2ebfae1d2619d1e7dfd9 |
Beta Was this translation helpful? Give feedback.
-
Hi Everyone
I hope everyone is fine. I've got the determination to work on a plugin system, and it actually works! I'm happy because I made it in no time. The plugin system works with events. When you create a plugin (I will explain it later), you link your code to events (
on_movie_play
,login_event
,new_library_event
, etc.). I provide you with data, and you can interact with that. One cool feature is that you can make your own integration forTPDB
or other cool services. You have an event when I add a movie to the database, and I provide you with everything: the name, the TMDb ID, the banner, and cover location, so you can simply edit that. I haven't looked at how to interact with the database for the moment, but I'm gonna work on that for a week or two and release it. If you have ideas for events, don't hesitate to write them to me, so I can add them.Create a plugin
Now, let's see how we can create a plugin. You simply have to go to the "plugins" folder in the default file path (or the provided one). When you are here, you create a folder with your plugin name. Don't care about the naming convention, but you can use snake_case; it seems the best. Once you've created the folder, create a
plugin.yaml
file. Here's a model one:As you can see, the file is in two parts. Firstly, the description of the plugin, and secondly, the events. Let's start by explaining the first part. All the data is not required. If you don't want to specify the
version
, no problem; there's a default value to prevent that. But if you don't set the value forfile
, it will bemain
by default.I think it's clear for the first part; let's talk about the second one, the events. As you can see, I link the event
on_movie_play
to the functionon_movie_function
, and as we can see in themain.py
file:I have a function named
on_movie_function
, and this function is called when a movie is played, and I provide you with the movie data. So, I'm gonna work on documentation for all the events (for the moment, 22).Thanks
I know I'm not giving a lot of news, and I'm sorry. I feel terrible, but I'm going to rework a lot on Chocolate. The plugin update will be the first of a long series. If you have any ideas, don't hesitate to post them in #7, so I can add them. I have a lot of ideas. We also talk on the discord, so feel free to join it.
Once again, thank you all for the support you've given to the project. Thanks to all the people who gave ideas, thanks to all the contributors, thanks to all the people who translated the project for free. I don't know how to thank you enough.
I'm gonna leave you now. I'm gonna post here for every event I add, every work I'm proud of, etc...
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions