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

KeyError causing script to throw exception when adding to radarr #7

Closed
doctarrwho opened this issue Feb 10, 2021 · 9 comments · Fixed by #14
Closed

KeyError causing script to throw exception when adding to radarr #7

doctarrwho opened this issue Feb 10, 2021 · 9 comments · Fixed by #14
Assignees
Labels
bug Bug is with Plex Meta Manager

Comments

@doctarrwho
Copy link

I filed the same issue for Plex-Auto-Collections yesterday, and looks like the same issue applies here: mza921/Plex-Auto-Collections#202

[2021-02-09 17:38:54,078] [config.py:938]             [INFO]     | * Trending on Trakt Collection | ? | Space Sweepers (TMDb: 581389)                                 |
[2021-02-09 17:38:54,136] [config.py:938]             [INFO]     | * Trending on Trakt Collection | ? | Bliss (TMDb: 613911)                                          |
[2021-02-09 17:38:54,191] [config.py:938]             [INFO]     | * Trending on Trakt Collection | ? | Below Zero (TMDb: 587996)                                     |
[2021-02-09 17:38:54,191] [config.py:941]             [INFO]     | 3 Movies Missing                                                                                   |
[2021-02-09 17:38:54,199] [radarr.py:42]              [INFO]     |                                                                                                    |
[2021-02-09 17:38:54,199] [radarr.py:43]              [DEBUG]    | TMDb IDs: [581389, 613911, 587996]                                                                 |
[2021-02-09 17:38:54,205] [util.py:575]               [DEBUG]    | Traceback (most recent call last):                                                                 |
                                                                 |   File "/modules/config.py", line 944, in update_libraries
                                                                 |     library.Radarr.add_tmdb(missing_movies)
                                                                 |   File "/modules/radarr.py", line 82, in add_tmdb
                                                                 |     logger.error("Radarr Error: ({}) {}: ({}) {}".format(tmdb_id, movie.title, response.status_code, response.json()[0]["errorMessage"]))
                                                                 | KeyError: 0
                                                                 | 
[2021-02-09 17:38:54,205] [config.py:1029]            [ERROR]    | Unknown Error: 0

Setting add_to_arr to false bypasses the error.

@meisnate12 meisnate12 self-assigned this Feb 10, 2021
@meisnate12 meisnate12 added the bug Bug is with Plex Meta Manager label Feb 10, 2021
@meisnate12
Copy link
Member

can you switch to the develop branch and then run it again and post your log?

@doctarrwho
Copy link
Author

In develop, modules/util.py is missing a comma.

  File "/mnt/c/Plex-Meta-Manager/modules/util.py", line 1
    import datetime logging, re, signal, sys, time, traceback
                    ^
SyntaxError: invalid syntax

After fixing that, here's the log...

[2021-02-10 22:23:55,775] [util.py:618]               [INFO]     |====================================================================================================|
[2021-02-10 22:23:55,775] [util.py:620]               [INFO]     |                                   * Trending on Trakt Collection                                   |
[2021-02-10 22:23:55,776] [util.py:621]               [INFO]     |====================================================================================================|
[2021-02-10 22:23:55,776] [config.py:410]             [INFO]     |                                                                                                    |
[2021-02-10 22:23:55,790] [config.py:492]             [INFO]     | Sync Mode: sync                                                                                    |
[2021-02-10 22:23:55,959] [config.py:536]             [DEBUG]    | Method: sort_title                                                                                 |
[2021-02-10 22:23:55,960] [config.py:537]             [DEBUG]    | Value: *100                                                                                        |
[2021-02-10 22:23:55,960] [config.py:536]             [DEBUG]    | Method: trakt_trending                                                                             |
[2021-02-10 22:23:55,961] [config.py:537]             [DEBUG]    | Value: 25                                                                                          |
[2021-02-10 22:23:55,962] [config.py:536]             [DEBUG]    | Method: sync_mode                                                                                  |
[2021-02-10 22:23:55,963] [config.py:537]             [DEBUG]    | Value: sync                                                                                        |
[2021-02-10 22:23:55,963] [config.py:536]             [DEBUG]    | Method: add_to_arr                                                                                 |
[2021-02-10 22:23:55,964] [config.py:537]             [DEBUG]    | Value: True                                                                                        |
[2021-02-10 22:23:55,965] [config.py:536]             [DEBUG]    | Method: trakt_list                                                                                 |
[2021-02-10 22:23:55,965] [config.py:537]             [DEBUG]    | Value: ['https://trakt.tv/users/giladg/lists/top-10-movies-of-the-week?sort=added,asc']            |
[2021-02-10 22:23:56,126] [config.py:848]             [DEBUG]    | Method: trakt_trending                                                                             |
[2021-02-10 22:23:56,127] [config.py:849]             [DEBUG]    | Values: [25]                                                                                       |
[2021-02-10 22:23:56,127] [config.py:852]             [DEBUG]    | Value: 25                                                                                          |
[2021-02-10 22:23:56,128] [config.py:870]             [INFO]     |                                                                                                    |
[2021-02-10 22:23:56,129] [trakt.py:139]              [DEBUG]    | Data: 25                                                                                           |
[2021-02-10 22:23:56,284] [trakt.py:145]              [INFO]     | Processing Trakt Trending: 25 Movies                                                               |
[2021-02-10 22:23:56,285] [trakt.py:158]              [DEBUG]    | Trakt Movie Found: [<Movie 'The Little Things' (2021)>, <Movie 'Bliss' (2021)>, <Movie 'Tenet' (2020)>, <Movie 'Space Sweepers' (2021)>, <Movie 'Palmer' (2021)>, <Movie 'News of the World' (2020)>, <Movie 'Framing Britney Spears' (2021)>, <Movie 'Godzilla: King of the Monsters' (2019)>, <Movie 'The Lord of the Rings: The Two Towers' (2002)>, <Movie 'Wonder Woman 1984' (2020)>, <Movie 'Promising Young Woman' (2020)>, <Movie 'Avengers: Age of Ultron' (2015)>, <Movie 'Harry Potter and the Half-Blood Prince' (2009)>, <Movie 'Greenland' (2020)>, <Movie 'The Croods: A New Age' (2020)>, <Movie 'The Lord of the Rings: The Fellowship of the Ring' (2001)>, <Movie 'Avengers: Endgame' (2019)>, <Movie 'Wolfwalkers' (2020)>, <Movie 'Below Zero' (2021)>, <Movie 'Breach' (2020)>, <Movie 'A Glitch in the Matrix' (2021)>, <Movie 'Doctor Strange' (2016)>, <Movie 'Guardians of the Galaxy Vol. 2' (2017)>, <Movie 'Ready Player One' (2018)>, <Movie 'Ant-Man and the Wasp' (2018)>] |
[2021-02-10 22:23:56,286] [trakt.py:159]              [DEBUG]    | TMDb IDs Found: [602269, 613911, 577922, 581389, 458220, 581032, 792653, 373571, 121, 464052, 582014, 99861, 767, 524047, 529203, 120, 299534, 441130, 587996, 651571, 696109, 284052, 283995, 333339, 363088] |
[2021-02-10 22:23:56,286] [trakt.py:160]              [DEBUG]    | TVDb IDs Found: []                                                                                 |
[2021-02-10 22:23:56,475] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | The Little Things                                             |
[2021-02-10 22:23:56,498] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | Tenet                                                         |
[2021-02-10 22:23:56,515] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | Palmer                                                        |
[2021-02-10 22:23:56,530] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | News of the World                                             |
[2021-02-10 22:23:56,564] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | Godzilla: King of the Monsters                                |
[2021-02-10 22:23:56,606] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | The Lord of the Rings: The Two Towers                         |
[2021-02-10 22:23:56,641] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | Wonder Woman 1984                                             |
[2021-02-10 22:23:56,659] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | Promising Young Woman                                         |
[2021-02-10 22:23:56,688] [util.py:630]               [INFO]     | * Trending on Trakt Collection | + | Avengers: Age of Ultron                                       |
[2021-02-10 22:23:56,823] [util.py:630]               [INFO]     | * Trending on Trakt Collection | + | Harry Potter and the Half-Blood Prince                        |
[2021-02-10 22:23:56,960] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | Greenland                                                     |
[2021-02-10 22:23:56,977] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | The Croods: A New Age                                         |
[2021-02-10 22:23:57,007] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | The Lord of the Rings: The Fellowship of the Ring             |
[2021-02-10 22:23:57,034] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | Avengers: Endgame                                             |
[2021-02-10 22:23:57,051] [util.py:630]               [INFO]     | * Trending on Trakt Collection | + | Wolfwalkers                                                   |
[2021-02-10 22:23:57,175] [util.py:630]               [INFO]     | * Trending on Trakt Collection | + | Breach                                                        |
[2021-02-10 22:23:57,303] [util.py:630]               [INFO]     | * Trending on Trakt Collection | + | Doctor Strange                                                |
[2021-02-10 22:23:57,433] [util.py:630]               [INFO]     | * Trending on Trakt Collection | + | Guardians of the Galaxy Vol. 2                                |
[2021-02-10 22:23:57,578] [util.py:630]               [INFO]     | * Trending on Trakt Collection | + | Ready Player One                                              |
[2021-02-10 22:23:57,722] [util.py:630]               [INFO]     | * Trending on Trakt Collection | + | Ant-Man and the Wasp                                          |
[2021-02-10 22:23:57,829] [util.py:630]               [INFO]     | 20 Movies Processed                                                                                |
[2021-02-10 22:23:57,830] [config.py:936]             [INFO]     |                                                                                                    |
[2021-02-10 22:23:57,959] [config.py:943]             [INFO]     | * Trending on Trakt Collection | ? | Bliss (TMDb: 613911)                                          |
[2021-02-10 22:23:58,059] [config.py:943]             [INFO]     | * Trending on Trakt Collection | ? | Space Sweepers (TMDb: 581389)                                 |
[2021-02-10 22:23:58,120] [config.py:945]             [ERROR]    | TMDb Error: No Movie found for TMDb ID 792653: The resource you requested could not be found.      |
[2021-02-10 22:23:58,198] [config.py:943]             [INFO]     | * Trending on Trakt Collection | ? | Below Zero (TMDb: 587996)                                     |
[2021-02-10 22:23:58,279] [config.py:943]             [INFO]     | * Trending on Trakt Collection | ? | A Glitch in the Matrix (TMDb: 696109)                         |
[2021-02-10 22:23:58,280] [config.py:946]             [INFO]     | 5 Movies Missing                                                                                   |
[2021-02-10 22:23:58,373] [radarr.py:42]              [INFO]     |                                                                                                    |
[2021-02-10 22:23:58,374] [radarr.py:43]              [DEBUG]    | TMDb IDs: [613911, 581389, 792653, 587996, 696109]                                                 |
[2021-02-10 22:23:58,388] [radarr.py:85]              [DEBUG]    | {'title': 'Bliss', 'qualityProfileId': 6, 'year': 2021, 'tmdbid': '613911', 'titleslug': 'bliss-2021', 'monitored': True, 'rootFolderPath': '/media/Movies/HD', 'images': [{'covertype': 'poster', 'url': 'https://image.tmdb.org/t/p/original/b7BllsQkD6nTkAdtd28UVCmKqVi.jpg'}], 'addOptions': {'searchForMovie': True}} |
[2021-02-10 22:23:58,389] [radarr.py:86]              [DEBUG]    | <Response [400]>                                                                                   |
[2021-02-10 22:23:58,389] [radarr.py:87]              [DEBUG]    | 400                                                                                                |
[2021-02-10 22:23:58,390] [radarr.py:88]              [DEBUG]    | {'message': 'BadRequest: Invalid request body. The JSON value could not be converted to System.Int32. Path: $.tmdbid | LineNumber: 0 | BytePositionInLine: 74.', 'content': 'Invalid request body. The JSON value could not be converted to System.Int32. Path: $.tmdbid | LineNumber: 0 | BytePositionInLine: 74.'} |
[2021-02-10 22:23:58,403] [radarr.py:85]              [DEBUG]    | {'title': 'Space Sweepers', 'qualityProfileId': 6, 'year': 2021, 'tmdbid': '581389', 'titleslug': 'space-sweepers-2021', 'monitored': True, 'rootFolderPath': '/media/Movies/HD', 'images': [{'covertype': 'poster', 'url': 'https://image.tmdb.org/t/p/original/bmemsraCG1kIthY74NjDnnLRT2Q.jpg'}], 'addOptions': {'searchForMovie': True}} |
[2021-02-10 22:23:58,403] [radarr.py:86]              [DEBUG]    | <Response [400]>                                                                                   |
[2021-02-10 22:23:58,404] [radarr.py:87]              [DEBUG]    | 400                                                                                                |
[2021-02-10 22:23:58,405] [radarr.py:88]              [DEBUG]    | {'message': 'BadRequest: Invalid request body. The JSON value could not be converted to System.Int32. Path: $.tmdbid | LineNumber: 0 | BytePositionInLine: 83.', 'content': 'Invalid request body. The JSON value could not be converted to System.Int32. Path: $.tmdbid | LineNumber: 0 | BytePositionInLine: 83.'} |
[2021-02-10 22:23:58,406] [radarr.py:49]              [ERROR]    | TMDb Error: No Movie found for TMDb ID 792653: The resource you requested could not be found.      |
[2021-02-10 22:23:58,417] [radarr.py:85]              [DEBUG]    | {'title': 'Below Zero', 'qualityProfileId': 6, 'year': 2021, 'tmdbid': '587996', 'titleslug': 'below-zero-2021', 'monitored': True, 'rootFolderPath': '/media/Movies/HD', 'images': [{'covertype': 'poster', 'url': 'https://image.tmdb.org/t/p/original/dWSnsAGTfc8U27bWsy2RfwZs0Bs.jpg'}], 'addOptions': {'searchForMovie': True}} |
[2021-02-10 22:23:58,418] [radarr.py:86]              [DEBUG]    | <Response [400]>                                                                                   |
[2021-02-10 22:23:58,418] [radarr.py:87]              [DEBUG]    | 400                                                                                                |
[2021-02-10 22:23:58,419] [radarr.py:88]              [DEBUG]    | {'message': 'BadRequest: Invalid request body. The JSON value could not be converted to System.Int32. Path: $.tmdbid | LineNumber: 0 | BytePositionInLine: 79.', 'content': 'Invalid request body. The JSON value could not be converted to System.Int32. Path: $.tmdbid | LineNumber: 0 | BytePositionInLine: 79.'} |
[2021-02-10 22:23:58,430] [radarr.py:85]              [DEBUG]    | {'title': 'A Glitch in the Matrix', 'qualityProfileId': 6, 'year': 2021, 'tmdbid': '696109', 'titleslug': 'a-glitch-in-the-matrix-2021', 'monitored': True, 'rootFolderPath': '/media/Movies/HD', 'images': [{'covertype': 'poster', 'url': 'https://image.tmdb.org/t/p/original/bn0BLVadmvzq6MmJ0n97MLxGpNQ.jpg'}], 'addOptions': {'searchForMovie': True}} |
[2021-02-10 22:23:58,431] [radarr.py:86]              [DEBUG]    | <Response [400]>                                                                                   |
[2021-02-10 22:23:58,432] [radarr.py:87]              [DEBUG]    | 400                                                                                                |
[2021-02-10 22:23:58,432] [radarr.py:88]              [DEBUG]    | {'message': 'BadRequest: Invalid request body. The JSON value could not be converted to System.Int32. Path: $.tmdbid | LineNumber: 0 | BytePositionInLine: 91.', 'content': 'Invalid request body. The JSON value could not be converted to System.Int32. Path: $.tmdbid | LineNumber: 0 | BytePositionInLine: 91.'} |
[2021-02-10 22:23:58,433] [radarr.py:89]              [INFO]     | 0 Movie added to Radarr                                                                            |
[2021-02-10 22:23:58,434] [config.py:848]             [DEBUG]    | Method: trakt_list                                                                                 |
[2021-02-10 22:23:58,434] [config.py:849]             [DEBUG]    | Values: ['https://trakt.tv/users/giladg/lists/top-10-movies-of-the-week?sort=added,asc']           |
[2021-02-10 22:23:58,435] [config.py:852]             [DEBUG]    | Value: https://trakt.tv/users/giladg/lists/top-10-movies-of-the-week?sort=added,asc                |
[2021-02-10 22:23:58,435] [config.py:870]             [INFO]     |                                                                                                    |
[2021-02-10 22:23:58,436] [trakt.py:139]              [DEBUG]    | Data: https://trakt.tv/users/giladg/lists/top-10-movies-of-the-week?sort=added,asc                 |
[2021-02-10 22:23:58,501] [trakt.py:150]              [INFO]     | Processing Trakt List: https://trakt.tv/users/giladg/lists/top-10-movies-of-the-week?sort=added,asc |
[2021-02-10 22:23:58,502] [trakt.py:158]              [DEBUG]    | Trakt Movie Found: [<Movie 'Greenland' (2020)>, <Movie 'Promising Young Woman' (2020)>, <Movie 'The Croods: A New Age' (2020)>, <Movie 'Synchronic' (2020)>, <Movie 'Run Hide Fight' (2021)>, <Movie 'Soul' (2020)>, <Movie 'Wonder Woman 1984' (2020)>, <Movie 'Outside the Wire' (2021)>, <Movie 'News of the World' (2020)>, <Movie 'Tenet' (2020)>] |
[2021-02-10 22:23:58,503] [trakt.py:159]              [DEBUG]    | TMDb IDs Found: [524047, 582014, 529203, 549294, 629017, 508442, 464052, 775996, 581032, 577922]   |
[2021-02-10 22:23:58,504] [trakt.py:160]              [DEBUG]    | TVDb IDs Found: []                                                                                 |
[2021-02-10 22:23:58,729] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | Greenland                                                     |
[2021-02-10 22:23:58,756] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | Promising Young Woman                                         |
[2021-02-10 22:23:58,773] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | The Croods: A New Age                                         |
[2021-02-10 22:23:58,789] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | Synchronic                                                    |
[2021-02-10 22:23:58,802] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | Run Hide Fight                                                |
[2021-02-10 22:23:58,817] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | Soul                                                          |
[2021-02-10 22:23:58,848] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | Wonder Woman 1984                                             |
[2021-02-10 22:23:58,863] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | Outside the Wire                                              |
[2021-02-10 22:23:58,879] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | News of the World                                             |
[2021-02-10 22:23:58,899] [util.py:630]               [INFO]     | * Trending on Trakt Collection | = | Tenet                                                         |
[2021-02-10 22:23:58,900] [util.py:630]               [INFO]     | 10 Movies Processed                                                                                |
[2021-02-10 22:23:58,990] [config.py:967]             [INFO]     |                                                                                                    |
[2021-02-10 22:23:58,990] [config.py:971]             [INFO]     | * Trending on Trakt Collection | - | Harry Potter and the Chamber of Secrets                       |
[2021-02-10 22:23:59,100] [config.py:971]             [INFO]     | * Trending on Trakt Collection | - | Moana                                                         |
[2021-02-10 22:23:59,206] [config.py:971]             [INFO]     | * Trending on Trakt Collection | - | John Wick: Chapter 2                                          |
[2021-02-10 22:23:59,326] [config.py:971]             [INFO]     | * Trending on Trakt Collection | - | Spider-Man: Homecoming                                        |
[2021-02-10 22:23:59,438] [config.py:971]             [INFO]     | * Trending on Trakt Collection | - | Thor: Ragnarok                                                |
[2021-02-10 22:23:59,560] [config.py:971]             [INFO]     | * Trending on Trakt Collection | - | Avengers: Infinity War                                        |
[2021-02-10 22:23:59,667] [config.py:971]             [INFO]     | * Trending on Trakt Collection | - | Bad Boys for Life                                             |
[2021-02-10 22:23:59,775] [config.py:971]             [INFO]     | * Trending on Trakt Collection | - | Shadow in the Cloud                                           |
[2021-02-10 22:23:59,913] [config.py:971]             [INFO]     | * Trending on Trakt Collection | - | The Dig                                                       |
[2021-02-10 22:24:00,021] [config.py:974]             [INFO]     | 9 Movie Removed                                                                                    |
[2021-02-10 22:24:00,022] [config.py:975]             [INFO]     |                                                                                                    |
[2021-02-10 22:24:00,033] [config.py:994]             [DEBUG]    | {'titleSort.value': '*100', 'titleSort.locked': 1}                                                 |
[2021-02-10 22:24:00,058] [config.py:997]             [INFO]     | Details: have been updated

Also, could I suggest changing this log entry in config.py to debug? It'll reduce noise in the log.

                for col in library.get_all_collections():
                     if col.title not in collections_in_plex:
                         logger.info(col.title)
                         unmanaged_count += 1

meisnate12 added a commit that referenced this issue Feb 11, 2021
@meisnate12
Copy link
Member

grab my latest changes to the develop branch and try again I think I fixed it

also, I added in the unmanaged collections section so I could tell when new collections get added automatically so I have no plans to change that to info, but if you want I can add in an option so you can turn off that output if you so choose

@doctarrwho
Copy link
Author

That was fast! I tested it and it fixed it.

I'd love that option, I have 450+ collections that plex created that show up under Unmanaged in the log after each run, and I'd rather not see those but the ability to turn that on would be nice.

@meisnate12
Copy link
Member

ok pull from develop again and you should be able to add show_unmanaged_collections: false under the plex attribute to turn that output off

@doctarrwho
Copy link
Author

Awesome, thanks!

@doctarrwho
Copy link
Author

Unrelated question, is there an option somewhere to filter out movies based on language? For example, trakt trending adds this movie to Radarr. I'd like to exclude non-english movies. I've tried using audio_language filter with value en, but that doesn't work. If this isn't currently possible, I could submit a feature request.

@meisnate12
Copy link
Member

its currently not possible the collection filter audio_language is only for media already in your library. Go ahead and make a new Request for that one as it won't be in my next update and I'll want to close this request

@doctarrwho
Copy link
Author

Thanks for confirmation. No rush on the feature request, just wanted to make sure I wasn't missing something obvious.

@meisnate12 meisnate12 mentioned this issue Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug is with Plex Meta Manager
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants