Coder Social home page Coder Social logo

kometa-team / kometa Goto Github PK

View Code? Open in Web Editor NEW
2.3K 36.0 296.0 200 MB

Python script to update metadata information for items in plex as well as automatically build collections and playlists. The Wiki Documentation is linked below.

Home Page: https://kometa.wiki

License: MIT License

Dockerfile 0.08% Python 99.92%

kometa's Introduction

Kometa

GitHub release (latest by date) Docker Image Version (latest semver) Docker Pulls Develop GitHub commits since latest stable release (by SemVer) Nightly GitHub commits since latest stable release (by SemVer)

Discord Reddit Wiki Translations GitHub Sponsors Sponsor or Donate Feature Requests

Kometa is a powerful tool designed to give you complete control over your media libraries. With Kometa, you can take your customization to the next level, with granular control over metadata, collections, overlays, and much more.

Transform your media library with Kometa and discover its full potential! Connect to third-party services like TMDb, Trakt, and IMDb, among others, to create one-of-a-kind collections, overlays and more. Your media library will stand out and be tailored to your specific needs.

What Can Kometa Do?

Overhaul Your Media Libraries

  • Elevate your library with beautifully crafted metadata - customize artwork, titles, summaries, and more to create a stunning library.

Kometa Defaults

  • Take advantage of pre-made modular Collections & Overlays to reduce the manual effort and get to the good stuff with less effort!

Third-Party Integrations

  • Harness the power of Trakt, TMDb, IMDb and more to create collections and overlays!
  • Integrate with Sonarr and Radarr to automate your library growth.

And More!

  • We're constantly working on new features to take your library management experience to the next level.
  • Consider sponsoring the project to allow us to continue building great features for you!

Demo Video

The below YouTube video has been created by one of our community members to showcase some of the things that Kometa can do for you.

Kometa

Example Kometa Libraries

Here are some examples of the things you can achieve using Kometa!

Example Movie Collections using the Kometa Defaults (click to enlarge):

Movie Collection Preview

Example Show Overlays using the Kometa Defaults (click to enlarge):

Show Library Preview

Kometa Defaults

Want your library to look like the above images? With the Kometa Defaults you can! These powerful and modular files were designed by the Kometa team to make it simple to create a personalized, one-of-a-kind media collection without the hassle of manually defining each one.

Want to see what the community has to offer? Check out the Kometa Community Configs repository on GitHub to see user-submitted configuration files, or even add your own to the mix!

With Kometa, you can also manage metadata for all your media types, from movies and shows to music and more. And since your metadata is managed outside your libraries, you'll never have to worry about losing your customizations in the event of a media server database loss, you can simply reapply them! It is also easy to move your customizations between servers if you need to.

Getting Started

To get started with Kometa, follow these simple steps:

  1. Install Kometa on your device. You can find the installation instructions for a variety of platforms here.

  2. Once you have installed Kometa, create your Configuration File. This file contains important information such as URLs and credentials needed to connect to services like Plex and TMDb

  3. After creating the Configuration File, you can start updating Metadata and building automatic Collections by creating a Collection File for each Library you want to work with. If you'd rather use some of our pre-made Collection Files, take a look at the Kometa Defaults

  4. Finally, check out the Wiki, you'll find new and exciting ways to truly unlock the potential of your libraries.

Step-by-Step Guides

If you're a beginner to the concepts of Python, Git and/or Kometa and find the above steps challenging, don't worry. We've got some step-by-step guides that can help you get started. These guides will take you through the process of installing Kometa, creating your Configuration File and getting some basic Collections up and running.

For those who need full installation walkthroughs, please refer to the following walkthrough guides:

If you are using unRAID, Kubernetes, QNAP, or Synology refer to the following basic guide to Docker container setup for each system:

this doesn't cover the Kometa setup specifics found in the guides above with regard to creating the config file and collection file, so you may want to go through the Docker Walkthrough first on your computer to gain that understanding.

Example Usage

Kometa puts you in control of your media library by letting you create custom Collections that make discovering and organizing your content a breeze. With powerful search and filtering options, you can build Collections based on popular builders like TMDb, IMDb, Trakt, and many more.

Imagine having Collections like these at your fingertips:

  • Trending and Popular (based on TMDb, IMDb, Trakt, etc.)
  • Streaming Services (like Netflix, Disney+, and more)
  • Networks
  • Studios
  • Genres
  • Actors
  • Decades

Kometa gives you endless possibilities to curate and organize your media library any way you want. Create custom Collections and Overlays that fit your unique preferences and make discovering your content effortless.

But if you don't want to spend time manually creating Collections and Overlays, we've got you covered. Check out the Kometa Defaults - a handcrafted selection of tried-and-tested Collections and Overlays made by the Kometa team.

Develop & Nightly Branches

The Develop and Nightly branches are "beta" versions of Kometa that are updated more frequently than the stable version (Master branch). These branches are where bug fixes, new features, and other changes are added before being released to the Master branch.

However, these branches (especially Nightly) are recommended for more technical users who don't mind updating frequently to get the latest changes. Keep in mind that these beta branches may have bugs or other issues that could cause problems with Kometa or your media server. So, if you're not comfortable with technical issues, it's best to stick with the Master branch.

Develop Branch (click to expand)

Develop GitHub commits since latest stable release (by SemVer)

The develop branch has the most updated documented fixes and enhancements to Kometa. This version is tested and documented to some degree, but it is still an active Develop branch, so there may be rough edges.

Switching to develop:

Add ":develop" to the image name in your run command or configuration:
```
kometateam/kometa:develop
```
In the directory where you cloned Kometa:
```bash
git checkout develop
```
To switch back:
```bash
git checkout master
```

If switching to the develop branch, it is recommended to also use the develop branch of the wiki, which documents any changes made from the Master branch.


Nightly Branch (click to expand)

Nightly GitHub commits since latest stable release (by SemVer)

This branch will have squashed commits which can cause git pull/git fetch to error you can use git reset origin/nightly --hard to fix the branch.

There is also a nightly branch which will have the absolute latest version of the script, but it could easily break, there is no guarantee that it even works, and any new features will not be documented until they have progressed enough to reach the develop branch.

Switching to nightly:

Add ":nightly" to the image name in your run command or configuration:
```
kometateam/kometa:nightly
```
In the directory where you cloned Kometa:
```bash
git checkout nightly
```
To switch back:
```bash
git checkout master
```

As this branch is subject to extreme change, there is no promise of the feature being documented in the nightly branch of the wiki and all discussions relating to changes made in the nightly branch will be held within the Kometa Discord Server.

Discord Support Server

If you're looking for support for any questions or issues you might have, or if you just want to be a part of our growing community, Join the Kometa Discord Server.

Feature Requests

At Kometa, we value our community's input and actively seek feedback to drive the evolution of our product. We want to hear your ideas on how to enhance Kometa, and we encourage you to visit our Feature Request page to share your thoughts or vote on what features you would like to see added next. Your voice matters and helps shape the future of Kometa, so please don't hesitate to join in the conversation and be a part of our community-driven development process.

Errors and Configuration Questions

If you're having trouble, we recommend first joining the Kometa Discord Server and seeking support there. If that isn't possible for you, here's what you can do:

  • If you get an error, update to the latest version and check if the issue persists. If it does, report the bug by filling out the Bug Report template.
  • If you spot a mistake or have an idea to improve the Kometa Wiki, submit a request using the Wiki Request template.
  • If you have a question about metadata configuration, start a discussion on the Discussions. Remember, the community helps shape the future of Kometa, so your input is valuable!

For support on any of the above, visit the Discord server.

Contributing

  • Pull Requests are greatly encouraged, please submit all Pull Requests to the nightly branch.

kometa's People

Contributors

adam-pope-arup avatar axsuul avatar bakerboy448 avatar bruvv avatar bullmoose20 avatar chazlarson avatar cpt-kuesel avatar dalepmay7 avatar deejayexe avatar dependabot[bot] avatar didyouexpectthat avatar festivekyle avatar frazzer951 avatar huntedhawk avatar johnfawkes avatar jz1 avatar kevbentz avatar kevin2kkelly avatar linaspurinis avatar meisnate12 avatar omahs avatar ramshackles avatar saltydk avatar sysmoon14 avatar techdiver avatar tenshiak avatar thespoon98 avatar ymendel avatar yozoraxcii avatar zarox-things avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kometa's Issues

Max retries exceeded with url

After running this on a very large library and using the example from https://github.com/meisnate12/Plex-Meta-Manager-Configs/blob/master/meisnate12/Movies.yml it almost finished and errored with the following message.

| Processing: 5232/22439 The Damned: Don't You Wish That We Were Dea| Processing: 5233/22439 Damsel | Unknown Error: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) | | | |====================================================================================================| | Unmanaged Collections in Movies Library | |====================================================================================================| | | | HTTPConnectionPool(host='server', port=42400): Max retries exceeded with url: /library/sections/1/all?type=18&X-Plex-Container-Start=0&X-Plex-Container-Size=100 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f298d0e6760>: Failed to establish a new connection: [Errno 111] Connection refused')) | | | |====================================================================================================|

Docker run command
docker run -it -v "/hdd/1tb1ssd/data/docker/plex-meta-manager/config:/config" meisnate12/plex-meta-manager --config /config/config.yml --run

The server is hosted in the cloud.

Tautulli Popular error when Plex has music

I noticed an error when creating the Plex Popular collection using tautulli, I think it is due to having music in my library.
I only have movie in my config.yml so I'm not sure why tautulli picks up music as well.

Config.yml

libraries:
  Movies:
    library_type: movie

Movies.yml

templates:
  Chart Alpha:
    sort_title: ++++_<<num>><<collection_name>>
    sync_mode: sync
    collection_order: alpha

  Plex Popular:
    template: {name: Chart Alpha, num: 1}
    tautulli_popular:
      list_days: 30
      list_size: 20
      list_buffer: 20
    tautulli_watched:
      list_days: 30
      list_size: 20
      list_buffer: 20
    summary: Movies Popular on Plex

Error logs:

[2021-02-24 00:30:12,534] [util.py:637]               [INFO]     |====================================================================================================|
[2021-02-24 00:30:12,534] [util.py:639]               [INFO]     |                                      Plex Popular Collection                                       |
[2021-02-24 00:30:12,534] [util.py:640]               [INFO]     |====================================================================================================|
[2021-02-24 00:30:12,534] [config.py:370]             [INFO]     |                                                                                                    |
[2021-02-24 00:30:12,534] [builder.py:167]            [INFO]     | Scanning Plex Popular Collection                                                                   |
[2021-02-24 00:30:12,534] [builder.py:199]            [DEBUG]    |                                                                                                    |
[2021-02-24 00:30:12,534] [builder.py:200]            [DEBUG]    | Method: template                                                                                   |
[2021-02-24 00:30:12,534] [builder.py:201]            [DEBUG]    | Value: ordereddict([('name', 'Chart Alpha'), ('num', 1)])                                          |
[2021-02-24 00:30:12,535] [builder.py:199]            [DEBUG]    |                                                                                                    |
[2021-02-24 00:30:12,535] [builder.py:200]            [DEBUG]    | Method: tautulli_popular                                                                           |
[2021-02-24 00:30:12,535] [builder.py:201]            [DEBUG]    | Value: ordereddict([('list_days', 30), ('list_size', 20), ('list_buffer', 20)])                    |
[2021-02-24 00:30:12,535] [builder.py:199]            [DEBUG]    |                                                                                                    |
[2021-02-24 00:30:12,535] [builder.py:200]            [DEBUG]    | Method: tautulli_watched                                                                           |
[2021-02-24 00:30:12,535] [builder.py:201]            [DEBUG]    | Value: ordereddict([('list_days', 30), ('list_size', 20), ('list_buffer', 20)])                    |
[2021-02-24 00:30:12,535] [builder.py:199]            [DEBUG]    |                                                                                                    |
[2021-02-24 00:30:12,535] [builder.py:200]            [DEBUG]    | Method: summary                                                                                    |
[2021-02-24 00:30:12,536] [builder.py:201]            [DEBUG]    | Value: Movies Popular on Plex                                                                      |
[2021-02-24 00:30:12,536] [builder.py:199]            [DEBUG]    |                                                                                                    |
[2021-02-24 00:30:12,536] [builder.py:200]            [DEBUG]    | Method: sort_title                                                                                 |
[2021-02-24 00:30:12,536] [builder.py:201]            [DEBUG]    | Value: ++++_1Plex Popular                                                                          |
[2021-02-24 00:30:12,536] [builder.py:199]            [DEBUG]    |                                                                                                    |
[2021-02-24 00:30:12,536] [builder.py:200]            [DEBUG]    | Method: sync_mode                                                                                  |
[2021-02-24 00:30:12,536] [builder.py:201]            [DEBUG]    | Value: sync                                                                                        |
[2021-02-24 00:30:12,536] [builder.py:199]            [DEBUG]    |                                                                                                    |
[2021-02-24 00:30:12,537] [builder.py:200]            [DEBUG]    | Method: collection_order                                                                           |
[2021-02-24 00:30:12,537] [builder.py:201]            [DEBUG]    | Value: alpha                                                                                       |
[2021-02-24 00:30:12,542] [config.py:390]             [INFO]     |                                                                                                    |
[2021-02-24 00:30:12,543] [config.py:392]             [INFO]     | Sync Mode: sync                                                                                    |
[2021-02-24 00:30:12,685] [builder.py:529]            [DEBUG]    |                                                                                                    |
[2021-02-24 00:30:12,685] [builder.py:530]            [DEBUG]    | Method: tautulli_popular                                                                           |
[2021-02-24 00:30:12,685] [builder.py:531]            [DEBUG]    | Values: [{'list_type': 'popular', 'list_days': 30, 'list_size': 20, 'list_buffer': 20}]            |
[2021-02-24 00:30:12,686] [builder.py:551]            [INFO]     |                                                                                                    |
[2021-02-24 00:30:12,686] [builder.py:552]            [DEBUG]    | Value: {'list_type': 'popular', 'list_days': 30, 'list_size': 20, 'list_buffer': 20}               |
[2021-02-24 00:30:12,686] [tautulli.py:28]            [INFO]     | Processing Tautulli Most Popular: 20 Movies                                                        |
[2021-02-24 00:30:12,686] [tautulli.py:61]            [DEBUG]    | Tautulli URL: http://10.0.0.10:8181/api/v2?apikey=################################&cmd=get_home_stats&time_range=30&stats_count=40 |
[2021-02-24 00:30:12,984] [tautulli.py:61]            [DEBUG]    | Tautulli URL: http://10.0.0.10:8181/api/v2?apikey=################################&cmd=get_library_names |
[2021-02-24 00:30:13,131] [util.py:649]               [INFO]     | Plex Popular Collection | = | The White Tiger                                                      |
[2021-02-24 00:30:13,155] [util.py:649]               [INFO]     | Plex Popular Collection | = | Wrong Turn                                                           |
[2021-02-24 00:30:13,199] [util.py:649]               [INFO]     | Plex Popular Collection | = | Space Sweepers                                                       |
[2021-02-24 00:30:13,225] [util.py:649]               [INFO]     | Plex Popular Collection | = | SOMM                                                                 |
[2021-02-24 00:30:13,250] [util.py:649]               [INFO]     | Plex Popular Collection | = | Saint Maud                                                           |
[2021-02-24 00:30:13,274] [util.py:649]               [INFO]     | Plex Popular Collection | + | SOMM: Into the Bottle                                                |
[2021-02-24 00:30:13,398] [util.py:649]               [INFO]     | Plex Popular Collection | = | Betting on Zero                                                      |
[2021-02-24 00:30:13,403] [util.py:649]               [INFO]     | Plex Popular Collection | + | ๆฉŸๆœƒ (๊ธฐํฌ)                                                              |
[2021-02-24 00:30:13,404] [util.py:594]               [DEBUG]    | Traceback (most recent call last):                                                                 |
                                                                 |   File "/modules/config.py", line 404, in update_libraries
                                                                 |     builder.run_methods(collection_obj, collection_name, map, movie_map, show_map)
                                                                 |   File "/modules/builder.py", line 614, in run_methods
                                                                 |     if len(items) > 0:                                  map = self.library.add_to_collection(collection_obj if collection_obj else collection_name, items, self.filters, self.details["show_filtered"], map, movie_map, show_map)
                                                                 |   File "/modules/plex.py", line 193, in add_to_collection
                                                                 |     else:                                       current.addCollection(name)
                                                                 |   File "/usr/local/lib/python3.9/site-packages/plexapi/base.py", line 477, in addCollection
                                                                 |     self._edit_tags('collection', collections)
                                                                 |   File "/usr/local/lib/python3.9/site-packages/plexapi/base.py", line 465, in _edit_tags
                                                                 |     value = getattr(self, tag + 's')
                                                                 |   File "/usr/local/lib/python3.9/site-packages/plexapi/base.py", line 384, in __getattribute__
                                                                 |     value = super(PlexPartialObject, self).__getattribute__(attr)
                                                                 | AttributeError: 'Track' object has no attribute 'collections'
                                                                 | 
[2021-02-24 00:30:13,406] [config.py:416]             [ERROR]    | Unknown Error: 'Track' object has no attribute 'collections'

"Schedule" tag does not appear to function

Hi there,

I've got an issue with the scheduling functionality in PMM. I have an entry for a movie collection on tmdb:

   Berserk Golden Age Arc Collection:
     tmdb_collection: 118415
     sort_title: 00 - 10 - Collections - Berserk
     sync_mode: sync
     schedule: monthly(1)
     summary: Berserk Golden Age Arc is a series of films covering the backstory of the manga Berserk.
     collection_order: release

The collection creates properly if i comment out the "schedule" tag, but if it's uncommented i get this in the log:

[2021-02-25 17:21:33,225] [util.py:637]               [INFO]     |====================================================================================================|
[2021-02-25 17:21:33,226] [util.py:639]               [INFO]     |                            Berserk Golden Age Arc Collection Collection                            |
[2021-02-25 17:21:33,226] [util.py:640]               [INFO]     |====================================================================================================|
[2021-02-25 17:21:33,226] [config.py:370]             [INFO]     |                                                                                                    |
[2021-02-25 17:21:33,226] [util.py:594]               [DEBUG]    | Traceback (most recent call last):                                                                 |
                                                                 |   File "/modules/config.py", line 374, in update_libraries
                                                                 |     builder = CollectionBuilder(self, library, c, collections[c])
                                                                 |   File "/modules/builder.py", line 141, in __init__
                                                                 |     self.schedule += "\nScheduled monthly on the {}".format(util.make_ordinal(param))
                                                                 | TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'
                                                                 |
[2021-02-25 17:21:33,227] [config.py:377]             [ERROR]    | unsupported operand type(s) for +=: 'NoneType' and 'str'
[2021-02-25 17:21:33,227] [config.py:368]             [INFO]     |

Is this a bug or am i doing something wrong?

Feature Request - Command-line param to process only a specific collection

I have the script set up in a docker container, and it runs at 3 am as planned.

But testing different collection configurations (specifically external lists) I am also running it manually and checking the results.

Would be great if I could provide an extra command line param to make it reprocess a specific collection only, instead of all of them each time.

And yes, I know I can just leave only the collection config I am testing in my Movies.yml file, but still... just an idea. :)

Issue with Movies.YML

Any idea what's wrong here? Log says there is an issue on line 204 and line 7. Can I not add in a plex genre with trakt list?

screenshot 2021-02-28 at 8 39 58 AM

screenshot 2021-02-28 at 8 38 37 AM

Feature Request - Template with multiple poster locations

Is it possible to have a template with a url_poster and file_poster, or url_poster and use the assets folder, so you can choose what you want to use for different collections?

If so, can you give a short example how to do that?

Feature Request - Unraid Support

There is a large community of Plex users who use Unraid/Community Applications to manage Plex. It would be fantastic to have this project's docker file added to their application library as well. Thanks for the fantastic work on this!!!

'datetime' error when using a year search filter

I get the following error when trying to use the year search function with plex_search

| Unknown Error: name 'datetime' is not defined

[2021-02-10 03:27:07,391] [util.py:575] [DEBUG] | Traceback (most recent call last): |
| File "/modules/config.py", line 572, in update_libraries
| elif method_name in ["year", "year.not"]: methods.append(("plex_search", [[(method_name, util.get_year_list(collections[c][m], method_name))]]))
| File "/modules/util.py", line 491, in get_year_list
| current_year = datetime.datetime.now().year
| NameError: name 'datetime' is not defined
|
[2021-02-10 03:27:07,391] [config.py:1029] [ERROR] | Unknown Error: name 'datetime' is not defined

TV Show posters not found

I'm trying to add posters for a TV Show collection, but I don't get any result. I have the posters working fine for movie collections, so I know the basic setup. I'm just not sure if there is something else that goes for shows

| Scanning Dune Collection                                                                           |
|                                                                                                    |
| Sync Mode: sync                                                                                    |
|                                                                                                    |
| Processing TMDb Show: (19566) Frank Herbert's Dune (1 Show)                                        |
| Dune Collection | = | Dune                                                                         |
| 1 Show Processed                                                                                   |
|                                                                                                    |
| Processing TMDb Show: (9156) Frank Herbert's Children of Dune (1 Show)                             |
| Dune Collection | = | Children of Dune                                                             |
| 1 Show Processed                                                                                   |
|                                                                                                    |
| 0 Show Removed                                                                                     |
|                                                                                                    |
| No Files Found: /config/assets/Dune/TV Shows                                                       |
| No Files Found: /config/assets/Dune/TV Shows                                                       |
| Detail: asset_directory updated collection poster to [file] /config/assets/Dune/poster.png         |
|                                                                                                    |

I have tried to put the poster.ext files in TV Shows/Dune and TV Shows/Children of Dune in the assets folder for Dune, but no result. I tried putting the show folders in the Dune folder and that didn't work either. How do I set it up?

IMDB and TMDB collections are not populating with my library

The script appears to be finding and mapping my movies with the imdb ids in the cache file, but when the collections search for matches it is saying that my movies were not found.

The collections generated by searching for actors worked fine but the collections searched for by imdb ids are not populating. Hope I am making sense, here is a copy of my log file.

meta.log.2021-02-12.zip

Oscars List not pulling correctly.

In my Movies YAML I use the Oscars list as shown in the template which had worked well before.

The link is https://www.imdb.com/search/title/?title_type=feature,documentary&groups=oscar_winner

While running, it is attempting to pull from the following:

https://www.imdb.com/search/title/?title_type=feature Seems to be ignoring the ,.

invalid literal for int() with base 10: 'movie'

Hello,

Thanks for you work, the tools is amazing however I have an issue with the MAL integration.
Whenever I'm trying to add collections to my Anime Library it keeps failing on this error.
image

Any idea on how I can enable some kind of verbose mode to help debugging it ?

Thanks !

"People" search doesn't forward to Radarr

Hi there,

I've got PMM working really well, and have lots of collections set up. One thing i've noticed is that while "chart" and "list" collections based on IMDB and Trakt seem to add things that are missing from the list to Radarr, (e.g. IMDB top 250, Trakt list of the Criterion Collection movies), when i do a search on TMDB for, say, a Director, it creates the collection properly for existing movies, but it doesn't seem to add movies missing from the list to radarr. Can this behavior be changed?

Plex_search unknown filter

I am seeing a lot of errors in the log where plex_search isn't working anymore. This worked in a previous version but I can't seem to figure out if it's a bug or something wrong with my config.

Sample log:

Studio

[2021-03-03 16:49:47,487] [util.py:703]               [INFO]     |====================================================================================================|
[2021-03-03 16:49:47,487] [util.py:707]               [INFO]     |                               Illumination Entertainment Collection                                |
[2021-03-03 16:49:47,487] [util.py:708]               [INFO]     |====================================================================================================|
[2021-03-03 16:49:47,487] [config.py:373]             [INFO]     |                                                                                                    |
[2021-03-03 16:49:47,488] [builder.py:192]            [INFO]     | Scanning Illumination Entertainment Collection                                                     |
[2021-03-03 16:49:47,488] [builder.py:219]            [DEBUG]    |                                                                                                    |
[2021-03-03 16:49:47,488] [builder.py:220]            [DEBUG]    | Method: template                                                                                   |
[2021-03-03 16:49:47,488] [builder.py:221]            [DEBUG]    | Value: ordereddict([('name', 'Studio'), ('studio', 'Illumination Entertainment')])                 |
[2021-03-03 16:49:47,488] [builder.py:219]            [DEBUG]    |                                                                                                    |
[2021-03-03 16:49:47,488] [builder.py:220]            [DEBUG]    | Method: summary                                                                                    |
[2021-03-03 16:49:47,488] [builder.py:221]            [DEBUG]    | Value: Illumination is an American film and animation studio founded by Chris Meledandri in 2007 and owned by Universal Pictures, a division of NBCUniversal, which is itself a division of Comcast. Meledandri produces the films, while Universal finances and distributes all the films. The studio is responsible for the Despicable Me and The Secret Life of Pets franchises and the film adaptations of Dr. Seussโ€™ books The Lorax and How the Grinch Stole Christmas. The Minions, characters from the Despicable Me series, are the studio's mascots. |
[2021-03-03 16:49:47,489] [builder.py:219]            [DEBUG]    |                                                                                                    |
[2021-03-03 16:49:47,489] [builder.py:220]            [DEBUG]    | Method: plex_search                                                                                |
[2021-03-03 16:49:47,489] [builder.py:221]            [DEBUG]    | Value: {'studio': 'Illumination Entertainment'}                                                    |
[2021-03-03 16:49:47,489] [builder.py:219]            [DEBUG]    |                                                                                                    |
[2021-03-03 16:49:47,489] [builder.py:220]            [DEBUG]    | Method: sort_title                                                                                 |
[2021-03-03 16:49:47,489] [builder.py:221]            [DEBUG]    | Value: +++_Illumination Entertainment                                                              |
[2021-03-03 16:49:47,489] [builder.py:219]            [DEBUG]    |                                                                                                    |
[2021-03-03 16:49:47,489] [builder.py:220]            [DEBUG]    | Method: collection_order                                                                           |
[2021-03-03 16:49:47,489] [builder.py:221]            [DEBUG]    | Value: release                                                                                     |
[2021-03-03 16:49:47,495] [config.py:396]             [INFO]     |                                                                                                    |
[2021-03-03 16:49:47,496] [config.py:398]             [INFO]     | Sync Mode: sync                                                                                    |
[2021-03-03 16:49:47,628] [builder.py:570]            [DEBUG]    |                                                                                                    |
[2021-03-03 16:49:47,628] [builder.py:571]            [DEBUG]    | Method: plex_search                                                                                |
[2021-03-03 16:49:47,628] [builder.py:572]            [DEBUG]    | Values: [[('studio', ['Illumination Entertainment'])]]                                             |
[2021-03-03 16:49:47,628] [builder.py:592]            [INFO]     |                                                                                                    |
[2021-03-03 16:49:47,629] [builder.py:593]            [DEBUG]    | Value: [('studio', ['Illumination Entertainment'])]                                                |
[2021-03-03 16:49:47,629] [builder.py:613]            [INFO]     | Processing Plex Search: studio(Illumination Entertainment)                                         |
[2021-03-03 16:49:47,636] [util.py:660]               [DEBUG]    | Traceback (most recent call last):                                                                 |
                                                                 |   File "/modules/config.py", line 410, in update_libraries
                                                                 |     builder.run_methods(collection_obj, collection_name, rating_key_map, movie_map, show_map)
                                                                 |   File "/modules/builder.py", line 614, in run_methods
                                                                 |     items = self.library.Plex.search(**search_terms)
                                                                 |   File "/usr/local/lib/python3.9/site-packages/plexapi/library.py", line 668, in search
                                                                 |     args[category] = self._cleanSearchFilter(category, value, libtype)
                                                                 |   File "/usr/local/lib/python3.9/site-packages/plexapi/library.py", line 717, in _cleanSearchFilter
                                                                 |     raise BadRequest('Unknown filter category: %s' % category)
                                                                 | plexapi.exceptions.BadRequest: Unknown filter category: studio
                                                                 | 
[2021-03-03 16:49:47,637] [config.py:425]             [ERROR]    | Unknown Error: Unknown filter category: studio

Actor

[2021-03-03 16:54:55,494] [util.py:703]               [INFO]     |====================================================================================================|
[2021-03-03 16:54:55,494] [util.py:707]               [INFO]     |                                      Adam Sandler Collection                                       |
[2021-03-03 16:54:55,494] [util.py:708]               [INFO]     |====================================================================================================|
[2021-03-03 16:54:55,494] [config.py:373]             [INFO]     |                                                                                                    |
[2021-03-03 16:54:55,495] [builder.py:192]            [INFO]     | Scanning Adam Sandler Collection                                                                   |
[2021-03-03 16:54:55,571] [builder.py:219]            [DEBUG]    |                                                                                                    |
[2021-03-03 16:54:55,571] [builder.py:220]            [DEBUG]    | Method: template                                                                                   |
[2021-03-03 16:54:55,572] [builder.py:221]            [DEBUG]    | Value: ordereddict([('name', 'Actor Writer'), ('person', 19292)])                                  |
[2021-03-03 16:54:55,572] [builder.py:219]            [DEBUG]    |                                                                                                    |
[2021-03-03 16:54:55,572] [builder.py:220]            [DEBUG]    | Method: actor                                                                                      |
[2021-03-03 16:54:55,572] [builder.py:221]            [DEBUG]    | Value: tmdb                                                                                        |
[2021-03-03 16:54:55,572] [builder.py:219]            [DEBUG]    |                                                                                                    |
[2021-03-03 16:54:55,572] [builder.py:220]            [DEBUG]    | Method: writer                                                                                     |
[2021-03-03 16:54:55,572] [builder.py:221]            [DEBUG]    | Value: tmdb                                                                                        |
[2021-03-03 16:54:55,573] [builder.py:219]            [DEBUG]    |                                                                                                    |
[2021-03-03 16:54:55,573] [builder.py:220]            [DEBUG]    | Method: tmdb_person                                                                                |
[2021-03-03 16:54:55,573] [builder.py:221]            [DEBUG]    | Value: 19292                                                                                       |
[2021-03-03 16:54:55,573] [builder.py:219]            [DEBUG]    |                                                                                                    |
[2021-03-03 16:54:55,573] [builder.py:220]            [DEBUG]    | Method: sort_title                                                                                 |
[2021-03-03 16:54:55,573] [builder.py:221]            [DEBUG]    | Value: +_Adam Sandler                                                                              |
[2021-03-03 16:54:55,573] [builder.py:219]            [DEBUG]    |                                                                                                    |
[2021-03-03 16:54:55,573] [builder.py:220]            [DEBUG]    | Method: sync_mode                                                                                  |
[2021-03-03 16:54:55,573] [builder.py:221]            [DEBUG]    | Value: sync                                                                                        |
[2021-03-03 16:54:55,573] [builder.py:219]            [DEBUG]    |                                                                                                    |
[2021-03-03 16:54:55,574] [builder.py:220]            [DEBUG]    | Method: collection_order                                                                           |
[2021-03-03 16:54:55,574] [builder.py:221]            [DEBUG]    | Value: release                                                                                     |
[2021-03-03 16:54:55,579] [config.py:396]             [INFO]     |                                                                                                    |
[2021-03-03 16:54:55,579] [config.py:398]             [INFO]     | Sync Mode: sync                                                                                    |
[2021-03-03 16:54:55,662] [builder.py:570]            [DEBUG]    |                                                                                                    |
[2021-03-03 16:54:55,662] [builder.py:571]            [DEBUG]    | Method: plex_search                                                                                |
[2021-03-03 16:54:55,662] [builder.py:572]            [DEBUG]    | Values: [[('actor', ['Adam Sandler'])]]                                                            |
[2021-03-03 16:54:55,662] [builder.py:592]            [INFO]     |                                                                                                    |
[2021-03-03 16:54:55,662] [builder.py:593]            [DEBUG]    | Value: [('actor', ['Adam Sandler'])]                                                               |
[2021-03-03 16:54:55,662] [builder.py:613]            [INFO]     | Processing Plex Search: actor(Adam Sandler)                                                        |
[2021-03-03 16:54:55,669] [util.py:660]               [DEBUG]    | Traceback (most recent call last):                                                                 |
                                                                 |   File "/modules/config.py", line 410, in update_libraries
                                                                 |     builder.run_methods(collection_obj, collection_name, rating_key_map, movie_map, show_map)
                                                                 |   File "/modules/builder.py", line 614, in run_methods
                                                                 |     items = self.library.Plex.search(**search_terms)
                                                                 |   File "/usr/local/lib/python3.9/site-packages/plexapi/library.py", line 668, in search
                                                                 |     args[category] = self._cleanSearchFilter(category, value, libtype)
                                                                 |   File "/usr/local/lib/python3.9/site-packages/plexapi/library.py", line 717, in _cleanSearchFilter
                                                                 |     raise BadRequest('Unknown filter category: %s' % category)
                                                                 | plexapi.exceptions.BadRequest: Unknown filter category: actor
                                                                 | 
[2021-03-03 16:54:55,670] [config.py:425]             [ERROR]    | Unknown Error: Unknown filter category: actor

Plex Beta TV Agent

Just moved to the beta TV agent released by Plex yesterday. Results in a number of "Agent plex not supported for [show name]" errors in the logs. I think the Plex agent holds the same TVDB, IMDB, TMDB data in it's metadata, so hoping it's just a quick fix to not error on the new agent.

My Anime List Connection Failed

I followed the steps on the wiki to connect to MAL. The authorization sub-attributes are filled in the config.yml file. But every time, it says connection failed in the log. Is there something that is wrong?

Also, for the wiki, there are references to trakt in the MAL page. Is that needed to use MAL?

Feature Request - Add movies poster by folder

Due to the removal of the previous issue, I'm posting one without TPDb. Like before it uses the config and plex (probably not the version this repo uses but similar). Here's the code from my program:

import requests
from bs4 import BeautifulSoup
import os

from config_tools import Plex, Config


