Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add new collection attributes #729

Merged
merged 5 commits into from
May 10, 2021

Conversation

JonnyWong16
Copy link
Collaborator

@JonnyWong16 JonnyWong16 commented Apr 23, 2021

Description

Add new collection attributes related to smart collections. Actual support for creating smart collections to come later.

Seasons, episodes, and tracks can also be added to collections now.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring for new or existing methods
  • I have added tests when applicable

@meisnate12
Copy link
Contributor

meisnate12 commented Apr 28, 2021

collectionPublished will cause a ValueError to be thrown whenever you access the collection if anything besides 0 or 1 is stored in the field (which is currently possible)

Traceback (most recent call last):
  File "C:\Users\meisn\Documents\Python\Plex Meta Manager\test.py", line 200, in <module>
    item = plex.search("Spider-man", libtype="collection")[0]
  File "C:\Users\meisn\Documents\Python\Plex Meta Manager\venv\lib\site-packages\plexapi\library.py", line 1160, in search
    return self._search(key, maxresults, container_start, container_size, **kwargs)
  File "C:\Users\meisn\Documents\Python\Plex Meta Manager\venv\lib\site-packages\plexapi\library.py", line 1172, in _search
    subresults = self.fetchItems(key, container_start=container_start,
  File "C:\Users\meisn\Documents\Python\Plex Meta Manager\venv\lib\site-packages\plexapi\library.py", line 386, in fetchItems
    items = self.findItems(data, cls, ekey, **kwargs)
  File "C:\Users\meisn\Documents\Python\Plex Meta Manager\venv\lib\site-packages\plexapi\base.py", line 266, in findItems
    item = self._buildItemOrNone(elem, cls, initpath)
  File "C:\Users\meisn\Documents\Python\Plex Meta Manager\venv\lib\site-packages\plexapi\base.py", line 98, in _buildItemOrNone
    return self._buildItem(elem, cls, initpath)
  File "C:\Users\meisn\Documents\Python\Plex Meta Manager\venv\lib\site-packages\plexapi\base.py", line 90, in _buildItem
    return ecls(self._server, elem, initpath)
  File "C:\Users\meisn\Documents\Python\Plex Meta Manager\venv\lib\site-packages\plexapi\base.py", line 53, in __init__
    self._loadData(data)
  File "C:\Users\meisn\Documents\Python\Plex Meta Manager\venv\lib\site-packages\plexapi\collection.py", line 59, in _loadData
    self.collectionPublished = utils.cast(bool, data.attrib.get('collectionPublished', '0'))
  File "C:\Users\meisn\Documents\Python\Plex Meta Manager\venv\lib\site-packages\plexapi\utils.py", line 83, in cast
    raise ValueError(value)
ValueError: 4

@JonnyWong16
Copy link
Collaborator Author

Don't put random numbers in the setting... Plex has already said that the input box in the UI is an error and they will be removing it.

@meisnate12
Copy link
Contributor

gotcha I was testing if the number there had anything to do with whether or not a collection was published on the homepage and just noticed that it caused this error so just figured I'd let you know

@JonnyWong16
Copy link
Collaborator Author

It's a bool, so it's only 1 (True) or 0 (False).

@meisnate12
Copy link
Contributor

It's just that the average user doesn't know that so if someone just puts something there not knowing any better and then tries to run a script that loads that collection it's going to error every time the script tries to access that collection. While it may be a bool the UI looks like a string and allows a string value to be stored there so I feel at the very least this shouldn't error just trying to load the collection when there is a string.

@JonnyWong16
Copy link
Collaborator Author

  1. I'm just letting you know that it's a bool, not saying everyone needs to know.
  2. Plex has already said they are removing it from the UI.
  3. This hasn't been merged yet, so there is no issue with anyone accidentally using it.

@JonnyWong16 JonnyWong16 merged commit ecd9309 into pkkid:master May 10, 2021
@JonnyWong16 JonnyWong16 deleted the feature/smart_collections branch May 13, 2021 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants