Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List indices Error with sonarr_list plugin #2132

Closed
Procuria opened this issue May 7, 2018 · 32 comments
Closed

List indices Error with sonarr_list plugin #2132

Procuria opened this issue May 7, 2018 · 32 comments
Assignees
Labels

Comments

@Procuria
Copy link

Procuria commented May 7, 2018

Expected behaviour:

Synchronisation of the Trakt-List 'serien' to Sonarr

Actual behaviour:

no synchronisation; task series_unseen crashes with error " BUG: Unhandled error in plugin list_add: list indices must be integers, not unicode"

Config:

schedules:
  - tasks: [series_unseen,series_seen,clean-compare]
    interval:
      minutes: 10

tasks:

### SERIES-SONARR #
# Get from series list any shows that have unseen episodes, add to Sonarr and search for missing

  series_unseen:
    priority: 3
    disable:
      - seen
      - seen_info_hash
      - retry_failed
    trakt_lookup:
      account: procuria
      username: Procuria
    trakt_list:
      account: procuria
      list: serien
      type: shows
    if:
      - trakt_watched: reject
    accept_all: yes
    list_add:
      - sonarr_list:
          base_url: http://localhost
          port: 8989
          api_key: MyApiKey
          ignore_episodes_with_files: yes
          root_folder_path: /home/Deluge/TV 
          search_missing_episodes: yes

# Get from series list any shows that have already been seen, add to Sonarr and only get future episodes
# Skip ended to keep Sonarr clean

  series_seen:
    priority: 4
    disable:
      - seen
      - seen_info_hash
      - retry_failed
    thetvdb_lookup: yes
    trakt_lookup:
      account: procuria
      username: Procuria
    trakt_list:
      account: procuria
      list: serien
      type: shows
    if:
      - "tvdb_status != 'Ended' and trakt_watched": accept
    list_add:
      - sonarr_list:
          base_url: http://localhost
          port: 8989
          api_key: MyApiKey
          ignore_episodes_with_files: yes
          ignore_episodes_without_files: yes
          root_folder_path: /home/Deluge/TV

### CLEANUP-SONARR #
# List compare Sonarr and series list, anything in Sonarr that is not in series list is added to entry_list sonarr-rm
# A direct list match between trakt and Sonarr does not work and removes shows incorrectly

  clean-compare:
    delay: 1 days
    priority: 6
    disable:
      - seen
      - seen_info_hash
      - retry_failed
    trakt_lookup: yes
    sonarr_list:
      base_url: http://localhost
      port: 8989
      api_key: MyApiKey
    list_match:
      from:
        - trakt_list:
            account: procuria
            list: serien
            type: shows
      action: reject
    accept_all: yes
    list_remove:
      - sonarr_list:
          base_url: http://localhost
          port: 8989
          api_key: MyApiKey

Log:

2018-05-07 20:24 INFO     manager                       Reloading config from disk.
2018-05-07 20:24 INFO     manager                       Config successfully reloaded from disk.
2018-05-07 20:34 CRITICAL task          series_unseen   BUG: Unhandled error in plugin list_add: list indices must be integers, not unicode
2018-05-07 20:34 CRITICAL manager       series_unseen   An unexpected crash has occurred. Writing crash report to /root/.flexget/crash_report.2018.05.07.203448568805.log. Please verify you are running the latest version of flexget by using "flexget -V" from CLI or by using version_checker plugin at http://flexget.com/wiki/Plugins/version_checker. You are currently using version 2.13.15
2018-05-07 20:34 WARNING  task          series_unseen   Aborting task (plugin: list_add)
2018-05-07 20:35 INFO     trakt_list    clean-compare   Successfully deleted to/from list serien: 0 movie(s), 0 show(s), 0 episode(s), 0 season(s).

Crash-Log:

2018-05-07 20:34 CRITICAL task          series_unseen   BUG: Unhandled error in plugin list_add: list indices must be integers, not unicode
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flexget/task.py", line 486, in __run_plugin
    return method(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/flexget/event.py", line 23, in __call__
    return self.func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/flexget/plugins/output/list_add.py", line 54, in on_task_output
    thelist |= task.accepted
  File "/usr/lib/python2.7/_abcoll.py", line 330, in __ior__
    self.add(value)
  File "/usr/local/lib/python2.7/dist-packages/flexget/plugins/list/sonarr_list.py", line 217, in add
    log.verbose('Successfully added show %s to Sonarr', show['title'])
TypeError: list indices must be integers, not unicode

Additional information:

  • FlexGet version: 2.13.15
  • Python version: 2.7.12
  • Installation method: pip
  • Using daemon (yes/no): yes
  • OS and version: 16.04.4 LTS (GNU/Linux 4.4.0-122-generic x86_64)
@liiight liiight self-assigned this May 7, 2018
@liiight liiight added the Bug label May 7, 2018
@liiight
Copy link
Member

liiight commented May 10, 2018

Is this persistent? can you attach a debug log please?

@Procuria
Copy link
Author

Hello @liiight ,
thank you very much for your reply.

Unfortunatly the problem is persistent. I'd like to gather the demanded data, but I'm not quite sure which is the correct way - should I change the loglevel to debug or create a --bugreport?
Or may be do both? Right now I'm not familiar with the flexget-cli, but I'll check the documentation.

Best regards,

Peter

@Procuria
Copy link
Author

Procuria commented May 10, 2018

And here is the last crash report on debug-level. I have got the Series "3%" in my Sonarr-List - maybe this could 'confuse' the whole process? I deleted it now from the sonarr_list and watch what happens...
crash_report.2018.05.11.001713881260.log

P.S.: Deleting the series "3%" changed nothing - the error remains the same.

@Procuria
Copy link
Author

One additional thougt - as I went through the debug logs I noticed that all series imported from the trakt list contain the year in round brackets i.e. (2012) etc. So there's unicode in the list taken from Trakt. Maybe this causes the problem?

@Procuria
Copy link
Author

I don't want to bother, but because it is an interessting problem I allow me to bounce this issue.

@cvium
Copy link
Contributor

cvium commented May 22, 2018

Parentheses are well within the ASCII range, but that's not the issue. A trace log might say shed some light on this.

@Procuria
Copy link
Author

Procuria commented May 22, 2018

Thank you very much for the reply @cvium :)
I thought so too, but was not really sure - now I am and therefore even more clueless than before.

I hope you guys can do some 'developer magic' like you did in developing this fascinating tool.

Best,
Peter

@cvium
Copy link
Contributor

cvium commented May 22, 2018

As I said, a trace log would be helpful.

@Procuria
Copy link
Author

Oh I'm sorry, I thought the submitted log was the needed.

I now generated this
tracelog.txt
and hope this is the right one.

Thank you for your patience !

Best,

Peter

@cvium
Copy link
Contributor

cvium commented May 22, 2018

The sonarr response looks like it's a list of all your shows. There's about 45 shows in the response. Maybe @liiight has an idea why. I've never worked with sonarr.

@Procuria
Copy link
Author

Thanks again for answering so fast!
Yeah that's pretty much in the response - as I tinkered around when tripping about this issue I 'cleaned' the sonarr-list and shrinked it down to 5. But the problem remained.

So I gave up and drowned my Sonarr/trakt-sorrows in binge watching... :)

Thanks for your time @cvium !

@liiight
Copy link
Member

liiight commented May 22, 2018

I'm a little preoccupied these days. I'll try to take a peek asap

@gazpachoking
Copy link
Member

