Kometa-Team / Kometa

Python script to update metadata information for items in plex as well as automatically build collections and playlists. The Wiki Documentation is linked below.
https://kometa.wiki
MIT License
2.43k stars 302 forks source link

[Defaults]: Tautulli "Plex Popular" default fails with Unknown Error. #1590

Closed TheChrisK closed 11 months ago

TheChrisK commented 1 year ago

Link to File

tautulli

Version Number

1.19.0

What branch are you on?

master

Describe the Bug

Tautulli default fails on one of my libraries. My primary Movies library. I ran it on a "Family" library which also contains movies and it works fine. Connection to Tautulli is successful but I recieve the following error:

[2023-09-06 19:40:37,680] [tautulli.py:28]            [INFO]     | Processing Tautulli Most Popular: 30 Movies                                                        |
[2023-09-06 19:40:37,786] [connectionpool.py:456]     [DEBUG]    | http://10.252.20.15:8181 "GET /api/v2?apikey=(redacted)&cmd=get_home_stats&time_range=30&stats_count=50 HTTP/1.1" 200 12182 |
[2023-09-06 19:40:37,795] [connectionpool.py:456]     [DEBUG]    | http://10.252.20.14:32400 "GET /library/metadata/41481 HTTP/1.1" 200 1810                          |
[2023-09-06 19:40:37,803] [connectionpool.py:456]     [DEBUG]    | http://10.252.20.14:32400 "GET /library/metadata/41481?includePreferences=1 HTTP/1.1" 200 1810     |
[2023-09-06 19:40:38,956] [connectionpool.py:456]     [DEBUG]    | https://notifiarr.com:443 "GET /api/v1/notification/pmm/ HTTP/1.1" 200 None                        |
[2023-09-06 19:40:38,958] [plex_meta_manager.py:833]  [DEBUG]    | Traceback (most recent call last):                                                                 |
                                                                 |   File "//plex_meta_manager.py", line 719, in run_collection                                       |
                                                                 |     builder.filter_and_save_items(builder.gather_ids(method, value))                               |
                                                                 |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                |
                                                                 |   File "/modules/builder.py", line 1807, in gather_ids                                             |
                                                                 |     ids = self.library.Tautulli.get_rating_keys(value, self.playlist)                              |
                                                                 |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                              |
                                                                 |   File "/modules/tautulli.py", line 50, in get_rating_keys                                         |
                                                                 |     raise BadRequest                                                                               |
                                                                 | plexapi.exceptions.BadRequest     
                                                                 |                                                                                                    |
[2023-09-06 19:40:38,959] [plex_meta_manager.py:834]  [ERROR]    | Unknown Error:

The config.yml section for this library is as follows:

#MAIN MOVIE LIBRARY CONFIG
  Movies:
    report_path: config/missing/Movies_report.yml
    template_variables:
      use_separator: false
    metadata_path:
    - folder: config/Movies/
    - pmm: imdb
      template_variables:
        use_lowest: false
        order_top: 2
        order_popular: 2
    - pmm: trakt
      template_variables:
        use_collected: false
        use_recommended: false
        order_popular: 3
        order_trending: 3
        order_watched: 3
    - pmm: tautulli
      template_variables:
        use_watched: false
        list_days: 30
        list_size: 30
        summary_popular: A collection of the most watched movies on this Plex server.
        order_popular: 1
    - pmm: genre
      template_variables:
        sort_by: title.asc
        exclude:
        - Horror
        - War
        - Western
        - Spy
        - Sport
        - Suspense
        - Musical
        - Indie
        - Biopic
        - Martial Arts
      minimum_items: 10
    - pmm: decade
      template_variables:
        exclude:
        - 1960
        limit: 100
        limit_1970: 25
        summary_format: Top <<limit>> movies of the <<key>>s. Sorted by critic rating.
        summary_1970: Top <<limit_1970>> movies of the <<key>>s. Sorted by critic
          rating.
        minimum_items: 25
    - pmm: universe
      template_variables:
        trakt_list_mcu: https://trakt.tv/users/donxy/lists/marvel-cinematic-universe
        trakt_list_dcu: https://trakt.tv/users/lampshadetricky/lists/dc-extended-universe
        trakt_list_trek: https://trakt.tv/users/thechrisk/lists/star-trek
        trakt_list_avp: https://trakt.tv/users/thechrisk/lists/alien-predator
        minimum_items: 3
        append_data:
          star: Star Wars Saga
          trek: Star Trek Universe
          xmen: X-Men Collection
        exclude:
        - marvel
        - rocky
        collection_section: '106'
    - pmm: seasonal
      template_variables:
        emoji: ''
        schedule_independence: range(06/28-07/05)
        schedule_labor: range(09/01-09/05)
        exclude:
        - christmas
        - halloween

    overlay_path:
    - schedule: weekly(tuesday)
    - remove_overlays: false
    - file: config/overlays/Top.yml

    operations:
      schedule: weekly(monday)
      mass_genre_update: tmdb
      mass_audience_rating_update: imdb
      mass_critic_rating_update: mdb_tomatoes
      mass_user_rating_update: mdb

Docker command:

docker run --name PMM --rm -it -e TZ=America/Chicago -v "/plex-meta-manager:/config:rw" meisnate12/plex-meta-manager:latest -rl Movies -rm tautulli -lr

Troubleshooting steps:

  1. Changed limit_days and limit_size to smaller values.
  2. Restarted Tautulli
  3. Changed PMM branches, fails on latest, develop and nightly
  4. Error states "playlist" in the text. Removed recently created Plex playlist but same error occurs.
YozoraXCII commented 1 year ago

Can you confirm if this behaviour is repeatable in the nightly branch?

TheChrisK commented 1 year ago

Yes it fails on all branches

blazedsonic commented 1 year ago

Yes it fails on all branches

Can confirm that Plex Popular/Most Watched fails for latest branch; only for Movie library and spits out "unknown error". Plex collections populate for TV Shows with no issues. I only run the "- pmm: tautulli" command with no other attributes.

TheChrisK commented 1 year ago

Ok I may have found the issue. It's related to mismatched rating_keys on Tautulli and not necessarily a problem with PMM.

Activity before issue began:

Recent discovery in Tautulli:

Conclusion:

After fixing several mismatched titles, I ran PMM for just the 'tautulli' default and it was successful.

blazedsonic commented 11 months ago

Ok I may have found the issue. It's related to mismatched rating_keys on Tautulli and not necessarily a problem with PMM.

Activity before issue began:

* Recently moved Plex to a new server where a GPU was installed for HW transcoding.

* Backup and restore was successful but some recently added items needed to be re-scanned

Recent discovery in Tautulli:

* Tautulli was not moved or changed in any way however, some history items were showing the wrong title or even items from a different library.

* Fix Match was completed on several items which updated the rating_key as described in the Tautulli help docs.

* Some items are still incorrect but "Fix Match" is not an option.

Conclusion:

After fixing several mismatched titles, I ran PMM for just the 'tautulli' default and it was successful.

I went through my Tautulli history for my Movies library and found 2 movies mismatched. I fixed the match for both of these items. I ran "- pmm: tautulli" and the Plex Popular/Watched collections populated.

This can be closed and marked as solved as its a Tautulli database issue.