ASK-ME-ABOUT-LOOM / purgeomatic

Delete movie/tv data based on watch statistics
GNU General Public License v3.0
64 stars 12 forks source link

Adding protected tags #26

Closed jantede closed 6 months ago

jantede commented 6 months ago

Hi,

this is just an additional feature I personally think is quite useful. With protected tags, you can simply provide one or more tag IDs from Radarr and Sonarr. If a movie or series is tagged with one of these, purgeomatic will skip deletion.

Currently you're only able to set up a list in the "protected" file which requires additional steps when it comes to automatically protecting content. With protected tags, you can simply use the automated tagging engine already built in to Radarr and Sonarr, making life just a bit easier :-)

ASK-ME-ABOUT-LOOM commented 6 months ago

Wow, this is really great!

I think this needs a bit more instruction, though. I've tried to make each entry in the .env.example file be a live example of what kind of content each variable should contain so that users can intuit just by looking at it what kind of changes they need to make to their .env file.

As it stands, I'm not really clear exactly what I'd need to set the RADARR_PROTECTED_TAGS or SONARR_PROTECTED_TAGS variables to in order to get this functionality working.

I'll merge after that update.

Edit: I just briefly skimmed through both Sonarr & Radarr and while I can find tags under Settings > Tags, I can't see any immediate way to get the tag ID as an integer (which appears to be what this code uses?) without querying the API, I suppose. If that's the case we'd need explicit short documentation in .env.example (e.g., "Get tag IDs from the Sonarr/Radarr API") as well as full instructions for the README.md.

jantede commented 6 months ago

Glad you like the feature :)

In my implementation, you currently need to provide the tag IDs as delivered by the Radarr/Sonarr API in a comma-seperated list. Theoretically this could also be implemented using names by translating them using /api/v3/tag. However,I chose the easier way by using the IDs, as they're already provided with the API calls the script uses anyway. Also, we don't have to care about special characters and Umlauts in that case.

There is no easy way to get that from the GUI, even with inspect element. The easiest way right now seems to just browse to http://<Radarr|Sonarr>/api/v3/tag?apikey= and collect the IDs from there. For me I think this is a viable workaround which should be possible for people automating their libraries using scripts :)

I've updated .env.example and added a section to README.md correspondingly.

ASK-ME-ABOUT-LOOM commented 6 months ago

This is a great contribution. Thanks so much! I went through and fixed a few typos and updated the language just a bit.

Thanks!