It seems like this could be a sonarr bug (though I'm not positive) are you on the latest sonarr version?

@Procuria
Copy link
Author

Thanks in advance @liiight .

@gazpachoking I'm on 2.0.0.5163 - the latest master as I understand it.

@JourneyOver
Copy link
Contributor

JourneyOver commented Jul 19, 2018

Edit: messed around abit and magically got it working again, even on the latest update.. Dunno what I did exactly but heh it at least is working for me again.

@liiight
Copy link
Member

liiight commented Nov 13, 2018

awesome!

@liiight liiight closed this as completed Nov 13, 2018
@Sepdnoj
Copy link

Sepdnoj commented Dec 21, 2018

I am having this issue. Can anyone help?

Just wanted to mention I have tried all sorts of things to fix it. Nothing seems to work.

Am on the most recent version. Log files are identical.

My config:

tasks:
  ImportTrakt:
    trakt_list:
      account: **********
      list: watchlist
      type: shows
    accept_all: yes
    list_add:
       - sonarr_list:
          base_url: http://localhost
          port: 12468
          api_key: ***********
          ignore_episodes_with_files: true
          ignore_episodes_without_files: true
          search_missing_episodes: true
          root_folder_path: **************
schedules:
  - tasks: [ImportTrakt]
    interval:
      minutes: 5

@liiight
Copy link
Member

liiight commented Dec 23, 2018

can you please paste your logfiles anyway? worth taking another look

@githubsendrove
Copy link

Same issue here - logfile below - I'd appreciate any insight please.

crash_report.2019.01.01.221559926082.log
flexget.log

@Sepdnoj
Copy link

Sepdnoj commented Jan 28, 2019

Can this be reopened please. It is not solved.

@gazpachoking gazpachoking reopened this Jan 28, 2019
@Sepdnoj
Copy link

Sepdnoj commented Jan 29, 2019

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flexget/task.py", line 498, in __run_plugin
    return method(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/flexget/event.py", line 23, in __call__
    return self.func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/flexget/plugins/output/list_add.py", line 54, in on_task_output
    thelist |= task.accepted
  File "/usr/lib/python2.7/_abcoll.py", line 330, in __ior__
    self.add(value)
  File "/usr/local/lib/python2.7/dist-packages/flexget/plugins/list/sonarr_list.py", line 219, in add
    log.verbose('Successfully added show %s to Sonarr', show['title'])
TypeError: list indices must be integers, not unicode
tasks:
  import-trakt-to-sonarr:
    trakt_list:
      username: ******
      list: watchlist
      type: shows
    accept_all: yes
    list_add:
      - sonarr_list:
          base_url: http://localhost
          port: 12468
          api_key: **********
          ignore_episodes_with_files: true
          ignore_episodes_without_files: true
          search_missing_episodes: true
          monitored: true
          
schedules:
  # Run every task once an hour
  - tasks: [import-trakt-to-sonarr]
    interval:
      minutes: 1

When trying ssl.

9-01-29 13:33 CRITICAL plugin        import-trakt-to-sonarr Sonarr returned an error. ("bad handshake: Error([('SSL routines', 'ssl3_get_record', 'wrong version number')],)",)
2019-01-29 13:33 WARNING  task          import-trakt-to-sonarr Aborting task (plugin: list_add)

My Sonarr Config

<Config>
  <Port>12468</Port>
  <UrlBase>/sonarr</UrlBase>
  <BindAddress>*</BindAddress>
  <SslPort>10193</SslPort>
  <EnableSsl>True</EnableSsl>
  <ApiKey>b682a3d4a55448ae8****efc</ApiKey>
  <AuthenticationMethod>Basic</AuthenticationMethod>
  <LogLevel>Info</LogLevel>
  <LaunchBrowser>False</LaunchBrowser>
  <Branch>master</Branch>
  <SslCertHash></SslCertHash>
  <UpdateMechanism>BuiltIn</UpdateMechanism>
  <UpdateAutomatically>True</UpdateAutomatically>
</Config>

@JourneyOver
Copy link
Contributor

@Senojpd can you try adding base_path: /sonarr to your flexget config in the sonarr_list section..

so it will look like this in the end

tasks:
  import-trakt-to-sonarr:
    trakt_list:
      username: ******
      list: watchlist
      type: shows
    accept_all: yes
    list_add:
      - sonarr_list:
          base_url: http://localhost
          port: 12468
          base_path: /sonarr
          api_key: **********
          ignore_episodes_with_files: true
          ignore_episodes_without_files: true
          search_missing_episodes: true
          monitored: true
          
schedules:
  # Run every task once an hour
  - tasks: [import-trakt-to-sonarr]
    interval:
      minutes: 1

@Sepdnoj
Copy link

Sepdnoj commented Jan 29, 2019

@Senojpd can you try adding base_path: /sonarr to your flexget config in the sonarr_list section..

so it will look like this in the end

tasks:
  import-trakt-to-sonarr:
    trakt_list:
      username: ******
      list: watchlist
      type: shows
    accept_all: yes
    list_add:
      - sonarr_list:
          base_url: http://localhost
          port: 12468
          base_path: /sonarr
          api_key: **********
          ignore_episodes_with_files: true
          ignore_episodes_without_files: true
          search_missing_episodes: true
          monitored: true
          
schedules:
  # Run every task once an hour
  - tasks: [import-trakt-to-sonarr]
    interval:
      minutes: 1

HOLY FUCKING SHIT BOYS. IT WORKED!

You legend, I've spent so many hours on this. Also, and no idea if it was related but I cleared my db files.

@JourneyOver
Copy link
Contributor

Well @cvium @liiight looks like I found the issue to this bug, it seems to only happen when the user has set up a urlbase in sonarr, but hasn't added said base_path to the flexget config.

Obviously this issue came about before the #2134 PR, but said PR actually fixes it by adding the base_path option (just users have to actually set it in the config)

so just to make clear for anyone searching for a fix: if you have added a urlbase into sonarr make sure to add the base_path option into your flexget config or you will continue to run into this error until you either do such a thing, or remove the urlbase from sonarr.

@Senojpd I think it was to do with the urlbase/base_path thing, as I believe when I was running into this error that was the last thing I added into my flexget config before it started working, but I wasn't so sure until I seen you had one set as well without the option set in the flexget config.

@gazpachoking
Copy link
Member

Looks like the wiki page needs an update with the base_path option. I think we can probably also add some handling in the plugin to detect and report this better. I think at a minimum it should start checking the return code is 2xx before processing further.

@Sepdnoj
Copy link

Sepdnoj commented Jan 29, 2019

Thanks for all the help people, is running like a dream now!

@Procuria
Copy link
Author

Guys you are so effing awesome! Thank you very much for clearing this issue! I used traktarr the whole time but now I am able to use this outstanding piece of work again and tailor it to my needs. Kudos, respect, thanks and love to you, who worked this out a little bit sniffing because of small tears of joy :) :) :)

@githubsendrove
Copy link

Excellent work thanks gents.

@gazpachoking gazpachoking changed the title List indices Error with sonarr_list/trakt_list plugin List indices Error with sonarr_list plugin Jan 30, 2019
@gazpachoking
Copy link
Member

I've added the base_path option to the wiki. Anyone should feel free to clarify or add notes there.

It would also be great if somebody running sonarr could test checking return codes from sonarr and displaying a proper error message to the user rather than just crashing.

@JourneyOver
Copy link
Contributor

JourneyOver commented Jan 30, 2019

I've added the base_path option to the wiki. Anyone should feel free to clarify or add notes there.

It would also be great if somebody running sonarr could test checking return codes from sonarr and displaying a proper error message to the user rather than just crashing.

funny thing is; is that I've tried doing curl commands to sonarr with and without the url base in the call, and whenever I leave out the url base it doesn't display anything. no return codes, no error messages, no nothing.. so idk how exactly we would go about setting up a proper error message for this..

Example with and without the url base being set in the curl command.
cjxfgki

@gazpachoking
Copy link
Member

I think you need extra options to get curl to write out status codes. Try adding -w '%{http_code}' to your curl command.

@JourneyOver
Copy link
Contributor

okay with url base in the curl command it comes out as 200, without the url base in the curl command it comes out as a 303 @gazpachoking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants