Feature Request: Run script when media is added or scan more often.
Zero0Q opened this issue · 33 comments
Changing the schedule to run on a cron is in the roadmap. I just need to figure out how to run it on both so people who don't want to use it can still use the simple 00:00 format.
Cool, Thanks
Is it possible to run script every 15or30mins or is that going to be later included?
a cron job can run as often as you like. So once that is included then you would be able to run it every minute if you wanted, though I wouldn't recommend it.
It depends on how often you are adding media.
Do you know when you will be adding cron job
Not sure.
I have just added a webhook to run on recently added media that you can test if you like.
You need to have tautulli for this to work. I can send instructions if you're interested?
I don’t have Tautulli I jus wait until it gets released.
I have tautulli and would be interested in testing the webhook
I installed tautulli, could you share that script to test if its possible
I installed tautulli, could you share that script to test if its possible
Instructions are here: https://github.com/jkirkcaldy/plex-utills/wiki/Run-Poster-script-on-recently-added-media
@jkirkcaldy Will this only run the poster script or does it run all scripts? I'm interested triggering the Hide 4K script to run right after new 4K content is added.
Edit: Nevermind, I looked through the source and saw the /webhook POST route is doing a posters update. I modified the tautulli webook to send a GET request (no data) triggered by recently added to the /hide4k route.
Edit2: That doesn't seem to have worked :/
Webhook works as expected, thank you :)
I've added the hide4k script to the webhook so it will run both scripts, first the poster script and then the hide4k script afterwards.
I'll look into setting up custom payloads to the webhooks so you can decide which script to run when sending the webhook.
The dev container tag is ready for testing.
You can now use time formatting (HH:MM) or a cron format for setting the schedules.
For the webhooks, you can now use the tautulli webhook but as this will only run if the film is a new library item this isn't ideal. In my use case 1080p files often get added before 4k versions and in this case the webhook wouldn't be triggered.
If you use Radarr you can now set a webhook to trigger the poster script on a successful import.
This will trigger the webhook on a new file being added and if a file is upgraded.
If you use Radarr you can now set a webhook to trigger the poster script on a successful import
Is this also only in the dev version?
yes
yes
Looking forward to the next stable release then.
I should also note that there is a slight change to the webhook json data for the tautulli webhook. It now needs to look like this:
{
"server":"Tautulli",
"title":"{title}"
}
I stopped using tautulli because it was crashing my plex server, radarr actually works much better now.
I Have question with scanning, I installed dev ver and now when i click to scan 4k movies posters it actually scans everything in Movies folder, not just 4k movies. Before in latest ver it would only scan 4k movies, did i miss out something in settings?
Hey I just found a bug with docker image jkirkcaldy/plex-utills:dev. I wanted to test the hide4k script with the webhook. I set up a Tautulli webhook for recently added media and updated json data as you instructed. I have the 4K posters script disabled. The webhook was triggered successfully and processed by Plex-Utills, but it added a 4k banner to my poster. This shouldn't have happened since 4K posters are disabled in my config.
I Have question with scanning, I installed dev ver and now when i click to scan 4k movies posters it actually scans everything in Movies folder, not just 4k movies. Before in latest ver it would only scan 4k movies, did i miss out something in settings?
The script should scan all files if you have the audio or HDR banners enabled as you can get 1080p files with these enabled.
Hey I just found a bug with docker image jkirkcaldy/plex-utills:dev. I wanted to test the hide4k script with the webhook. I set up a Tautulli webhook for recently added media and updated json data as you instructed. I have the 4K posters script disabled. The webhook was triggered successfully and processed by Plex-Utills, but it added a 4k banner to my poster. This shouldn't have happened since 4K posters are disabled in my config.
Ok, I'll have a look and see why the banners are running when they should be disabled.
I Have question with scanning, I installed dev ver and now when i click to scan 4k movies posters it actually scans everything in Movies folder, not just 4k movies. Before in latest ver it would only scan 4k movies, did i miss out something in settings?
The script should scan all files if you have the audio or HDR banners enabled as you can get 1080p files with these enabled.
I didn't enable hdr or audio only 4k global and 4k poster movies and still it doing it.
Ok I'll have a look and make sure it only scans if they are enabled.
Ok I'll have a look and make sure it only scans if they are enabled.
Thanks, I disabled scan at the moment, 10k movies would take forever to scan 🙂
I have installed latest ver and while scanning library im geting this error msg: HTTPConnectionPool(host='192.168.1.8', port=32400): Read timed out. (read timeout=30)
Edit: Ignore this error, it was webhook from Radarr that was enabled I disabled it now it’s all good🙂
Edit 2: Issue is back again if Plex is scanning library, if I disabled scanning in Plex then it works.
I'm updating the script at the moment to store the films in a database so it should make the whole process much more efficient.
Sounds awesome, is it going to be in dev or latest?
it will be in dev for a little bit. But it's not ready yet. Just doing some internal testing
All good, it’s better to be tested than rushed.
it will be in dev for a little bit. But it's not ready yet. Just doing some internal testing
just wondering if it’s possible to test new dev script?
new dev script is out now.
If adds films to a database, so in theory, if it gets stuck on a film, getting to that point again should be much quicker as it will only re-scan your file if the file size changes.
There is also now an option to skip the media info scan all together, this will mean you can't use the audio posters and the HDR posters will only be available in HDR and dolby vision variants but for people having issues with accessing files, it should be a lifesaver.
As this post was originally for adding a cron job and that is done now (will come in next month's update) I'm going to close this. Feel free to open a new issue when testing the dev script.