Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Add custom command on action #95

Open
bonswouar opened this issue Nov 12, 2024 · 8 comments
Open

[Feature request] Add custom command on action #95

bonswouar opened this issue Nov 12, 2024 · 8 comments

Comments

@bonswouar
Copy link

bonswouar commented Nov 12, 2024

It could be quite useful to be able to configure a custom command (or a custom call to an URL?) when an action is done, i.e when a movie is deleted, or added/removed from Leaving Soon (but not sure the second part is totally possible as I don't think Janitorr keeps track of diffs?)

My use case would be to call a webhook (with the file/directory as parameter) on Autopulse, to have an efficient synchronization of Jellyfin's library (I believe because of symlinks it doesn't work that well for Leaving Soon on my instance by default)

@bonswouar
Copy link
Author

Also for more use cases, it could also be triggered for failed actions, end of main loop, etc, with some Type as a param to differentiate them.
(I was thinking for example to trigger a notification when "Can't delete movie" happens)

@Schaka
Copy link
Owner

Schaka commented Nov 12, 2024

image

Would this be different from Radarr/Sonarr Webhooks?
I don't think it's in the scope of Janitorr to provide something like it.

It's definitely technically possible (on delete or failure to delete), but it's too close to existing functionality in the arrs and I'm trying to keep dependencies to a minimum. I was already pretty wary of adding Bazarr.

You're right that there's no info regarding the Leaving Soon collection, except when adding something.

@bonswouar
Copy link
Author

bonswouar commented Nov 12, 2024

@Schaka For sake of simplicity and dependency-free, I was thinking just a command, then the user can do whatever he wants with it!
That's what Bazarr has done:
image

Imo it should cover most useful use cases, and could be quite easy to implement. What do you think?

(I understand you don't want to duplicate functionalities, but none of the *arrs is aware of the Leaving Soon directory, so that's not really duplication :))

=> Now that I think about it, I'm not sure Janitorr's current container has access to most Linux commands though..

@Schaka
Copy link
Owner

Schaka commented Nov 12, 2024

You're correct. The container doesn't have access to random shell commands. It might be something that's possible to add, but if I were to add anything, I'd likely make it a generalized POST.

I'll keep this ticket open, but don't hold your breath. Janitorr is roughly where I want it to be and I've moved most of my development efforts over to Naviseerr.

@bonswouar
Copy link
Author

bonswouar commented Nov 12, 2024

I'd likely make it a generalized POST.

I still think that's a bit "risky", as using a custom command could potentially cover way more use cases (for example I'm not even sure Janitorr accept POST, while ntfy does. And not every use case might go thru an API, some might need local commands at some point)

I could propose a PR at some point if you don't mind
But yeah no worry, there's no emergency, Janitorr is already pretty good as it is!

@Schaka
Copy link
Owner

Schaka commented Nov 12, 2024

Feel free to submit a PR that would solve this. You would likely:

  • need to find a way to install custom dependencies into the Buildpack provided image
  • or build and supply your own base image, compatible with x86 and aarch64 for buildpack to use instead
  • create a new map of CustomActionType (enum) => "custom action" property under JellyfinProperties
  • call that custom action on of type x whenever an a certain use case is hit (like deleted media, failed to delete media, added leaving soon)

@Schaka
Copy link
Owner

Schaka commented Dec 12, 2024

Is there any way a webhook would solve this issue for you?
I'd happily (given the time) add some optional webhooks for a few actions within Janitorr.

@bonswouar
Copy link
Author

bonswouar commented Dec 12, 2024

@Schaka A webhook would be perfect!
FYI for Autopulse's use case, no payload content is needed, only the URL is used with a file/directory path as GET parameters, as per the doc:

$ curl -u 'admin:password' 'http://localhost:2875/triggers/manual?path=/path/to/file&hash=1234567890' 
# or
$ curl -H 'Authorization: Basic <base_64_encoded_login>' 'http://localhost:2875/triggers/manual?path=/path/to/file&hash=1234567890'

But for a more general approach, ideally a webhook with a list of parameters that can be used in the URL, in a JSON payload, and as headers, would probably cover most needs.
I would certainly use it to add ntfy notifications also :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants