Jellyfin Forum
Help for creating a plugin - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Development (https://forum.jellyfin.org/f-development)
+--- Forum: Plugin Development (https://forum.jellyfin.org/f-plugin-development)
+--- Thread: Help for creating a plugin (/t-help-for-creating-a-plugin)



Help for creating a plugin - Stoufiler - 2023-11-19

Good morning,

I'm trying to develop a plugin to wake up my server when a movie/series is started

The media libraries are connected via NFS. I would like to send a Wake On Lan when a movie is started.

However, trying the WebHook plugin which sends a webhook when a movie is started does not work when my file server is turned off.

I would like to know if it is possible to retrieve the information when a movie is requested even before opening the file on the remote server. So that I can wake up my server.

If possible could you help me develop this plugin?

I don't know C# but I want to get this plugin to work

THANKS !

My Repo : https://github.com/StephanGR/jellyfin-plugin-wol


RE: Help for creating a plugin - crobibero - 2023-11-19

I don’t think there is a way to trigger a webhook “before” playback starts, but you could try having your server wake up if a user is active?


RE: Help for creating a plugin - Stoufiler - 2023-11-19

Thanks for your reply

Could you explain me why there is no way to trigger something "before" playback ?

Server need to fetch data from file isnit ?

So if I listen to call made for fetching data, at this point, I can wake up my server

There is so much file in the repo of Server.
Could you tell me which class can I overload to handle what I want ?

It will be a big time saving


RE: Help for creating a plugin - Stoufiler - 2023-11-20

Hello,

If I understand correctly how works Jellyfin :

This file : https://github.com/jellyfin/jellyfin/blob/master/Jellyfin.Server.Implementations/Events/EventingServiceCollectionExtensions.cs implements all event services.

There is no IEventConsumer about File being accessed so I need to create an IEventConsumer about it and then I access to it with a custom plugin ?

is it good ?


RE: Help for creating a plugin - crobibero - 2023-11-20

You would need to set up the entire event pipeline, not just the consumer. I’m really not sure where you would add the hook, it would have to be somewhere before playback actually starts since playback will fail the first time.


RE: Help for creating a plugin - Stoufiler - 2023-11-20

When the server on which my films are hosted is turned off and I start a video from the WEB, the Jellyfin logs tell me that a transcoding is starting, I could base myself on this and start my server by wake on lan with a bash script

However there are no logs even if I put DBG in the config file, I have no log which tells me that the server will look for the files.
I'm using Infuse to watch films

I've only this :
[2023-11-20 15:02:32.026 +00:00] [DBG] AuthenticationScheme: "CustomAuthentication" was successfully authenticated.
[2023-11-20 15:02:32.026 +00:00] [DBG] AuthenticationScheme: "CustomAuthentication" was successfully authenticated.
[2023-11-20 15:03:05.007 +00:00] [DBG] AuthenticationScheme: "CustomAuthentication" was successfully authenticated.
[2023-11-20 15:03:05.007 +00:00] [DBG] AuthenticationScheme: "CustomAuthentication" was successfully authenticated.