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.46k stars 305 forks source link

Bug: Crash when actor not found #340

Closed Alaksin closed 3 years ago

Alaksin commented 3 years ago

Describe the Bug Crash when actor is not found in Plex. I have some collections for bands that search on Band name and members. If a member is not found as an actor then the script crashes

Relevant Collection Config templates: Bands Auto: sync_mode: sync collection_order: release name_mapping: "- Bands/<>" plex_search: title: <>

collections: Thin Lizzy: template: name: Bands Auto actor:

Plex Meta Manager Info Version 1.11.3

Link to logs (required) https://gist.github.com/Alaksin/9af4df3c26a4d5b1ee107b0b54ac7bcd

Alaksin commented 3 years ago

The crashes occur with some other configs as well, and it causes some issues when using cross-library collections. For example in one library you want to have actor as the criteria and in another library you want to have both title and actor as the critera. If the crashes are avoided then it will be very easy to just have one definition for a collection that spans multiple libraries

meisnate12 commented 3 years ago

you need to make it a full plex_search and use validate: false

change this

templates:
  Bands Auto:
    sync_mode: sync
    collection_order: release
    name_mapping: "- Bands/<<collection_name>>"
    plex_search:
      title: <<collection_name>>
collections:
  Thin Lizzy:
    template:
      name: Bands Auto
    actor:
      - Phil Lynott
      - Brian Downey
      - Scott Gorham
      - Brian Robertson

to this

templates:
  Bands Auto:
    sync_mode: sync
    collection_order: release
    name_mapping: "- Bands/<<collection_name>>"
    plex_search:
      validate: false
      any:
        title: <<collection_name>>
        actor: <<members>>
collections:
  Thin Lizzy:
    template:
      name: Bands Auto
      members:
        - Phil Lynott
        - Brian Downey
        - Scott Gorham
        - Brian Robertson
Alaksin commented 3 years ago

Nice! I think I have missed out on the changes for a while. I do have another similar issue that the validate: false doesn't seem to fix. I have Director collections that also span across libraries. TV shows don't allow director in the search, but here it crashes even when validate is set to false.

templates:  
  Director:
    test: true
    sync_mode: sync
    collection_order: release
    tmdb_person: <<person>>
    sort_title: ΩΩ5 <<collection_name>>
    name_mapping: "- People/<<collection_name>>"
    plex_search:
      validate: false
      any:
        director: tmdb
        title: <<title>>

collections:
  Lars von Trier:
    template:
      name: Director
      person: 42
      title: Riget

  Oliver Stone:
    template:
      name: Director
      person: 1152
      title:
        - Untold History of the United States
        - Putin Interviews
Traceback (most recent call last):                                                                 
  File "//plex_meta_manager.py", line 423, in run_collection
    builder = CollectionBuilder(config, library, metadata, mapping_name, collection_attrs)
  File "/modules/builder.py", line 823, in __init__
    self.methods.append((method_name, [self.build_filter("plex_search", dict_data)]))
  File "/modules/builder.py", line 1315, in build_filter
    built_filter, filter_text = _filter(base_dict, is_all=base_all)
  File "/modules/builder.py", line 1248, in _filter
    raise Failed(f"Collection Error: {final} {method} attribute only works for movie libraries")
    modules.util.Failed: Collection Error: director plex_search attribute only works for movie libraries
Alaksin commented 3 years ago

It would be really cool to be able to specify different searches for different libraries. Something like this

templates:
  Director:
    sync_mode: sync
    collection_order: release
    tmdb_person: <<person>>
    sort_title: ΩΩ5 <<collection_name>>
    name_mapping: "- People/<<collection_name>>"
    libraries:
      Movies:
        plex_search:
        any:
          director: tmdb
      TV Shows:
       plex_search:
       any:
         title: <<title>>