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 ability to customize XML includes when reloading object #607

Merged
merged 12 commits into from
Nov 23, 2020

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

plexapi/base.py Outdated Show resolved Hide resolved
@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:

return self.__dict__[attr]

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
@Hellowlol Hellowlol merged commit 35c5d0d into pkkid:master Nov 23, 2020
JonnyWong16 added a commit to JonnyWong16/python-plexapi that referenced this pull request Dec 4, 2020
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