# subtype can be 'movie', 'show', or None (movie/tv combined)
def get_collection(plex, data, exact=None, subtype=None):
    collection_list = plex.Library.search(title=data, libtype="collection")
    if len(collection_list) > 1:
        for collection in collection_list:
            if collection.title == data:
                return collection
        if not exact:
            c_names = ["| " + (str(i + 1) + ") " + collection.title + " (" + collection.subtype + ")") for i, collection in enumerate(collection_list)]
            print("| 0) Do Nothing")
            print("\n".join(c_names))
            while True:
                try:
                    selection = int(input("| Choose collection number: ")) - 1
                    if selection >= 0:
                        return collection_list[selection]
                    elif selection == -1:
                        raise ValueError("No collection selected")
                    else:
                        print("| Invalid entry")
                except (IndexError, ValueError) as E:
                    print("| Invalid entry")
    elif len(collection_list) == 1 and (exact is None or collection_list[0].title == data):
        return collection_list[0]
    else:
        raise ValueError("Collection {} Not Found".format(data))

def change_artwork_folder(plex, posters_dir, collection_name):
	for file in os.listdir(posters_dir):
		root, ext = os.path.splitext(file)
		try:
			movie, year = root.split(" (")
			movie = movie.replace("- ", " ")

			try:
				plex_movie = plex.Library.search(title=movie)[0]
				plex_movie.uploadPoster(filepath=f"{posters_dir}/{file}")
			except IndexError:
				print(f"Couldn't find {movie}")
		except ValueError:
			collection = get_collection(plex, collection_name)
			collection.uploadPoster(filepath=f"{posters_dir}/{file}")

########################################################################################################################################

config_path = "config.yml"
config = Config(config_path)
plex = Plex(config_path)

collections = config.collections
for c in collections:
	posters_path = collections[c].get("path_to_posters")
	if posters_path is not None:
		change_artwork_folder(plex, posters_path, c)

tmdb_poster and tmdb_background ignored

It seems that if I specify which background and poster I want to use with my collections, the tool will randomly ignore them and choose completely incorrect images. The summary and other information is correct, just the background and poster are wrong. Lastly, the poster/background is chooses gets applied to other collections as well almost as if it is defaulting to those somehow. The most recent failure I came across is with the following config.

Movies.yml

collections:
  Harry Potter:
    collection_order: release
    tmdb_background: https://www.themoviedb.org/t/p/original/4gV0rKUjB1nLUdZB4zIltLvNZZr.jpg
    tmdb_collection_details: 1241
    tmdb_poster: https://www.themoviedb.org/t/p/original/6P2DrYGCv43DBXYQ7lgnG2e9eW4.jpg

Output

 TMDb Error: No Movie or Collection found for TMDb ID 4                                             |
|                                                                                                    |
| Processing TMDb Collection: (1241) Harry Potter Collection (8 Movies)                              |
| Harry Potter Collection | + | Harry Potter and the Sorcerer's Stone                                |
| Harry Potter Collection | + | Harry Potter and the Chamber of Secrets                              |
| Harry Potter Collection | + | Harry Potter and the Goblet of Fire                                  |
| Harry Potter Collection | + | Harry Potter and the Half-Blood Prince                               |
| Harry Potter Collection | + | Harry Potter and the Prisoner of Azkaban                             |
| Harry Potter Collection | + | Harry Potter and the Order of the Phoenix                            |
| Harry Potter Collection | + | Harry Potter and the Deathly Hallows: Part 1                         |
| Harry Potter Collection | + | Harry Potter and the Deathly Hallows: Part 2                         |
| 8 Movies Processed                                                                                 |
|                                                                                                    |
| 0 Movie Removed                                                                                    |
|                                                                                                    |
| Details: have been updated                                                                         |
| Detail: tmdb_poster updated poster to [url] https://image.tmdb.org/t/p/original/rYFAvSPlQUCebayLcxyK79yvtvV.jpg |
| Detail: tmdb_collection updated background to [url] https://image.tmdb.org/t/p/original/wfnMt6LGqYHcNyOfsuusw5lX3bL.jpg |
| Unknown Error: [Errno 2] No such file or directory: '/config/assets/Harry Potter'                  |

Config Error: config not found at //config

I'm missing something and I'm not sure where it's at. I'm running the docker container under Unraid and I posted my setup over in issue #4. It starts up fine and I just put a config.yml and movies.yml into the folder this afternoon for the first time. I'm assuming the docker container is working because in my /config folder on Unraid that the docker image is pointing to, the logs folder got created fine and the meta.log is there.

But I'm getting this error in my docker log.

File "//plex_meta_manager.py", line 26, in <module>
elif not os.path.exists(os.path.join(default_dir, "config.yml")): raise util.Failed("Config Error: config not found at {}".format(os.path.abspath(default_dir)))

modules.util.Failed: Config Error: config not found at //config

Looks like there's an extra // on the //config somewhere, but I don't see it in either yml file.

Any ideas what I've missed?

Feature request - Collection templates

I have some different types of collections: Actors, Directors, Genres and the normal movie collections. My issue is that there is only one folder where all the collections assets go. Instead of having these different types of collections mixed together in the assets folder, I would like them to have their own sub folders, like assets/Actors and assets/Directors . That would make organizing the files a lot easier.

For each category I have a certain prefix for the sort title: ++D_ for directors, ++A_ for actors and so on. These common settings could be put into a collection template, which would make it easier to handle these different types of collections. Example:

templates:
  Directors:
    sort_title_prefix: ++D_
    asset_directory: assets/Directors

  Actors:
    sort_title_prefix: ++A_
    asset_directory: assets/Actors

collections:
  David Cronenberg:
    template: Directors
    director: tmdb
    tmdb_person: 224

  Arnold Schwarzenegger:
    template: Actors
    actor: tmdb
    tmdb_person: 1100

So with this, the sort titles for the collections would be ++D_David Cronenberg and ++A_Arnold Schwarzenegger and they would have the asset folders assets/Directors/David Cronenberg and assets/Actors/Arnold Schwarzenegger

I'm sure there are a lot more uses with templates, this is just what I have thought of with my own collections.

Feature Request - Add all occurences of a movie

Just noticed this:

I got Midsommar and Midsommar (Director's cut) as split entries for the same Plex Movie metadata match. I updated my manually created A24 collection with the script and it removed the non director's cut from the collection.

When I create a new collection with it only one of these entries are added to the collection.

Would be great when both entries would be added.

Workaround for me for now is to add it manually and use append.

Can't set Original Title on Show item

I followed the example, and the docs say it can (even though I know Agents can't normally)

|====================================================================================================|
|                                      Series Library Metadata                                       |
|====================================================================================================|
|                                                                                                    |
|                                                                                                    |
|====================================================================================================|
|                                                                                                    |
| Updating Show: Avatar: The Last Airbender...                                                       |
| 'Show' object has no attribute 'originalTitle'                                                     |
|                                                                                                    |
|====================================================================================================|

Series.yml

metadata:
  "Avatar: The Last Airbender":
    sort_title: Avatar 01
    alt_title: The Last Airbender
    original_title: The Last Airbender
    seasons:
      1:
        title: "Book One: Water"
      2:
        title: "Book Two: Earth"
      3:
        title: "Book Three: Fire"
  "Avatar: The Legend of Korra":
    sort_title: Avatar 02
    alt_title: The Legend of Korra
    original_title: The Legend of Korra
    seasons:
      1:
        title: "Book One: Air"
      2:
        title: "Book Two: Spirits"
      3:
        title: "Book Three: Change"
      4:
        title: "Book Four: Balance"

With 1.2.2, a missing yml file results in the entire process not running

After the upgrade to 1.2.2 and the automatic changes to my config.yml file, I noticed that PMM wasn't running.

It turns out it was missing a TV Shows.yml file and that was causing it to not run. Here's the log info.

|====================================================================================================|
[2021-02-22 11:48:39,863] [util.py:637]               [INFO]     |====================================================================================================|
[2021-02-22 11:48:39,864] [plex_meta_manager.py:55]   [INFO]     |                                                                                                    |
[2021-02-22 11:48:39,864] [plex_meta_manager.py:56]   [INFO]     |        ____  _             __  __      _          __  __                                           |
[2021-02-22 11:48:39,865] [plex_meta_manager.py:57]   [INFO]     |       |  _ \| | _____  __ |  \/  | ___| |_ __ _  |  \/  | __ _ _ __   __ _  __ _  ___ _ __         |
[2021-02-22 11:48:39,865] [plex_meta_manager.py:58]   [INFO]     |       | |_) | |/ _ \ \/ / | |\/| |/ _ \ __/ _` | | |\/| |/ _` | '_ \ / _` |/ _` |/ _ \ '__|        |
[2021-02-22 11:48:39,865] [plex_meta_manager.py:59]   [INFO]     |       |  __/| |  __/>  <  | |  | |  __/ || (_| | | |  | | (_| | | | | (_| | (_| |  __/ |           |
[2021-02-22 11:48:39,866] [plex_meta_manager.py:60]   [INFO]     |       |_|   |_|\___/_/\_\ |_|  |_|\___|\__\__,_| |_|  |_|\__,_|_| |_|\__,_|\__, |\___|_|           |
[2021-02-22 11:48:39,866] [plex_meta_manager.py:61]   [INFO]     |                                                                            |___/                   |
[2021-02-22 11:48:39,866] [plex_meta_manager.py:62]   [INFO]     |           Version: 1.2.2                                                                           |
[2021-02-22 11:48:39,866] [util.py:637]               [INFO]     |====================================================================================================|
[2021-02-22 11:48:39,867] [util.py:637]               [INFO]     |====================================================================================================|
[2021-02-22 11:48:39,867] [util.py:639]               [INFO]     |                                            Starting Run                                            |
[2021-02-22 11:48:39,867] [util.py:640]               [INFO]     |====================================================================================================|
[2021-02-22 11:48:39,867] [config.py:24]              [INFO]     | Locating config...                                                                                 |
[2021-02-22 11:48:39,868] [config.py:29]              [INFO]     | Using //config/config.yml as config                                                                |
[2021-02-22 11:48:39,916] [util.py:637]               [INFO]     |====================================================================================================|
[2021-02-22 11:48:39,920] [cache.py:37]               [INFO]     | Using cache database at //config/config.cache                                                      |
[2021-02-22 11:48:39,922] [util.py:594]               [DEBUG]    | Config Warning: No Paths exist using ['//config/assets'] as default                                |
[2021-02-22 11:48:39,922] [util.py:637]               [INFO]     |====================================================================================================|
[2021-02-22 11:48:39,922] [config.py:159]             [INFO]     | Connecting to TMDb...                                                                              |
[2021-02-22 11:48:40,025] [config.py:165]             [INFO]     | TMDb Connection Successful                                                                         |
[2021-02-22 11:48:40,026] [util.py:637]               [INFO]     |====================================================================================================|
[2021-02-22 11:48:40,026] [config.py:173]             [INFO]     | Connecting to Trakt...                                                                             |
[2021-02-22 11:48:40,215] [config.py:183]             [INFO]     | Trakt Connection Successful                                                                        |
[2021-02-22 11:48:40,215] [util.py:637]               [INFO]     |====================================================================================================|
[2021-02-22 11:48:40,475] [config.py:192]             [INFO]     | Connecting to My Anime List...                                                                     |
[2021-02-22 11:48:40,475] [config.py:201]             [ERROR]    | Config Error: mal sub-attribute client_id is blank                                                 |
[2021-02-22 11:48:40,476] [config.py:202]             [INFO]     | My Anime List Connection Failed                                                                    |
[2021-02-22 11:48:40,944] [util.py:637]               [INFO]     |====================================================================================================|
[2021-02-22 11:48:40,947] [config.py:212]             [INFO]     | Connecting to Plex Libraries...                                                                    |
[2021-02-22 11:48:40,950] [util.py:637]               [INFO]     |====================================================================================================|
[2021-02-22 11:48:40,951] [config.py:254]             [INFO]     | Connecting to Movies Library...                                                                    |
[2021-02-22 11:48:42,393] [plex.py:46]                [INFO]     | Using Asset Directory: //config/assets                                                             |
[2021-02-22 11:48:42,394] [config.py:275]             [INFO]     | Movies Library Connection Successful                                                               |
[2021-02-22 11:48:42,394] [config.py:282]             [INFO]     | Connecting to Movies library's Radarr...                                                           |
[2021-02-22 11:48:42,415] [config.py:296]             [INFO]     | Movies library's Radarr Connection Successful                                                      |
[2021-02-22 11:48:42,415] [config.py:299]             [INFO]     | Connecting to Movies library's Sonarr...                                                           |
[2021-02-22 11:48:42,509] [config.py:313]             [INFO]     | Movies library's Sonarr Connection Successful                                                      |
[2021-02-22 11:48:42,509] [config.py:316]             [INFO]     | Connecting to Movies library's Tautulli...                                                         |
[2021-02-22 11:48:42,550] [config.py:324]             [INFO]     | Movies library's Tautulli Connection Successful                                                    |
[2021-02-22 11:48:42,551] [util.py:637]               [INFO]     |====================================================================================================|
[2021-02-22 11:48:42,551] [config.py:254]             [INFO]     | Connecting to TV Shows Library...                                                                  |
[2021-02-22 11:48:42,553] [util.py:594]               [DEBUG]    | Traceback (most recent call last):                                                                 |
                                                                 |   File "//plex_meta_manager.py", line 76, in start
                                                                 |     config = Config(default_dir, config_path)
                                                                 |   File "/modules/config.py", line 268, in __init__
                                                                 |     params["metadata_path"] = check_for_attribute(libs[lib], "metadata_path", var_type="path", default=os.path.join(default_dir, "{}.yml".format(lib)), throw=True)
                                                                 |   File "/modules/config.py", line 124, in check_for_attribute
                                                                 |     message = "neither {} or the default path {} could be found".format(data[attribute], default)
                                                                 |   File "/usr/local/lib/python3.9/site-packages/ruamel/yaml/comments.py", line 753, in __getitem__
                                                                 |     return ordereddict.__getitem__(self, key)
                                                                 | KeyError: 'metadata_path'
                                                                 | 
[2021-02-22 11:48:42,556] [plex_meta_manager.py:80]   [CRITICAL] | 'metadata_path'
[2021-02-22 11:48:42,601] [plex_meta_manager.py:81]   [INFO]     | 
[2021-02-22 11:48:42,603] [util.py:637]               [INFO]     |====================================================================================================|
[2021-02-22 11:48:42,604] [util.py:639]               [INFO]     |                                            Finished Run                                            |
[2021-02-22 11:48:42,605] [util.py:640]               [INFO]     |====================================================================================================|

Previously, without a TV Shows.yml file, it still ran fine.

Solution - Created a TV Shows.yml file and populated it with a blank collection.

You may want to add an error check in for this though.

Unclear error message

The error is: 'utf-8' codec can't decode byte 0x92 in position 17055: invalid start byte

It happens when I execute: python3 plex_meta_manager.py --config config/config.yml --run

I didn't find any log files.

Collectionless Confusion

So I think I'm confused with regards to the Collectionless piece. I'll give an example.

Wonder Woman 1984 currently displays in my library as a stand-alone movie, when I believe it should NOT. The movie is a part of the following collections:

80s Movies - Sort title of "++++_61980s Movies"
2020s Movies - Sort title of "++++_62020s Movies"
Trending - Sort title of "++++_2Trending"
Popular - Sort title of "++++_3Popular"
DC Extended Universe - Sort title of "++++_7DC Extended Universe"
Action - Sort title of "++_Action"
Adventure - Sort title of "++_Adventure"
Fantasy - Sort title of "++_Fantasy"
Wonder Woman Collection - Sort title of "Wonder Woman Collection"
Collectionless - Sort title of "~_Collectionless"

For my Movies.yml file, I have the following section:

  Collectionless:
    plex_collectionless:
      exclude_prefix:
        - +
        - "zz_"
        - "~"
    sort_title: ~_Collectionless
    collection_order: alpha

Edit - All the collections are set to Hide Items.

Am I doing something wrong?

IMDB list by keyword

Would it be possible to handle IMDB lists by keyword?

I have just tried creating a collection based on https://www.imdb.com/search/keyword/?keywords=disaster-movie, but got an error

| Processing IMDb List: https://www.imdb.com/search/keyword/?keywords=disaster-movie                 |
| Unknown Error: IMDb Error: https://www.imdb.com/search/keyword/?keywords=disaster-movie must begin with either:
| https://www.imdb.com/list/ls (For Lists)
| https://www.imdb.com/search/title/? (For Searches) |

I am slowly finding my way around how to use it and set up everything in the best way possible, and from what I have seen so far IMDB keyword lists seem far superior to related title (or user-curated) lists I have found.

Error when using `save_missing` attribute with TV show library

Works fine with movie library, but tv library throws the below error:

[2021-02-21 20:48:19,097] [util.py:594]               [DEBUG]    | Traceback (most recent call last):                                                                 |
                                                                 |   File "/mnt/c/repos/unraid/Plex-Meta-Manager/modules/config.py", line 401, in update_libraries
                                                                 |     builder.run_methods(collection_obj, collection_name, map, movie_map, show_map)
                                                                 |   File "/mnt/c/repos/unraid/Plex-Meta-Manager/modules/builder.py", line 658, in run_methods
                                                                 |     self.library.add_missing(c, missing_shows_with_names, False)
                                                                 | NameError: name 'c' is not defined
                                                                 | 
[2021-02-21 20:48:19,098] [config.py:413]             [ERROR]    | Unknown Error: name 'c' is not defined

KeyError causing script to throw exception when adding to radarr

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.

Feature Request - Ignore processing of library with a pre-existing cache

I have a massive library (hence, the use of collections). Caching is amazing and is definitely an improvement over having to remap files repeatedly. However, my issue is that the execution still takes longer than expected to run because it chooses to reprocess all the items in the library to ensure they are in the cache (and to cache them if they aren't).

Is there a way to avoid this check and go straight to execution/collection building? I think verifying cache, as fast as it is still slows down the script, preventing it from running multiple times an hour, for example. Maybe it could look at Recently Added from Plex so it doesn't have to check each previous item (unless you want to on initial execution or to completely refresh the cache).

Not sure if I missed a way to do this, I tried to go through all the documentation but the way it's structured makes it tough if you don't already know what everything means.

Feature Request - Add ability to receive a webhook to trigger refresh of a specified collection

For the "Trending" collection, I have add_to_arr set to true, which is great - except I have the script scheduled to run at 9pm local time and by the time the next run occurs (next day at 9pm), the movie that was added to arr and later imported in plex is no longer trending...

It would be awesome if I could configure a webhook in radarr to trigger PMM to initiate a collection update for the "Trending" collection after a movie is Imported.

TV mapping fails: TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Using develop branch, TV show library failed to map.

[2021-02-18 23:13:38,258] [util.py:629]               [INFO]     |====================================================================================================|
[2021-02-18 23:13:38,258] [util.py:631]               [INFO]     |                                      Mapping TV Shows Library                                      |
[2021-02-18 23:13:38,258] [util.py:632]               [INFO]     |====================================================================================================|
[2021-02-18 23:13:38,258] [config.py:441]             [INFO]     |                                                                                                    |
[2021-02-18 23:13:38,259] [config.py:1140]            [INFO]     | Mapping Show Library: TV Shows                                                                     |
[2021-02-18 23:14:30,205] [util.py:586]               [DEBUG]    | Traceback (most recent call last):                                                                 |
                                                                 |   File "plex_meta_manager.py", line 76, in start
                                                                 |     config.update_libraries(test, collections)
                                                                 |   File "/mnt/c/repos/unraid/Plex-Meta-Manager/modules/config.py", line 442, in update_libraries
                                                                 |     movie_map, show_map = self.map_guids(library)
                                                                 |   File "/mnt/c/repos/unraid/Plex-Meta-Manager/modules/config.py", line 1145, in map_guids
                                                                 |     id_type, main_id = self.get_id(item, library, length)
                                                                 |   File "/mnt/c/repos/unraid/Plex-Meta-Manager/modules/config.py", line 1238, in get_id
                                                                 |     try:                                            tmdb_id = self.Trakt.convert_tvdb_to_tmdb(tvdb_id)
                                                                 |   File "/mnt/c/repos/unraid/Plex-Meta-Manager/modules/trakt.py", line 83, in convert_tvdb_to_tmdb
                                                                 |     def convert_tvdb_to_tmdb(self, tvdb_id):                        return self.convert_id(tvdb_id, "tvdb", "tmdb", "show")
                                                                 |   File "/home/user/.local/lib/python3.8/site-packages/retrying.py", line 49, in wrapped_f
                                                                 |     return Retrying(*dargs, **dkw).call(f, *args, **kw)
                                                                 |   File "/home/user/.local/lib/python3.8/site-packages/retrying.py", line 212, in call
                                                                 |     raise attempt.get()
                                                                 |   File "/home/user/.local/lib/python3.8/site-packages/retrying.py", line 247, in get
                                                                 |     six.reraise(self.value[0], self.value[1], self.value[2])
                                                                 |   File "/usr/lib/python3/dist-packages/six.py", line 703, in reraise
                                                                 |     raise value
                                                                 |   File "/home/user/.local/lib/python3.8/site-packages/retrying.py", line 200, in call
                                                                 |     attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
                                                                 |   File "/mnt/c/repos/unraid/Plex-Meta-Manager/modules/trakt.py", line 92, in convert_id
                                                                 |     return lookup.get_key(to_source) if to_source == "imdb" else int(lookup.get_key(to_source))
                                                                 | TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
                                                                 | 
[2021-02-18 23:14:30,211] [plex_meta_manager.py:79]   [CRITICAL] | int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Setting url_background to null causes collection to be skipped

I have set some of my collection backgrounds to a null value when I am unable to locate a nice enough image to use which previously prevented PMM from using whichever image it choose pre 1.3.0. With the latest release, PMM now skips the collection entirely with the message Collection Error: url_background attribute is blank.

The workaround would be to remove the url_background parameter from all collections that do not leverage it but I prefer to leave it in and set to null so that I can quickly search for url_background: null in the future and replace when I come across images I like.

With this said, is this new behavior as designed or unintentional?

tvdb_show not working

When filling the tvdb_show attribute, I get an error. If I fill with a URL, I get the following error:

[2021-02-11 08:50:08,969] [util.py:575]               [DEBUG]    | Traceback (most recent call last):                                                                 |
                                                                 |   File "/home9/calboi/Plex-Meta-Manager/modules/tvdb.py", line 124, in get_items
                                                                 |     try:                                                    show_ids.append(self.get_series(language, tvdb_id=int(data)))
                                                                 | ValueError: invalid literal for int() with base 10: 'https://www.thetvdb.com/series/beyond-the-boundary'
                                                                 | 
                                                                 | During handling of the above exception, another exception occurred:
                                                                 | 
                                                                 | Traceback (most recent call last):
                                                                 |   File "/home9/calboi/Plex-Meta-Manager/modules/config.py", line 937, in update_libraries
                                                                 |     elif "tvdb" in method:                              items_found += check_map(self.TVDb.get_items(method, value, library.Plex.language))
                                                                 |   File "/home9/calboi/Plex-Meta-Manager/modules/tvdb.py", line 125, in get_items
                                                                 |     except ValueError:                                      show_ids.append(self.get_series(language, tmdb_url=data))
                                                                 | TypeError: get_series() got an unexpected keyword argument 'tmdb_url'
                                                                 | 
[2021-02-11 08:50:08,970] [config.py:1045]            [ERROR]    | Unknown Error: get_series() got an unexpected keyword argument 'tmdb_url'

If I fill with a TVDb ID, I get the following error:

[2021-02-11 08:50:41,961] [tvdb.py:122]               [INFO]     | Processing TVDb Show: 272697                                                                       |
[2021-02-11 08:50:42,713] [tvdb.py:136]               [DEBUG]    | TMDb IDs Found: []                                                                                 |
[2021-02-11 08:50:42,713] [tvdb.py:137]               [DEBUG]    | TVDb IDs Found: [<modules.tvdb.TVDbObj object at 0x7f82624adb20>]                                  |
[2021-02-11 08:50:42,713] [config.py:944]             [ERROR]    | No items found to add to this collection                                                           |
[2021-02-11 08:50:42,714] [config.py:947]             [INFO]     |                                                                                                    |
[2021-02-11 08:50:42,931] [config.py:969]             [ERROR]    | TVDb Error: Could not find a TVDb Series ID at the URL https://www.thetvdb.com/dereferrer/series/<modules.tvdb.TVDbObj object at 0x7f82624adb20> |

YAML Error: mapping values are not allowed here

I'm noticing consistent YAML errors that I can't find the source of in either my config.yml or my movies.yml file. The error is

 YAML Error: mapping values are not allowed here
               in "<unicode string>", line 4741, column 10:
                     19666: 'Lagaan: Once Upon a Time in I ... 
                          ^ (line: 4741) |

I see it repeated over and over in my logs. Neither my config.yml or movies.yml file has a line 4741 though. I also see that this is a reference to a movie I don't even have in my collection or yml files.

https://www.imdb.com/title/tt0169102/

Any ideas what else I can check?

Add label attributes to collections

From reviewing the documentation, there is not currently a way to set labels at the collection level, only at the item level (show or movie). When using managed users and labels to control what users can access, they are not able to see collections by default unless their accounts are added as a label to each collection.

It would be nice to be able to add the labels as a collection details attribute so we could recreate their access programatically.

Example:

collections:
  3 Ninjas:
    collection_order: release
    label: 
      - user01
      - user02
    label_sync_mode: sync
    tmdb_collection_details: 71458
    url_background: null
    url_poster: https://www.themoviedb.org/t/p/original/kTRDNxSlNSE7n9cF9W2xx9frs3d.jpg

Run error

Getting the following error when trying to run on a new machine. Tried the develop and master branches.

File "plex_meta_manager.py", line 3, in <module>
  from modules import tests, util
File "/opt/appdata/Plex-Meta-Manager/modules/tests.py", line 3, in <module>
  from modules.config import Config
File "/opt/appdata/Plex-Meta-Manager/modules/config.py", line 3, in <module>
  from modules.anidb import AniDBAPI
File "/opt/appdata/Plex-Meta-Manager/modules/anidb.py", line 5, in <module>
  from retrying import retry
ModuleNotFoundError: No module named 'retrying'

Command used: python3 plex_meta_manager.py --config config/config.yml --run

Had worked just fine before on another device.

Genre/year using plex_search not working with TV Shows

Applied a few plex_search collections for my TV shows library and they turned out empty even though I definitely have TV shows with these genres. Very strange, because it worked perfectly with my Movies Library, and I was also able to get other collections working with my TV Shows library (Star Wars from TVDB List).

This is the plex_search portion of my current setup in TV Shows.yml:

collections:
  Animated TV Shows:
    plex_search:
      genre: Animation
    sort_title: ++_Animated TV Shows
    sync_mode: sync
    collection_order: alpha          
  Comedy TV Shows:
    plex_search:
      genre: Comedy
    sort_title: ++++_Comedy TV Shows
    sync_mode: sync
    collection_order: alpha
  Drama TV Shows:
    plex_search:
      genre: Drama  
    sort_title: ++_Drama TV Shows
    sync_mode: sync
    collection_order: alpha

It seems to be working perfectly fine with movies, with almost an identical setup. Added this after line 904 in config.py to see if I could debug a bit more

items = library.Plex.search(**search_terms)
items_found += len(items)
print("[DEBUG]: \n", library.Plex.search(genre=["Comedy"]))

and I was able to get a list for the Movies without an issue. However, with the TV shows it results in an "Unknown filter" error for both genre and year. Might be an issue on the end of PlexAPI or I could be doing something wrong here as well.

Error: 'Config' object has no attribute 'get_movie_show_or_collection'

I am getting the error when using tmdb_background. The TMDb ID is correct, as it works for other fields that use it. It happens for all collections that have this attribute.

[2021-02-11 07:50:42,840] [util.py:575]               [DEBUG]    | Traceback (most recent call last):                                                                 |
                                                                 |   File "/home9/calboi/Plex-Meta-Manager/modules/config.py", line 564, in update_libraries
                                                                 |     elif method_name == "tmdb_background":                              backgrounds_found.append(("url", "{}{}".format(self.TMDb.image_url, self.get_movie_show_or_collection(util.regex_first_int(collections[c][m], "TMDb ID"), library.is_movie).poster_path), method_name))
                                                                 | AttributeError: 'Config' object has no attribute 'get_movie_show_or_collection'
                                                                 | 
[2021-02-11 07:50:42,840] [config.py:1029]            [ERROR]    | Unknown Error: 'Config' object has no attribute 'get_movie_show_or_collection'

Also, is it possible to add collection details from a movie or show? If I have a collection built with tmdb_collection using a collection ID, it gives me the following error when I set the tmdb_poster using a show ID: No Movie or Collection found for TMDb ID ###.

Am I doing Genre's right?

So I'm following your setup for Genre's, but I tweaked it some. I'm just wondering if I'm doing something wrong or not

When I look at my Plex and change my view to filter by a Genre of "Thriller", I have 461 movies.

However, my Thriller genre collection only has 62 movies in it.

Here's the settings I'm using for Thriller

  Thriller:
    imdb_list:
    - url: https://www.imdb.com/search/title/?title_type=feature&release_date=1990-01-01,&user_rating=5.0,10.0&num_votes=100000,&genres=thriller
      limit: 100
    - url: https://www.imdb.com/search/title/?title_type=feature&release_date=1990-01-01,&user_rating=5.0,10.0&num_votes=100000,&genres=thriller&sort=user_rating,desc
      limit: 100
    sort_title: ++_Thriller
    sync_mode: append
    summary: Thriller Film is a genre that revolves around anticipation and suspense. The aim for Thrillers is to keep the audience alert and on the edge of their seats. The protagonist in these films is set against a problem an escape, a mission, or a mystery. No matter what sub-genre a Thriller film falls into, it will emphasize the danger that the protagonist faces. The tension with the main problem is built on throughout the film and leads to a highly stressful climax.
    collection_order: alpha
    plex_search:
      genre: Thriller 

I added the plex_search genre Thriller as well, thinking that it would just be easier to pull everything from the Thriller genre of Plex into the Thriller collection, but that's not what I'm seeing happen for some reason.

'Show' object has no attribute 'tagline'

Throws error when trying to edit TV Shows metadata.

Log:

|====================================================================================================|
|                                     TV Shows Library Metadata                                      |
|====================================================================================================|
|                                                                                                    |
|                                                                                                    |
|====================================================================================================|
|                                                                                                    |
| Updating Show: Avatar: The Last Airbender...                                                       |
| 'Show' object has no attribute 'tagline'                                                           |
|                                                                                                    |
|====================================================================================================|

YAML:

metadata:
  "Avatar: The Last Airbender":
    seasons:
      1:
        title: "Book One: Water"
        summary: >-
              After a lapse of 100 years, the Avatar-spiritual master of the elements-has returned. And just in 
              the nick of time. The Four Nations (Water, Earth, Fire, and Air) have become unbalanced. The Fire 
              Nation wants to rule the world, and its first conquest will be the Northern Water Tribe. It's up to 
              a 12-year-old Airbender named Aang to find a way to stop it. Join Aang, Katara, Sokka, Momo, and 
              Appa as they head north on the adventure of a lifetime.
      2:
        title: "Book Two: Earth"
        summary: >-
              Avatar Aang continues his quest to master the four elements before the end of summer. Together with
              Katara, Sokka, Momo, and Appa, he journeys across the Earth Kingdom in search of an Earthbending
              mentor. Along the way, he confronts Princess Azula, treacherous  daughter of Firelord Ozai and 
              sister to Prince Zuko. More powerful than her brother, Azula will stop nothing to defeat the Avatar. 
              But Aang and the gang find plenty of Earth Kingdom allies to help them along the way. From the swamps 
              of the South to the Earth King's palace, Avatar: Book 2 is an adventure like no other.
      3:
        title: "Book Three: Fire"
        summary: >-
              Having survived the terrible battle with Azula, Aang faces new challenges as he and his brave
              friends secretly enter the Fire Nation. Their quest is to find and defeat Firelord Ozai. Along
              the way, they discover that Ozai has plans of his own. The leader of the Fire Nation intends to 
              use the massive power of Sozin's comet to spread his dominion permanently across the four nations. 
              Short on time, Aang has a lot of bending to learn and no master to help him learn it. However, his 
              friends are there to help, and he finds unexpected allies deep in the heart of the Fire Nation. In 
              the spectacular four-part conclusion, Aang must fulfill his destiny and become a fully realized 
              Avatar, or watch the world go up in smoke.

Script no longer runs after latest update: KeyError: 'tautulli'

[2021-02-21 20:31:43,720] [config.py:24]              [INFO]     | Locating config...                                                                                 |
[2021-02-21 20:31:43,721] [config.py:29]              [INFO]     | Using /mnt/c/repos/unraid/Plex-Meta-Manager/config/config.yml as config                            |
[2021-02-21 20:31:43,746] [util.py:594]               [DEBUG]    | Traceback (most recent call last):                                                                 |
                                                                 |   File "plex_meta_manager.py", line 76, in start
                                                                 |     config = Config(default_dir, config_path)
                                                                 |   File "/mnt/c/repos/unraid/Plex-Meta-Manager/modules/config.py", line 69, in __init__
                                                                 |     new_config["tautulli"] = new_config.pop("tautulli")
                                                                 | KeyError: 'tautulli'
                                                                 | 
[2021-02-21 20:31:43,747] [plex_meta_manager.py:80]   [CRITICAL] | 'tautulli'

Using master branch. I dont have tautulli defined in the config file.

[Bug] - Collection - tautulli - doesn't respect sort_title:

Version: 1.1.0
Windows 10
Python: Python 3.8.7

Using the config:

    tautulli_popular:
      list_days: 30
      list_size: 20
      list_buffer: 20
    tautulli_watched:
      list_days: 30
      list_size: 20
      list_buffer: 20
    schedule: daily
    sort_title: +++++_1Plex Popular
    sync_mode: sync
    summary: Movies Popular on Plex
    collection_order: alpha

Appears that the Collection is NOT respecting sort_title
It inserts the Plex Popular instead of +++++_1Plex Popular which is used in the conf file.

image

There is also an error in the console - even though the collection appears to be created and other functions are working correctly.

image

meta.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.