RatingPosterDB / rpdb-folders

Monitors Media Folders and Adds Images with Ratings (poster.jpg / background.jpg) from the RPDB API
GNU Lesser General Public License v2.1
23 stars 2 forks source link

Feature Request: Web Hook Triggers for poster generation #35

Closed edrock200 closed 2 years ago

edrock200 commented 2 years ago

No issues. LOVE your app, thanks for making it and constantly improving it. Very very cool. Also sorry if this is the wrong place for a feature request.

One feature request which I think would be of value for those that have Media on Network attached storage and use the sideload docker app - webhook triggers to initiate targetted scans of folders. In Sonarr/Radarr, the connect feature has a webhook output. So as new media is downloaded it can send a trigger to rpdb to prob that one specific folder.

If this is considered for implementation, I would respectfully and humbly ask that the trigger have a configurable delay. e.g. when webhook trigger received, wait 10m before acting. The reason being many of us use a staging area for downloads with things such as mergerfs, so when sonarr/radarr think something is downloaded, it may be another 5-15m before it actually is copied to the SAN if that makes sense.

Appreciate your consideration and thanks again for this awesome tool!

jaruba commented 2 years ago

Thank you for the kind words, I'm ok with doing this, I see the advantage and someone else requested it before too.

The problem I see is that Sonarr / Radarr give absolute paths to where the new media is downloaded, this path might (most probably) not coincide with RPDB Folder's Docker container of where the media will be.

edrock200 commented 2 years ago

Yeah I get that. That's the beauty of the docker container. You can map whatever paths you want in container to host. But for non docker applications you could have a search and replace path rewrite config option.

Drapersniper commented 2 years ago

Make an API call to https://localhost:7878/api/v3/movie, to get all movie objects in the Radarr library. This can be simplified if the webhook listen to specific updates as Arr's should dispatch the Entry Id, in that case we can query the API directly. API call will return a list of objects containing the following sections:

    "path": "string",
    "movieFile": {},

image image

Filter out all movies which hasFile is False

with the above "path" we can then make an API call to https://localhost:7878/api/v3/rootfolder to get the root folder for the library, and then replace it out for RPDB's root folder.

p.s hooking up to Arrs this way should also eliminate the need for the initial library scan (assuming all the content is managed by an Arr instance and the files are scanned at import time.)

edrock200 commented 2 years ago

Thanks for the tip! My hope was more that I can add a connect webhook to radarr/sonarr on media add that sends the hook to rpdb, triggering rpdb to do a targeted scan of that folder and generate posters.

Drapersniper commented 2 years ago

Thanks for the tip! My hope was more that I can add a connect webhook to radarr/sonarr on media add that sends the hook to rpdb, triggering rpdb to do a targeted scan of that folder and generate posters.

Hi yeah sorry my reply was to @jaruba, on the implementation side of things. I would really like to see a targeted folder scan on RPDB folder as well as a dispatch to plex(or Emby/Jellyfin/etc) to perform a targeted refresh of the metadata, I would be more than happy to PR this but my js is not great so just considering a manual python scrip to do this.

jaruba commented 2 years ago

@Drapersniper thanks for the details

@edrock200 i'll start work on the webhooks for sonarr / radarr soon

edrock200 commented 2 years ago

Thank you both @Drapersniper and @jaruba ! I wish I was smart enough to code this stuff lol.

jaruba commented 2 years ago

@edrock200 I have added Radarr / Sonarr webhooks, they will be available in the next release.

@Drapersniper I did not use your method because I currently only implemented webhooks, and I can't know what the Radarr / Sonarr URLs are for more advanced API usage. (as some users might not run it locally or on the default port)

You also mentioned:

I would really like to see a targeted folder scan on RPDB folder

I believe this is already supported!

To scan a specific media folder:

To scan a specific movie / series folder:

as well as a dispatch to plex(or Emby/Jellyfin/etc) to perform a targeted refresh of the metadata

I'd like to interact with the Plex / Emby / Jellyfin APIs directly also.. This will most probably be implemented in the future.

edrock200 commented 2 years ago

@edrock200 I have added Radarr / Sonarr webhooks, they will be available in the next release.

@Drapersniper I did not use your method because I currently only implemented webhooks, and I can't know what the Radarr / Sonarr URLs are for more advanced API usage. (as some users might not run it locally or on the default port)

You also mentioned:

I would really like to see a targeted folder scan on RPDB folder

I believe this is already supported!

To scan a specific media folder:

  • press "Edit Media Folder" in the main menu
  • select your media folder from the list
  • press "Run Full Scan of Folder" or "Force Overwrite Scan of Folder"

To scan a specific movie / series folder:

  • go to "Edit Movie Poster" or "Edit Series Poster"
  • choose your movie / series
  • press "Update Ratings"

as well as a dispatch to plex(or Emby/Jellyfin/etc) to perform a targeted refresh of the metadata

I'd like to interact with the Plex / Emby / Jellyfin APIs directly also.. This will most probably be implemented in the future.

Thanks! Can't wait for the next release! By targetted scan, I meant more in a programatic way, but it sounds like your webhook will do the trick! Thanks again.

jaruba commented 2 years ago

By targetted scan, I meant more in a programatic way

@edrock200 You can already do that too, check out the --remote= command line arg: https://github.com/RatingPosterDB/rpdb-folders/wiki/Command-Line-Arguments

andrewmcd7 commented 2 years ago

@edrock200 I have added Radarr / Sonarr webhooks, they will be available in the next release.

This is great! Do we know when the next release will be available?

jaruba commented 2 years ago

@andrewmcd7 i'm expecting to make a new release this weekend

edrock200 commented 2 years ago

@andrewmcd7 i'm expecting to make a new release this weekend

Great news! Thank you!

jaruba commented 2 years ago

@andrewmcd7 @edrock200

Sorry, I was unable to make a release in the weekend. In my tests the "download" event comes late from radarr / sonarr, even with no delay set, causing Plex to not catch the new poster before the initial metadata scan, and thus requiring the user to do a manual metadata refresh for new items.

So I started looking into integrating Plex's API too.

edrock200 commented 2 years ago

@andrewmcd7 @edrock200

Sorry, I was unable to make a release in the weekend. In my tests the "download" event comes late from radarr / sonarr, even with no delay set, causing Plex to not catch the new poster before the initial metadata scan, and thus requiring the user to do a manual metadata refresh for new items.

So I started looking into integrating Plex's API too.

No worries! Thank you. I use autoscan inline between sonarr/radarr and plex, so I can delay the triggers to plex just for this reason! :)

jaruba commented 2 years ago

I just released v0.1.9 that includes Radarr / Sonarr webhooks (and also Plex Connection support to refresh metadata after the posters are downloaded)

edrock200 commented 2 years ago

Thank you! Got it all setup :) one question. What happens to triggers sent when you are at your API limit? Are they ignored or queued?

jaruba commented 2 years ago

@edrock200

they will be ignored, unfortunately, as the requests it does to the API will fail in that scenario

but if u have periodic scans active (even without the overwrite setting enabled), it will try to add all missing posters on the next scan (and every scan, for that matter)

also keep in mind that I have increased the request limit for all tiers by more than double since the service was launched, and I will most probably continue to increase this limit as long as the service's performance is kept at a good level

edrock200 commented 2 years ago

Thanks again!!