haijeploeg / excludarr

Excludarr manages your libraries in Radarr/Sonarr. It keeps track of your library and checks if your movies and series are also available on a configured streaming provider. It can exclude the movies and series that are available on a configured streaming provider. But it can also re-add movies and series if they are not streaming anymore.
MIT License
197 stars 12 forks source link

Setting movies to Not Monitored instead of removing, and adding back if no streaming providers available [Enhancement] #9

Closed KaHooli closed 3 years ago

KaHooli commented 3 years ago

With my Radarr setup, it adds new entries based on the IMDB Watchlist of my different family members. By removing the movies from Radarr all together, Radarr will just have them re-added next time the IMDB Watchlists are parsed (I've since confirmed this is true).

It would be good if the movies entry could be left in Radarr, but their monitoring is set to Not Monitored instead, and still have the files deleted from the drives.

Also, if a movie is Not Monitored and it is no longer listed on my streaming providers, it would be great to have the option to change the status back to Monitored.

haijeploeg commented 3 years ago

Hi Kahooli,

Definitely a good feature, I have to figure out if this is possible using the Radarr API. I will come back to you when I have investigated this.

dofl commented 3 years ago

I'm using radarr in combination with serveral watchlists. When a new Netflix movie comes out it'll keep adding this movie because it's not in the radarr database anymore. Setting the movie on 'unmonitored' would fix it.

It's possible but I didn't see a direct API command in the docs: https://radarr.video/docs/api/

KaHooli commented 3 years ago

/movie/editor appears to allow editing of multiple movies at once, and one of the properties is monitored.

ninoz commented 3 years ago

You can set the status using the following request:

PUT http://172.25.25.60:7878/api/v3/movie/editor?apiKey=<Key>

{
    "movieIds": [
        12
    ],
    "monitored": false
}

not sure how to integrate that into your code

haijeploeg commented 3 years ago

Hi all,

Sorry for the extreme late reply. I had some personal stuff to deal with. I have picked up development again and I have implemented the not monitored function.

You can upgrade the package using pip install --upgrade excludarr.

I have changed the commands a bit. The delete command is being replaced with exclude. You can choose your action with the -a flag.

To just keep deleting the movies using the previous way use:

excludarr -a delete

To change the status to not monitored:

# Change the status to not monitored and leave the files
excludarr -a not-monitored

# Change the status to not monitored and delete the files as well
excludarr -a not-monitored -d

Please let me know what you think and if you need any adjustments!

KaHooli commented 3 years ago

The update doesn't appear to read the settings in /etc/excludarr/excludarr.yml anymore, as it is looking for localhost for Radarr and not the hostname I've specified.

haijeploeg commented 3 years ago

Hi Kahooli,

I have checked this on my own environment, but I don't have this problem. Are you sure you dont have a excludarr.yml in your current folder? And has the user permissions to the config file?

To identify which configfile it is using, can you run and post the output here?:

excludarr --debug
KaHooli commented 3 years ago

Here is the output...


james@braavos:~$ docker run -it --rm -v /home/james/docker/appdata/excludarr/excludarr.yml:/etc/excludarr/excludarr.yml --network t2_proxy kahooli/excludarr --debug
2021-07-06 20:51:18,111 (DEBUG) cement.core.foundation : laying cement for the 'excludarr' application
2021-07-06 20:51:18,112 (DEBUG) cement.core.hook : defining hook 'pre_setup'
2021-07-06 20:51:18,112 (DEBUG) cement.core.hook : defining hook 'post_setup'
2021-07-06 20:51:18,112 (DEBUG) cement.core.hook : defining hook 'pre_run'
2021-07-06 20:51:18,112 (DEBUG) cement.core.hook : defining hook 'post_run'
2021-07-06 20:51:18,112 (DEBUG) cement.core.hook : defining hook 'pre_argument_parsing'
2021-07-06 20:51:18,112 (DEBUG) cement.core.hook : defining hook 'post_argument_parsing'
2021-07-06 20:51:18,112 (DEBUG) cement.core.hook : defining hook 'pre_close'
2021-07-06 20:51:18,112 (DEBUG) cement.core.hook : defining hook 'post_close'
2021-07-06 20:51:18,112 (DEBUG) cement.core.hook : defining hook 'signal'
2021-07-06 20:51:18,113 (DEBUG) cement.core.hook : defining hook 'pre_render'
2021-07-06 20:51:18,113 (DEBUG) cement.core.hook : defining hook 'post_render'
2021-07-06 20:51:18,113 (DEBUG) cement.core.hook : registering hook 'add_handler_override_options' from cement.core.foundation into hooks['post_setup']
2021-07-06 20:51:18,113 (DEBUG) cement.core.hook : registering hook 'handler_override' from cement.core.foundation into hooks['post_argument_parsing']
2021-07-06 20:51:18,113 (DEBUG) cement.core.interface : defining interface 'extension' (ExtensionInterface)
2021-07-06 20:51:18,113 (DEBUG) cement.core.interface : defining interface 'log' (LogInterface)
2021-07-06 20:51:18,113 (DEBUG) cement.core.interface : defining interface 'config' (ConfigInterface)
2021-07-06 20:51:18,113 (DEBUG) cement.core.interface : defining interface 'mail' (MailInterface)
2021-07-06 20:51:18,113 (DEBUG) cement.core.interface : defining interface 'plugin' (PluginInterface)
2021-07-06 20:51:18,113 (DEBUG) cement.core.interface : defining interface 'output' (OutputInterface)
2021-07-06 20:51:18,113 (DEBUG) cement.core.interface : defining interface 'template' (TemplateInterface)
2021-07-06 20:51:18,113 (DEBUG) cement.core.interface : defining interface 'argument' (ArgumentInterface)
2021-07-06 20:51:18,113 (DEBUG) cement.core.interface : defining interface 'controller' (ControllerInterface)
2021-07-06 20:51:18,114 (DEBUG) cement.core.interface : defining interface 'cache' (CacheInterface)
2021-07-06 20:51:18,114 (DEBUG) cement.core.handler : registering handler '<class 'cement.core.extension.ExtensionHandler'>' into handlers['extension']['cement']
2021-07-06 20:51:18,114 (DEBUG) cement.core.handler : registering handler '<class 'excludarr.controllers.base.Base'>' into handlers['controller']['base']
2021-07-06 20:51:18,114 (DEBUG) cement.core.foundation : now setting up the 'excludarr' application
2021-07-06 20:51:18,114 (DEBUG) cement.core.foundation : setting up excludarr.extension handler
2021-07-06 20:51:18,114 (DEBUG) cement.core.extension : loading the 'cement.ext.ext_dummy' framework extension
2021-07-06 20:51:18,115 (DEBUG) cement.core.handler : registering handler '<class 'cement.ext.ext_dummy.DummyOutputHandler'>' into handlers['output']['dummy']
2021-07-06 20:51:18,115 (DEBUG) cement.core.handler : registering handler '<class 'cement.ext.ext_dummy.DummyTemplateHandler'>' into handlers['template']['dummy']
2021-07-06 20:51:18,115 (DEBUG) cement.core.handler : registering handler '<class 'cement.ext.ext_dummy.DummyMailHandler'>' into handlers['mail']['dummy']
2021-07-06 20:51:18,115 (DEBUG) cement.core.extension : loading the 'cement.ext.ext_smtp' framework extension
2021-07-06 20:51:18,163 (DEBUG) cement.core.handler : registering handler '<class 'cement.ext.ext_smtp.SMTPMailHandler'>' into handlers['mail']['smtp']
2021-07-06 20:51:18,163 (DEBUG) cement.core.extension : loading the 'cement.ext.ext_plugin' framework extension
2021-07-06 20:51:18,166 (DEBUG) cement.core.handler : registering handler '<class 'cement.ext.ext_plugin.CementPluginHandler'>' into handlers['plugin']['cement']
2021-07-06 20:51:18,167 (DEBUG) cement.core.extension : loading the 'cement.ext.ext_configparser' framework extension
2021-07-06 20:51:18,168 (DEBUG) cement.core.handler : registering handler '<class 'cement.ext.ext_configparser.ConfigParserConfigHandler'>' into handlers['config']['configparser']
2021-07-06 20:51:18,168 (DEBUG) cement.core.extension : loading the 'cement.ext.ext_logging' framework extension
2021-07-06 20:51:18,168 (DEBUG) cement.core.handler : registering handler '<class 'cement.ext.ext_logging.LoggingLogHandler'>' into handlers['log']['logging']
2021-07-06 20:51:18,169 (DEBUG) cement.core.hook : registering hook 'add_logging_arguments' from cement.ext.ext_logging into hooks['pre_argument_parsing']
2021-07-06 20:51:18,169 (DEBUG) cement.core.hook : registering hook 'handle_logging_arguments' from cement.ext.ext_logging into hooks['post_argument_parsing']
2021-07-06 20:51:18,169 (DEBUG) cement.core.extension : loading the 'cement.ext.ext_argparse' framework extension
2021-07-06 20:51:18,170 (DEBUG) cement.core.handler : registering handler '<class 'cement.ext.ext_argparse.ArgparseArgumentHandler'>' into handlers['argument']['argparse']
2021-07-06 20:51:18,170 (DEBUG) cement.core.extension : loading the 'cement.ext.ext_yaml' framework extension
2021-07-06 20:51:18,272 (DEBUG) cement.core.hook : registering hook 'suppress_output_before_run' from cement.ext.ext_yaml into hooks['post_argument_parsing']
2021-07-06 20:51:18,273 (DEBUG) cement.core.hook : registering hook 'unsuppress_output_before_render' from cement.ext.ext_yaml into hooks['pre_render']
2021-07-06 20:51:18,273 (DEBUG) cement.core.hook : registering hook 'suppress_output_after_render' from cement.ext.ext_yaml into hooks['post_render']
2021-07-06 20:51:18,273 (DEBUG) cement.core.handler : registering handler '<class 'cement.ext.ext_yaml.YamlOutputHandler'>' into handlers['output']['yaml']
2021-07-06 20:51:18,273 (DEBUG) cement.core.handler : registering handler '<class 'cement.ext.ext_yaml.YamlConfigHandler'>' into handlers['config']['yaml']
2021-07-06 20:51:18,273 (DEBUG) cement.core.extension : loading the 'cement.ext.ext_colorlog' framework extension
2021-07-06 20:51:18,300 (DEBUG) cement.core.handler : registering handler '<class 'cement.ext.ext_colorlog.ColorLogHandler'>' into handlers['log']['colorlog']
2021-07-06 20:51:18,300 (DEBUG) cement.core.extension : loading the 'cement.ext.ext_print' framework extension
2021-07-06 20:51:18,301 (DEBUG) cement.core.handler : registering handler '<class 'cement.ext.ext_print.PrintDictOutputHandler'>' into handlers['output']['print_dict']
2021-07-06 20:51:18,301 (DEBUG) cement.core.handler : registering handler '<class 'cement.ext.ext_print.PrintOutputHandler'>' into handlers['output']['print']
2021-07-06 20:51:18,301 (DEBUG) cement.core.hook : registering hook 'extend_print' from cement.ext.ext_print into hooks['pre_argument_parsing']
2021-07-06 20:51:18,302 (DEBUG) cement.core.foundation : adding signal handler <function cement_signal_handler at 0x7f4b115781f0> for signal Signals.SIGTERM
2021-07-06 20:51:18,302 (DEBUG) cement.core.foundation : adding signal handler <function cement_signal_handler at 0x7f4b115781f0> for signal Signals.SIGINT
2021-07-06 20:51:18,302 (DEBUG) cement.core.foundation : adding signal handler <function cement_signal_handler at 0x7f4b115781f0> for signal Signals.SIGHUP
2021-07-06 20:51:18,302 (DEBUG) cement.core.foundation : setting up excludarr.config handler
2021-07-06 20:51:18,303 (DEBUG) cement.core.config : config file '/etc/excludarr/excludarr.yml' exists, loading settings...
2021-07-06 20:51:18,306 (DEBUG) cement.core.config : config file '/.excludarr.yml' does not exist, skipping...
2021-07-06 20:51:18,306 (DEBUG) cement.core.config : config file '/root/.config/excludarr/excludarr.yml' does not exist, skipping...
2021-07-06 20:51:18,306 (DEBUG) cement.core.config : config file '/root/.excludarr/config/excludarr.yml' does not exist, skipping...
2021-07-06 20:51:18,306 (DEBUG) cement.core.config : config file '/root/.excludarr.yml' does not exist, skipping...
2021-07-06 20:51:18,307 (DEBUG) cement.core.foundation : setting up excludarr.mail handler
2021-07-06 20:51:18,307 (DEBUG) cement.core.handler : merging config defaults from '<cement.ext.ext_dummy.DummyMailHandler object at 0x7f4b10fd12e0>' into section 'mail.dummy'
2021-07-06 20:51:18,307 (DEBUG) cement.core.foundation : no cache handler defined, skipping.
2021-07-06 20:51:18,307 (DEBUG) cement.core.foundation : setting up excludarr.log handler
2021-07-06 20:51:18,307 (DEBUG) cement.core.handler : merging config defaults from '<cement.ext.ext_colorlog.ColorLogHandler object at 0x7f4b10ff7e50>' into section 'log.colorlog'
2021-07-06 20:51:18,308 (DEBUG) cement.ext.ext_logging : logging initialized for 'excludarr' using ColorLogHandler
2021-07-06 20:51:18,308 (DEBUG) cement.core.foundation : setting up excludarr.plugin handler
2021-07-06 20:51:18,308 (DEBUG) cement.core.foundation : setting up excludarr.arg handler
2021-07-06 20:51:18,309 (DEBUG) cement.core.foundation : setting up excludarr.output handler
2021-07-06 20:51:18,309 (DEBUG) cement.core.foundation : setting up excludarr.template handler
2021-07-06 20:51:18,310 (DEBUG) cement.core.foundation : setting up application controllers
2021-07-06 20:51:18,310 (DEBUG) cement.core.handler : merging config defaults from '<excludarr.controllers.base.Base object at 0x7f4b10fe2be0>' into section 'controller.base'
2021-07-06 20:51:18,310 (DEBUG) cement.core.hook : running hook 'post_setup' (<function add_handler_override_options at 0x7f4b119c8940>) from cement.core.foundation
2021-07-06 20:51:18,311 (DEBUG) cement.core.foundation : no handlers are overridable within the output interface
2021-07-06 20:51:18,311 (DEBUG) cement.core.foundation : running pre_run hook
2021-07-06 20:51:18,311 (DEBUG) cement.ext.ext_argparse : controller dispatch passed off to <excludarr.controllers.base.Base object at 0x7f4b10fe2be0>
2021-07-06 20:51:18,311 (DEBUG) cement.ext.ext_argparse : resolving controller nesting/embedding order
2021-07-06 20:51:18,311 (DEBUG) cement.ext.ext_argparse : collecting commands from <excludarr.controllers.base.Base object at 0x7f4b10fe2be0> (stacked_on='base', stacked_type='embedded')
2021-07-06 20:51:18,312 (DEBUG) cement.ext.ext_argparse : processing arguments for 'base' controller namespace
2021-07-06 20:51:18,312 (DEBUG) cement.ext.ext_argparse : collecting arguments from <excludarr.controllers.base.Base object at 0x7f4b10fe2be0> (stacked_on='base', stacked_type='embedded')
2021-07-06 20:51:18,312 (DEBUG) cement.ext.ext_argparse : adding argument (args=['-v', '--version'], kwargs={'action': 'version', 'version': '\nExcludarr 0.1.2\nCement Framework 3.0.4\nPython 3.8.11\nPlatform Linux-5.4.0-77-generic-x86_64-with\n'})
2021-07-06 20:51:18,312 (DEBUG) cement.ext.ext_argparse : processing commands for 'base' controller namespace
2021-07-06 20:51:18,312 (DEBUG) cement.ext.ext_argparse : collecting commands from <excludarr.controllers.base.Base object at 0x7f4b10fe2be0> (stacked_on='base', stacked_type='embedded')
2021-07-06 20:51:18,312 (DEBUG) cement.ext.ext_argparse : adding command 'exclude' (controller=base, func=exclude)
2021-07-06 20:51:18,313 (DEBUG) cement.ext.ext_argparse : processing arguments for 'exclude' command namespace
2021-07-06 20:51:18,313 (DEBUG) cement.ext.ext_argparse : adding argument (args=['-p', '--providers'], kwargs={'help': 'a single streaming provider, can be set multiple times', 'action': 'append', 'default': [], 'dest': 'providers'})
2021-07-06 20:51:18,313 (DEBUG) cement.ext.ext_argparse : adding argument (args=['-c', '--country'], kwargs={'help': 'the 2 letter country code you are living in', 'action': 'store'})
2021-07-06 20:51:18,313 (DEBUG) cement.ext.ext_argparse : adding argument (args=['-t', '--type'], kwargs={'help': 'the type of endpoint to reach. Only Radarr is supported at the moment.', 'action': 'store', 'default': 'radarr', 'choices': ['radarr']})
2021-07-06 20:51:18,314 (DEBUG) cement.ext.ext_argparse : adding argument (args=['-a', '--action'], kwargs={'help': 'either delete the entry or change the status to not monitored', 'action': 'store', 'default': 'delete', 'choices': ['delete', 'not-monitored']})
2021-07-06 20:51:18,314 (DEBUG) cement.ext.ext_argparse : adding argument (args=['-r', '--remove-not-found'], kwargs={'help': 'exclude the movie as well when it cannot be found on tmdb', 'action': 'store_true'})
2021-07-06 20:51:18,314 (DEBUG) cement.ext.ext_argparse : adding argument (args=['-d', '--delete-files'], kwargs={'help': 'delete currently downloaded files as well', 'action': 'store_true'})
2021-07-06 20:51:18,314 (DEBUG) cement.ext.ext_argparse : adding argument (args=['-e', '--exclusion'], kwargs={'help': 'add a exclusion in Radarr to prevent future importing the movie from a list', 'action': 'store_true'})
2021-07-06 20:51:18,314 (DEBUG) cement.ext.ext_argparse : adding argument (args=['-l', '--legacy'], kwargs={'help': 'if this flag is set, delete the movies one by one instead of a single API call', 'action': 'store_true'})
2021-07-06 20:51:18,315 (DEBUG) cement.ext.ext_argparse : adding argument (args=['-f', '--force'], kwargs={'help': 'force deletion without user input', 'action': 'store_true'})
2021-07-06 20:51:18,315 (DEBUG) cement.core.hook : running hook 'pre_argument_parsing' (<function add_logging_arguments at 0x7f4b102c41f0>) from cement.ext.ext_logging
2021-07-06 20:51:18,315 (DEBUG) cement.core.hook : running hook 'pre_argument_parsing' (<function extend_print at 0x7f4b10c05280>) from cement.ext.ext_print
2021-07-06 20:51:18,315 (DEBUG) cement.core.foundation : extending appication with '.print' (<function extend_print.<locals>._print at 0x7f4b10c05550>)
2021-07-06 20:51:18,315 (DEBUG) cement.core.hook : running hook 'post_argument_parsing' (<function handler_override at 0x7f4b114ef9d0>) from cement.core.foundation
2021-07-06 20:51:18,316 (DEBUG) cement.core.hook : running hook 'post_argument_parsing' (<function handle_logging_arguments at 0x7f4b102c4d30>) from cement.ext.ext_logging
2021-07-06 20:51:18,316 (DEBUG) cement.core.hook : running hook 'post_argument_parsing' (<function suppress_output_before_run at 0x7f4b102c4f70>) from cement.ext.ext_yaml
usage: excludarr [-h] [-d] [-q] [-v] {exclude} ...

Exclude streaming services such as netflix from Radarr

optional arguments:
  -h, --help     show this help message and exit
  -d, --debug    full application debug mode
  -q, --quiet    suppress all console output
  -v, --version  show program's version number and
                 exit

sub-commands:
  {exclude}
    exclude      Excludes the media that is also
                 available on streaming providers

Usage: excludarr delete --providers netflix --country nl
2021-07-06 20:51:18,318 (DEBUG) cement.core.foundation : running post_run hook
2021-07-06 20:51:18,318 (DEBUG) cement.core.foundation : closing the excludarr application
james@braavos:~$ 

I updated my fork with your code, so I could create a container on Hub.Docker.com, and I'm running this in a docker container.

haijeploeg commented 3 years ago

Hi,

The following line says that it is reading the config file:

2021-07-06 20:51:18,303 (DEBUG) cement.core.config : config file '/etc/excludarr/excludarr.yml' exists, loading settings...

Can you post the content that file?

haijeploeg commented 3 years ago

I have added a official Docker container (#8), please use that one and verify if that containers works properly.

KaHooli commented 3 years ago

Hi,

The following line says that it is reading the config file:


2021-07-06 20:51:18,303 (DEBUG) cement.core.config : config file '/etc/excludarr/excludarr.yml' exists, loading settings...

Can you post the content that file?

It looks like that file got overwritten with default values last time I ran excludarr, which is why it was looking at the wrong address. Luckily I have a backup.

KaHooli commented 3 years ago

I have added a official Docker container (#8), please use that one and verify if that containers works properly.

I've done this, which seemed to work better, I'll post results in that thread.

haijeploeg commented 3 years ago

Great! If this is all working fine, please close this issue.

KaHooli commented 3 years ago

Is there an option to prevent excludarr from prompting Are you sure you want to change the status of the movies to: not-monitored? (y/N) so I can force Y?

If not, could this be added down the track? I'd like to be able to schedule the automated running of this program eventually (eg chron).

haijeploeg commented 3 years ago

Yep there is, you can use the -f flag, that will bypass the prompt :)

KaHooli commented 3 years ago

I thought that might, just wasn't sure because of the help text.

Thanks again for all your work!

haijeploeg commented 3 years ago

There was actually a bug in it I noticed after your question. I have fixed this and released a new version. You can update to v0.1.4 now.