Skip to content

Conversation

@JonnyWong16
Copy link
Collaborator

@JonnyWong16 JonnyWong16 commented Nov 21, 2020

Description

Add ability to customize XML includes when reloading a PlexObject.

  • The default _details_key always has all the includes.
  • A partial reload with includes disabled (e.g. reload(checkFiles=False)) will remain as a partial object.
  • A full reload() will have all includes so it will be a full object (existing behaviour maintained).

The only potential breaking change is objects that used to have a blank _details_key = '' now have a populated _details_key = key. I don't think this should cause any issues because the _details_key is only used when reloading and it checks for the _details_key or key so it makes no difference if they are now equal.

Fixes #603
Conflicts with #590 (the _includes parameters were refactored)
Requires #606 (isFullObject() needs to check the _details_key instead of key)

TODO: Tests need to be added for reloading with includes disabled.

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

@Hellowlol
Copy link
Collaborator

Looks good! We only need tests to verify that the behavior is as expected and that we don’t break anything.

@Hellowlol
Copy link
Collaborator

Nice. I noticed some tests that failed because of the pr.

@JonnyWong16
Copy link
Collaborator Author

JonnyWong16 commented Nov 22, 2020

The test needs to be re-run. It looks like my change didn't get pulled into the test.

Line 25:
https://github.com/pkkid/python-plexapi/blob/387ab170723c8a733766cbf72098bc270095a3ad/plexapi/settings.py#L25

But the test says line 24:
https://travis-ci.org/github/pkkid/python-plexapi/jobs/745126871#L886

Edit: Tests pass now. The failing library collection tests are fixed with #606.

@Hellowlol
Copy link
Collaborator

Hellowlol commented Nov 22, 2020

Nice work! 👍 the only thing I think we should improve the the doc string of the kwargs. I think we should mention why this can be usefull as we have got questions about speed and reloads before.

I’m gonna leave this open for a day so others have had the time to chip in before I merge

@JonnyWong16
Copy link
Collaborator Author

Refactored the includes to PlexPartialObject so that they are used by Audio, Video, Photoalbum, Photo, Collections, and Playlist.

Doc string for reload() is updated.

@Hellowlol
Copy link
Collaborator

Is the include the same for all the classes?

@JonnyWong16
Copy link
Collaborator Author

Most of them are the same when you view them through Plex Web. Some might be extra (e.g. for Playlists) but it doesn't affect the response from the server.

@JonnyWong16 JonnyWong16 force-pushed the feature/custom_includes branch 2 times, most recently from b8e1739 to 688049d Compare November 23, 2020 03:03
@JonnyWong16 JonnyWong16 force-pushed the feature/custom_includes branch from 688049d to 7f7d032 Compare November 23, 2020 03:06
@Hellowlol Hellowlol merged commit 35c5d0d into pushingkarmaorg:master Nov 23, 2020
JonnyWong16 added a commit to JonnyWong16/python-plexapi that referenced this pull request Dec 4, 2020
…m_includes

Add ability to customize XML includes when reloading object
@JonnyWong16 JonnyWong16 deleted the feature/custom_includes branch May 13, 2021 00:28
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.

Make Plex XML "include" parameters configurable

2 participants