vche/pycliarr

Season folder are not created

Closed this issue · 6 comments

Season folders for a serie are not created when using "add_serie"

vche commented

Please provide an example of the call made, and the output. and ensure you have set the proper option.

                self.sonarr_node.add_serie(
                    tvdb_id=data[2], quality=int(data[3]),
                    monitored_seasons=monitored_seasons
                )

This will add the series to the Sonarr server, but all episodes are all in the series directory instead of in seperate folders

Using the CLI:

marco@MacBook-Pro-van-Marco ~/D/G/p/test (main) [2]> pycliarr -d -t 'http://192.168.178.7:8989' -k '2c9e7044203a44bd99e20e45fc7411a3' sonarr add -t 266189
PyCliarr version 1.0.7
2021-05-09 10:47:29,482 base_api.py:74 DEBUG: Request sent: GET http://192.168.178.7:8989/api/series/lookup params: {'term': '266189'} data: None
2021-05-09 10:47:29,488 connectionpool.py:226 DEBUG: Starting new HTTP connection (1): 192.168.178.7:8989
2021-05-09 10:47:30,238 connectionpool.py:433 DEBUG: http://192.168.178.7:8989 "GET /api/series/lookup?term=266189 HTTP/1.1" 200 None
Unexpected error: object of type 'SonarrSerieItem' has no len()
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pycliarr/cli/cli.py", line 63, in main
    _run_command(cli_mapping, args.cli_name, args.cmd_name, args)
  File "/usr/local/lib/python3.9/site-packages/pycliarr/cli/cli.py", line 46, in _run_command
    cli_mapping[cli_name].run_command(cmd_name, args)
  File "/usr/local/lib/python3.9/site-packages/pycliarr/cli/cli_cmd.py", line 49, in run_command
    self.cmd_list[cmd_name].run(cli, args)
  File "/usr/local/lib/python3.9/site-packages/pycliarr/cli/cli_cmd.py", line 385, in run
    serie_info = select_item(args.terms, choices)  # type: ignore
  File "/usr/local/lib/python3.9/site-packages/pycliarr/cli/cli_cmd.py", line 78, in select_item
    if len(choices) == 0:
TypeError: object of type 'SonarrSerieItem' has no len()
marco@MacBook-Pro-van-Marco ~/D/G/p/test (main) [2]> 

In code:

from pycliarr.api import (
    SonarrCli
)

sonarr = SonarrCli('http://192.168.178.7:8989',
                   '2c9e7044203a44bd99e20e45fc7411a3')

sonarr.add_serie(tvdb_id=266189, quality=1)

The serie gets added (weird) !!!! BUT Files are not saved in season folders.

vche commented

Feature added in 1.0.8

This feature I tested in Python and works perfectly now!

from pycliarr.api import (
    SonarrCli
)

sonarr = SonarrCli('http://192.168.178.7:8989',
                   '2c9e7044203a44bd99e20e45fc7411a3')

# sonarr.delete_serie(serie_id=198)

res = sonarr.add_serie(tvdb_id=281618, quality=1, season_folder=True)

print(res)
vche commented

As for your command example, it is just not finding anything. If you refer to the documentation:

 pyvenv/bin/pycliarr -t "http://192.168.0.199:8989" -k "2ac2d0f667524da3ba1849e81dba5a84" -d sonarr add -h
PyCliarr version 1.0.8
usage: pycliarr sonarr add [-h] (--tvdb TVDB | --terms TERMS) [--quality QUALITY] [--seasons SEASONS] [--season-folders]

optional arguments:
  -h, --help            show this help message and exit
  --tvdb TVDB           TheVideoDatabase ID of the serie to add
  --terms TERMS, -t TERMS
                        Keyword to search for the serie to add
  --quality QUALITY, -q QUALITY
                        Quality profile to use
  --seasons SEASONS, -s SEASONS
                        Comma separated list of seasons nums
  --season-folders, -f  Whether to create season folders, default is false

"-t" is to specify keywords, and you specify "266189'" as a keyword. you may want to use --tvdb if you specify the item. However specifying a tvdb id as term is working, and pointed another issue when only one result is returned. I will send a new version shortly.